美文网首页
Linux云计算学习笔记day54

Linux云计算学习笔记day54

作者: 我要笑 | 来源:发表于2019-07-06 23:06 被阅读0次

    Tomcat

    2.1 网站代码 PHP LNMP

    Java LNMT(Tomcat/Resin/)
    Oracle (Weblogic)

    2.2 JVM

    Windows版本的QQ qq.exe 放在Linux 可以运行?
    我们希望 1份代码 可以运行在不同的 系统中 (代码的可移植性)
    JAVA程序 会被放在1个叫虚拟机容器
    JVM Java Virtual Machine Java虚拟机 运行java程序 :1份代码处处使用

    2.3 JDK +TOMCAT

    JDK Java Development Kit Java程序运行环境
    TOMCAT (nginx) 存放java程序代码

    2.4 JDK+TOMCAT 环境准备

    tree vim wget bash-completion bash-completion-extras lrzsz net-tools sysstat iotop iftop htop unzip nc nmap telnet bc psmisc httpd-tools bind- utils

    2.4.1 JDK

    JDK
    Oracle jdk
    OpenJDK

    [root@oldboy tomcat大礼包]# tar xf jdk-8u60-linux-x64.tar.gz
    [root@oldboy tomcat大礼包]# ll
    total 409940
    -rw-r--r-- 1 root root 8491533 Mar 3 2017 apache-maven-3.3.9-bin.tar.gz -rw-r--r-- 1 root root 9128610 Oct 5 2015 apache-tomcat-8.0.27.tar.gz
    <-rw-r--r-- 1 root root 20124 Aug 1 2018 cmdline-jmxclient-0.10.3.jar
    drwxr-xr-x 8 10 143 4096 Aug 5 2015 jdk1.8.0_60
    -rw-r--r-- 1 root root 178639264 Sep 11 2017 JDK_1.8.0_64bit.exe
    -rw-r--r-- 1 root root 181238643 Oct 5 2015 jdk-8u60-linux-x64.tar.gz
    -rw-r--r-- 1 root root 20797013 Mar 3 2017 jpress-web-newest.war
    -rw-r--r-- 1 root root 20797013 Mar 3 2017 jpress-web-newest.zip
    -rw-r--r-- 1 root root
    -rw-r--r-- 1 root root
    -rw-r--r-- 1 root root
    -rw-r--r-- 1 root root
    [root@oldboy tomcat大礼包]# mv jdk1.8.0_60/ /application/
    [root@oldboy tomcat大礼包]# mv jdk1.8.0_60/ /application/
    [root@oldboy tomcat大礼包]# ln -s /application/jdk1.8.0_60/ /application/jdk [root@oldboy tomcat大礼包]# /application/jdk/bin/java --version
    Unrecognized option: --version
    Error: Could not create the Java Virtual Machine.
    Error: A fatal exception has occurred. Program will exit. [root@oldboy tomcat大礼包]# /application/jdk/bin/java -version java version "1.8.0_60"
    Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
    Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
    [root@oldboy
    [root@oldboy
    jdk/
    [root@oldboy
    tomcat大礼包]#
    tomcat大礼包]# ll /application/jdk jdk1.8.0_60/
    tomcat大礼包]# cat >>/etc/profile<<'EOF'
    407 Jan 26 2016 meminfo.jsp
    4126 Jan 26 2016 show-busy-java-threads.sh
    28759 Aug 1 2018 Tomcat安全管理规范.docx 592882 Dec 10 2016 抽奖.gif
    export JAVA_HOME=/application/jdk
    export PATH=JAVA_HOME/bin:JAVA_HOME/jre/bin:PATH export CLASSPATH=.:JAVA_HOME/lib:JAVA_HOME/jre/lib:JAVA_HOME/lib/tools.jar EOF
    [root@oldboy tomcat大礼包]# . /etc/profile
    [root@oldboy tomcat大礼包]# java -version
    java version "1.8.0_60"
    Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
    Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

    2.4.2 TOMCAT

    Apache 软件基金会中的一个开源软件 apache (nginx) web服务
    nginx
    httpd

    [root@oldboy tomcat大礼包]# mv apache-tomcat-8.0.27 /application/tomcat- 8.0.27
    [root@oldboy tomcat大礼包]# ln -s /application/tomcat-8.0.27 /application/tomcat
    [root@oldboy tomcat大礼包]# ll /application/tomcat
    lrwxrwxrwx 1 root root 26 Jul 5 10:19 /application/tomcat -> /application/tomcat-8.0.27
    [root@oldboy tomcat大礼包]# echo 'export TOMCAT_HOME=/application/tomcat/' >>/etc/profile
    [root@oldboy tomcat大礼包]# . /etc/profile

    [root@oldboy tomcat大礼包]#
    [root@oldboy tomcat大礼包]# tail /etc/profile
    fi fi
    done
    unset i
    unset -f pathmunge
    export JAVA_HOME=/application/jdk
    export PATH=JAVA_HOME/bin:JAVA_HOME/jre/bin:PATH export CLASSPATH=.:JAVA_HOME/lib:JAVA_HOME/jre/lib:JAVA_HOME/lib/tools.jar
    export TOMCAT_HOME=/application/tomcat/
    [root@oldboy tomcat大礼包]# /application/tomcat/bin/version.sh Using CATALINA_BASE: /application/tomcat
    Using CATALINA_HOME: /application/tomcat
    Using CATALINA_TMPDIR: /application/tomcat/temp
    Using JRE_HOME: /application/jdk
    Using CLASSPATH:
    /application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-
    juli.jar
    Server version: Apache Tomcat/8.0.27
    Server built: Sep 28 2015 08:17:25 UTC
    Server number: 8.0.27.0
    OS Name:
    OS Version:
    Architecture:
    JVM Version:
    JVM Vendor:
    [root@oldboy tomcat大礼包]#
    Linux
    3.10.0-957.21.3.el7.x86_64
    amd64
    1.8.0_60-b27
    Oracle Corporation

    2.4.3 启动

    [root@oldboy ~]# /application/tomcat/bin/startup.sh Using CATALINA_BASE: /application/tomcat
    Using CATALINA_HOME: /application/tomcat
    Using CATALINA_TMPDIR: /application/tomcat/temp Using JRE_HOME: /application/jdk
    Using CLASSPATH: /application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat- juli.jar
    Tomcat started.
    [root@oldboy ~]# ss -lntup |grep tomcat
    [root@oldboy ~]# ss -lntup |grep java
    tcp LISTEN 0 1 127.0.0.1:8005
    tcp LISTEN 0 100 *:8009
    tcp LISTEN 0 100 *:8080
    [root@oldboy ~]# ps -ef |grep java
    root 13452 1 4 10:24 pts/1 00:00:02 /application/jdk/bin/java - Djava.util.logging.config.file=/application/tomcat/conf/logging.properties - Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager - Djava.endorsed.dirs=/application/tomcat/endorsed -classpath /application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-juli.jar -
    : :
    :
    users:(("java",pid=13452,fd=69)) users:(("java",pid=13452,fd=51)) users:(("java",pid=13452,fd=46))
    Dcatalina.base=/application/tomcat -Dcatalina.home=/application/tomcat - Djava.io.tmpdir=/application/tomcat/temp org.apache.catalina.startup.Bootstrap start root 13483 13261 0 10:25 pts/1 00:00:00 grep --color=auto java

    2.5 Tomcat目录结构

    [root@oldboy ~]# ll /application/tomcat/
    total 112
    drwxr-xr-x 2 root root 4096 Jul 5 10:19 bin
    shutdown.sh catalina.sh

    命令 startup.sh

    drwxr-xr-x 3 root root 4096 Jul 5 10:24 conf
    drwxr-xr-x 2 root root 4096 Jul 5 10:19 lib
    -rw-r--r-- 1 root root 57011 Sep 28 2015 LICENSE
    drwxr-xr-x 2 root root 4096 Jul 5 10:24 logs
    -rw-r--r-- 1 root root 1444 Sep 28 2015 NOTICE
    -rw-r--r-- 1 root root 6741 Sep 28 2015 RELEASE-NOTES
    -rw-r--r-- 1 root root 16204 Sep 28 2015 RUNNING.txt
    drwxr-xr-x 2 root root 4096 Jul 5 10:19 temp
    drwxr-xr-x 7 root root 4096 Sep 28 2015 webapps
    drwxr-xr-x 3 root root 4096 Jul 5 10:24 work

    2.5.1 bin

    catalina.sh
    shutdown.sh 和startup.sh 调用的
    修改Tomcat参数 优化 修改这个文件 startup.sh
    shutdown.sh #关闭tomcat之后 一定检查 端口和进程

    exec "PRGDIR"/"EXECUTABLE" stop "$@"
    /application/tomcat/bin/catalina.sh stop

    2.5.2 conf

    properties 属性 [ˈprɑpərtiz]

    server.xml (nginx.conf) 主配置文件
    web.xml 扩展功能 额外功能
    logging.properties 日志 属性
    tomcat-users.xml #tomcat管理端用户和密码的配置文件 用于测试环境 生产环境 禁止使用

    2.5.3 logs

    Destroying 毁灭
    startup 启动
    error 错误

    catalina.out
    tomcat日志 最全的日志

    这个日志默认会被轮询(定时切割),切割之后catalina.out日志内容不会被清空
    catalina.2019-07-05.log 中间日期 ,catalina.out的切割日志 localhost_access_log.2019-07-05.txt #访问日志

    image.png

    2.5.4 webapps

    nginx html 站点目录

    2.5.x了解

    lib 库文件 tomcat以后安装的插件
    temp 临时文件

    2.6 Tomcat 管理端配置

    开头字符集
    注释 xml格式中
    rolename 角色 RPG Role-playing game
    admin-gui
    manager-gui
    host-gui

    <[root@oldboy /application/tomcat]# cat conf/tomcat-users.xml
    <?xml version='1.0' encoding='utf-8'?>
    <tomcat-users xmlns="http://tomcat.apache.org/xml"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-
    users.xsd"
    version="1.0">
    <role rolename="admin-gui"/>
    <role rolename="manager-gui"/>
    <role rolename="host-gui"/>
    <user username="oldboy" password="oldboy" roles="admin-gui,manager-
    gui,host-gui"/>
    </tomcat-users>

    <[root@oldboy /application/tomcat]# /application/tomcat/bin/shutdown.sh
    Using CATALINA_BASE: /application/tomcat
    Using CATALINA_HOME: /application/tomcat
    Using CATALINA_TMPDIR: /application/tomcat/temp
    Using JRE_HOME: /application/jdk
    Using CLASSPATH:
    /application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-
    juli.jar
    [root@oldboy /application/tomcat]# ps -ef |grep java
    root 13795 13261 0 11:45 pts/1 00:00:00 grep --color=auto java
    [root@oldboy /application/tomcat]# /application/tomcat/bin/startup.sh
    [root@oldboy /application/tomcat]# /application/tomcat/bin/startup.sh
    Using CATALINA_BASE: /application/tomcat
    Using CATALINA_HOME: /application/tomcat
    Using CATALINA_TMPDIR: /application/tomcat/temp
    Using JRE_HOME: /application/jdk
    Using CLASSPATH:
    /application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-
    juli.jar
    Tomcat started.

    image.png

    2.7 Tomcat 主配置文件 server.xml

    8080 http端口
    8005 shutdown端口 连接上 输入暗号关闭tomcat 默认只能本地连接8005端口

    <Server port="8005" shutdown="SHUTDOWN">

    管理端存放用户名密码的文件 及存放方式

    <Resource name="UserDatabase" auth="Container"
    type="org.apache.catalina.UserDatabase"
    description="User database that can be updated and saved"
    factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
    pathname="conf/tomcat-users.xml" />

    http协议端口 8080

    <Connector port="8080" protocol="HTTP/1.1"
    connectionTimeout="20000"
    redirectPort="8443" />

    8009 A JP 与apache 进行通讯

    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

    nginx 虚拟主机 server {}
    <Host
    xxxxxx

    image.png

    <Host name="localhost" appBase="webapps"
    unpackWARs="true" autoDeploy="true">

        <Valve className="org.apache.catalina.valves.AccessLogValve"
    

    directory="logs"
    </Host>

    2.8 Tomcat部署 app(应用)

    准备数据库:

    yum install -y mariadb-server
    [root@oldboy /application/tomcat]# systemctl enable mariadb.service
    Created symlink from /etc/systemd/system/multi-
    user.target.wants/mariadb.service to
    /usr/lib/systemd/system/mariadb.service.
    [root@oldboy /application/tomcat]# systemctl start mariadb.service
    create database jpress DEFAULT CHARACTER SET utf8;

    grant all on jpress.* to jpress@'localhost' identified by '123456';
    grant all on jpress.* to jpress@'172.16.%.%' identified by '123456';
    MariaDB [(none)]> select user,host from mysql.user;
    +--------+------------+
    | user | host |
    +--------+------------+
    | root | 127.0.0.1 |
    | jpress | 172.16.%.% |
    | root | ::1 |
    | | localhost |
    | jpress | localhost |
    | root
    |
    | root
    +--------+------------+
    8 rows in set (0.00 sec)
    | localhost |
    | oldboy |
    | oldboy |
    MariaDB [(none)]> drop user
    Query OK, 0 rows affected (0.00 sec)
    MariaDB [(none)]> drop user ''@oldboy;
    Query OK, 0 rows affected (0.00 sec)

    MariaDB [(none)]> select user,host from mysql.user;
    +--------+------------+
    | user | host |
    +--------+------------+
    | root | 127.0.0.1 |
    | jpress | 172.16.%.% |
    | root | ::1 |
    | jpress | localhost |
    | root | localhost |
    | root | oldboy |
    +--------+------------+

    6 rows in set (0.00 sec)
    MariaDB [(none)]> flush privileges;
    Query OK, 0 rows affected (0.00 sec)
    [root@oldboy /application/tomcat]# mysql -ujpress -p
    Enter password:
    Welcome to the MariaDB monitor. Commands end with ; or \g.
    Your MariaDB connection id is 3
    Server version: 5.5.60-MariaDB MariaDB Server
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    Type 'help;' or '\h' for help. Type '\c' to clear the current input
    statement.
    MariaDB [(none)]> Bye

    扩展 mysql -e 参数 非交互式执行SQL语句
    ssh 172.16.1.41 hostname
    su - oldboy -c whoami

    [root@oldboy /app/tools/tomcat]# mysql -ujpress -p
    Enter password:
    +------------------+
    | user() |
    +------------------+
    | jpress@localhost |
    +------------------+
    -e 'select user();'

    准备app(war包):

    jpress java wordpress

    [root@oldboy /app/tools/tomcat]# ll
    total 389624
    -rw-r--r-- 1 root root 8491533 Mar 3 2017 apache-maven-3.3.9-bin.tar.gz
    -rw-r--r-- 1 root root 9128610 Oct 5 2015 apache-tomcat-8.0.27.tar.gz
    -rw-r--r-- 1 root root 20124 Aug 1 2018 cmdline-jmxclient-0.10.3.jar
    -rw-r--r-- 1 root root 178639264 Sep 11 2017 JDK_1.8.0_64bit.exe
    -rw-r--r-- 1 root root 181238643 Oct 5 2015 jdk-8u60-linux-x64.tar.gz
    -rw-r--r-- 1 root root 20797013 Mar 3 2017 jpress-web-newest.zip
    -rw-r--r-- 1 root root
    -rw-r--r-- 1 root root
    -rw-r--r-- 1 root root
    -rw-r--r-- 1 root root
    [root@oldboy /app/tools/tomcat]# mv jpress-web-newest.war
    /application/tomcat/webapps/jpress.war
    407 Jan 26 2016 meminfo.jsp
    4126 Jan 26 2016 show-busy-java-threads.sh
    28759 Aug 1 2018 Tomcat安全管理规范.docx 592882 Dec 10 2016 抽奖.gif
    [root@oldboy /app/tools/tomcat]# cd /application/tomcat
    [root@oldboy /application/tomcat]# ll webapps/
    total 20336
    drwxr-xr-x 14 root root
    drwxr-xr-x 6 root root
    drwxr-xr-x 5 root root
    drwxr-xr-x 7 root root
    -rw-r--r-- 1 root root 20797013 Mar 3 2017 jpress.war
    4096 Jul 5 10:19 docs
    4096 Jul 5 10:19 examples
    4096 Jul 5 10:19 host-manager
    4096 Jul 5 12:40 jpress

    drwxr-xr-x 5 root root 4096 Jul 5 10:19 manager
    drwxr-xr-x 3 root root 4096 Jul 5 10:19 ROOT

    浏览器访问: ip:8080/jpress即可

    image.png image.png image.png

    http://47.111.143.246:8080/jpress/ 访问web页面 访问后台:http://47.111.143.246:8080/jpress/admin 进入后台书写文章 发布出来
    用户上传的文件 存放在

    [root@oldboy /application/tomcat/webapps/jpress]# ll attachment/20190705/
    total 292
    -rw-r--r-- 1 root root 9091 Jul 5 12:55
    2b1fcf8e50e449eb96b0f75b55589095_240x140.jpg
    -rw-r--r-- 1 root root 21881 Jul 5 12:55
    2b1fcf8e50e449eb96b0f75b55589095_300x300.jpg
    -rw-r--r-- 1 root root 35365 Jul 5 12:55
    2b1fcf8e50e449eb96b0f75b55589095_600x300.jpg
    -rw-r--r-- 1 root root 34038 Jul 5 12:55
    2b1fcf8e50e449eb96b0f75b55589095_780x240.jpg
    -rw-r--r-- 1 root root 123426 Jul 5 12:55
    2b1fcf8e50e449eb96b0f75b55589095.jpg
    -rw-r--r-- 1 root root 4961 Jul 5 12:55
    4a115a7801224864b3c5bdee148d7a9a_240x140.jpg
    -rw-r--r-- 1 root root 9881 Jul 5 12:55
    4a115a7801224864b3c5bdee148d7a9a_300x300.jpg
    -rw-r--r-- 1 root root 15065 Jul 5 12:55
    4a115a7801224864b3c5bdee148d7a9a_600x300.jpg
    -rw-r--r-- 1 root root 14510 Jul 5 12:55
    4a115a7801224864b3c5bdee148d7a9a_780x240.jpg
    -rw-r--r-- 1 root root 6333 Jul 5 12:55
    4a115a7801224864b3c5bdee148d7a9a.jpg

    查看数据库中的文章

    MariaDB [(none)]> select * from jpress.jpress_content \G
    *************************** 1. row ***************************
    id: 1
    title: hhh
    text: <p><img
    src="/jpress/attachment/20190705/2b1fcf8e50e449eb96b0f75b55589095.jpg"
    alt="" width="750" height="880"></p>
    <p> </p>

    <p><img
    src="/jpress/attachment/20190705/4a115a7801224864b3c5bdee148d7a9a.jpg" alt="" width="205" height="226"></p>
    <p> </p>
    <p>哈哈哈</p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    summary: NULL
    link_to: NULL
    markdown_enable: 0
    thumbnail: NULL
    module: article
    style: NULL
    user_id: 1
    author: NULL
    user_email: NULL
    user_ip: NULL
    user_agent: NULL
    parent_id: NULL
    object_id: NULL
    order_number: 0
    status: normal
    vote_up: 0
    vote_down: 0
    rate: NULL
    rate_count: 0
    price: 0.00
    comment_status: NULL
    comment_count: 0
    comment_time: NULL
    view_count: 23
    created: 2019-07-05 12:56:14
    modified: 2019-07-05 12:56:14 slug: hhh flag: NULL
    lng: NULL
    lat: NULL
    meta_keywords: NULL
    meta_description: NULL
    remarks: NULL
    1 row in set (0.00 sec)
    MariaDB [(none)]>

    wordpress wp-config.php
    jpress db.properties

    [root@oldboy /application/tomcat/webapps/jpress]# cat WEB-

    INF/classes/db.properties

    Auto create by JPress

    Fri Jul 05 12:51:56 CST 2019

    db_name=jpress
    db_host_port=3306
    db_tablePrefix=jpress_
    db_host=localhost
    db_password=123456
    db_user=jpress

    温馨提示:
    1.关闭 检查端口与进程 2.Tomcat没有完全关闭,会有大量的日志在catalina.out中

    2.9 Tomcat与负载均衡

    1个tomcat存放1个app 1个tomcat存放1个app 1个tomcat存放1个app
    upstream proxy
    upstream app_pools { server 10.0.0.7:8080; server 10.0.0.7:8081; server 10.0.0.7:8082; server 10.0.0.8:8080;
    }

    2.10 Tomcat监控 2.10.1 命令行

    jps -lvm

    [root@oldboy /application/tomcat/webapps/jpress]# ps -ef |grep java
    root 16545 1 0 14:41 pts/3 00:00:15 /application/jdk/bin/java -
    Djava.util.logging.config.file=/application/tomcat/conf/logging.properties -
    Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -
    Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8899 -
    Dcom.sun.management.jmxremote.authenticate=false -
    Dcom.sun.management.jmxremote.ssl=false -
    Djava.rmi.server.hostname=47.111.143.246 -
    Djava.endorsed.dirs=/application/tomcat/endorsed -classpath
    /application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-juli.jar
    -Dcatalina.base=/application/tomcat -Dcatalina.home=/application/tomcat -
    Djava.io.tmpdir=/application/tomcat/temp
    org.apache.catalina.startup.Bootstrap start
    root 16692 13261 0 15:25 pts/1 00:00:00 grep --color=auto java

    catalina.sh

    /application/jdk/bin/java
    -
    Djava.util.logging.config.file=/application/tomcat/conf/logging.properties
    -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
    -Djava.endorsed.dirs=/application/tomcat/endorsed
    -classpath
    /application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-
    juli.jar
    -Dcatalina.base=/application/tomcat
    -Dcatalina.home=/application/tomcat
    -Djava.io.tmpdir=/application/tomcat/temp
    org.apache.catalina.startup.Bootstrap
    start

    [root@oldboy /application/tomcat/bin]# jps -lvm
    16744 org.apache.catalina.startup.Bootstrap start -
    Djava.util.logging.config.file=/application/tomcat/conf/logging.properties -
    Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -
    Djava.endorsed.dirs=/application/tomcat/endorsed -
    Dcatalina.base=/application/tomcat -Dcatalina.home=/application/tomcat -
    Djava.io.tmpdir=/application/tomcat/temp
    16813 sun.tools.jps.Jps -lvm -
    Denv.class.path=.:/application/jdk/lib:/application/jdk/jre/lib:/application/
    jdk/lib/tools.jar -Dapplication.home=/application/jdk1.8.0_60 -Xms8m

    show-busy-java-threads.sh 显示当前系统中 java进程 负载 cpu 使用率较高 ps -ef 进程信息
    进程 process pid 房子 空间
    线程 thread 处理用户请求
    pstree -pa

    2.10.2 开启tomcat监控功能

    应用场景:是用于zabbix监控tomcat zabbix监控tomcat的方法之一
    在catalina.sh 文件中加入

    CATALINA_OPTS="$CATALINA_OPTS
    -Dcom.sun.management.jmxremote
    -Dcom.sun.management.jmxremote.port=12345
    -Dcom.sun.management.jmxremote.authenticate=false
    -Dcom.sun.management.jmxremote.ssl=false
    -Djava.rmi.server.hostname=10.0.0.17"

    CATALINA_OPTS="$CATALINA_OPTS .* " #表示java程序启动的时候 增加的参数 -Dcom.sun.management.jmxremote #开启tomcat 远程监控功能 -Dcom.sun.management.jmxremote.port=12345 #指定端口

    -Dcom.sun.management.jmxremote.authenticate=false
    码)
    -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=10.0.0.17"
    (本地
    实际工作写上服务器的内网ip地址 测试环境中 可以写上 服务器的公网ip

    是否开启认证模式(用户名 密

    是否开启 https

    sshd ListenAddress 监听的地址

    image.png

    [root@oldboy ~]# ss -lntup |grep java [root@oldboy ~]# ss -lntup |grep java
    tcp LISTEN 0 tcp LISTEN 0 tcp LISTEN 0 tcp LISTEN 0 tcp LISTEN 0
    100 *:8009 50 *:34345 100 *:8080 50 *:33142 50 *:12345
    : users:(("java",pid=17028,fd=54)) : users:(("java",pid=17028,fd=19)) : users:(("java",pid=17028,fd=50)) : users:(("java",pid=17028,fd=21)) : users:(("java",pid=17028,fd=20))
    windows下面 通过java 命令 连接tomcat jdk
    (模拟zabbix监控tomcat)

    jconsole
    jvisualvm

    相关文章

      网友评论

          本文标题:Linux云计算学习笔记day54

          本文链接:https://www.haomeiwen.com/subject/ljzmhctx.html