Jconsole 测试.
Jconsole 测试.
1 下载并安装
d:\Program Files\Java\jdk1.8.0_111\
JDK自带,Windows下图形界面,监控分析Java程序
2 查看jmx进程号
[root@hongquan ~]# ps -eaf|grep jmx
root 34501 34499 0 Dec23 ? 01:07:21 /usr/local/mycat/jdk1.8.0_101/bin/java -DMYCAT_HOME=. -server -XX:MaxPermSize=64M
-XX:+AggressiveOpts -XX:MaxDirectMemorySize=2G -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1984
-Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Xmx4G -Xms1G -Djava.library.path=lib
-classpath lib/wrapper.jar:conf:lib/asm-4.0.jar:lib/curator-framework-2.11.0.jar:lib/minlog-1.2.jar:lib/curator-recipes-2.11.0.
jar:lib/commons-collections-3.2.1.jar:lib/reflectasm-1.03.jar:lib/netty-3.7.0.Final.jar:lib/slf4j-api-1.6.1.jar:lib/objenesis-1
.2.jar:lib/log4j-1.2.17.jar:lib/zookeeper-3.4.6.jar:lib/druid-1.0.26.jar:lib/disruptor-3.3.4.jar:lib/libwrapper-linux-x86-32.so
:lib/univocity-parsers-2.2.1.jar:lib/velocity-1.7.jar:lib/fastjson-1.2.12.jar:lib/curator-client-2.11.0.jar:lib/log4j-slf4j-imp
l-2.5.jar:lib/Mycat-server-1.6-RELEASE.jar:lib/libwrapper-linux-x86-64.so:lib/jsr305-2.0.3.jar:lib/log4j-1.2-api-2.5.jar:lib/l
ibwrapper-linux-ppc-64.so:lib/mongo-java-driver-2.11.4.jar:lib/log4j-core-2.5.jar:lib/leveldb-api-0.7.jar:lib/jline-0.9.94.jar
:lib/sequoiadb-driver-1.12.jar:lib/commons-lang-2.6.jar:lib/wrapper.jar:lib/mysql-binlog-connector-java-0.4.1.jar:lib/ojdbc14.
jar:lib/ehcache-core-2.6.11.jar:lib/hamcrest-library-1.3.jar:lib/kryo-2.10.jar:lib/snakeyaml-1.17.jar:lib/leveldb-0.7.jar:lib/
hamcrest-core-1.3.jar:lib/joda-time-2.9.3.jar:lib/guava-19.0.jar:lib/mapdb-1.0.7.jar:lib/log4j-api-2.5.jar:lib/dom4j-1.6.1.jar
-Dwrapper.key=nRsVFYf3qXu8NVBI -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.pid=34499
-Dwrapper.version=3.2.3 -Dwrapper.native_library=wrapper -Dwrapper.service=TRUE -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=1
org.tanukisoftware.wrapper.WrapperSimpleApp io.mycat.MycatStartup start
root 41638 37788 0 01:18 pts/8 00:00:00 grep jmx
查看进程号34501的tcp端口号
[root@hongquan ~]# netstat -ntpl|grep 34501
tcp 0 0 127.0.0.1:32000 0.0.0.0:* LISTEN 34501/java
tcp 0 0 :::45438 :::* LISTEN 34501/java
tcp 0 0 :::1984 :::* LISTEN 34501/java
tcp 0 0 :::8066 :::* LISTEN 34501/java
tcp 0 0 :::54856 :::* LISTEN 34501/java
tcp 0 0 :::9066 :::* LISTEN 34501/java
3 添加新帐号jconsole用来连接
[root@hongquan ~]# useradd jconsole
[root@hongquan ~]# gpasswd -ajconsole root
Adding user jconsole to group root
[root@hongquan ~]# passwd jconsole
Changing password for user jconsole.
New password:
BAD PASSWORD: it is based on a dictionary word
Retype new password:
passwd: all authentication tokens updated successfully.
4 连接root@10.0.1.134:1984
D:\program files\Java\jdk1.8.0_111\bin
双击jconsole.exe打开
[root@hongquan conf]# more wrapper.conf |grep 1984
wrapper.java.additional.7=-Dcom.sun.management.jmxremote.port=1984
[root@hongquan conf]# vim wrapper.conf
[root@hongquan conf]# more wrapper.conf |grep 1984
wrapper.java.additional.7=-Dcom.sun.management.jmxremote.port=51984
修改51984
用Jconsole连接报错,将mycat的wrapper.conf配置更改如下:
重启mycat
[root@hongquan bin]# ./mycat restart
Stopping Mycat-server...
Stopped Mycat-server.
Starting Mycat-server...