Arthas基本使用
官方文档
- 下载Arthas
1
| curl -O https://arthas.aliyun.com/arthas-boot.jar
|
1
| wget http://tosv.byted.org/obj/tos-team/toscli/toscli -O toscli && chmod a+x toscli && ./toscli -accessKey 2SCHBOIB1OW4AIW0MYJG -bucket dmpfile get -filename arthas-bin.zip arthas-bin.zip && unzip arthas-bin.zip
|
2.`ps aux | grep java`找到java进程
1 2 3 4 5
| ps aux | grep java
e.g.下面的进程id就是322 root 322 15.8 0.8 58852208 4711440 ? Sl 18:27 9:29 java -server -Xms10g -Xmx10g -Xmn4g -XX:MetaspaceSize=512m -XX:MaxMetaspaceSize=512m -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSMaxAbortablePrecleanTime=5000 -XX:+CMSClassUnloadingEnabled -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=80 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/log/tiger/java.hprof -XX:TargetSurvivorRatio=90 -Xloggc:/opt/log/tiger/gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Djava.awt.headless=true -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=30000 -XX:MaxDirectMemorySize=1g -XX:SurvivorRatio=10 -XX:+ExplicitGCInvokesConcurrent -Dsun.rmi.dgc.server.gcInterval=2592000000 -Dsun.rmi.dgc.client.gcInterval=2592000000 -XX:ParallelGCThreads=8 -jar kunlun-service-rpc-0.0.1-SNAPSHOT.jar --spring.profiles.active=prod --server.port=9403 root 9177 0.0 0.0 14524 892 pts/0 S+ 19:27 0:00 grep java
|
3.Bind arthas到java进程
1
| java -jar arthas-boot.jar 322
|
4.使用watch函数
1
| watch com.dmp.kafka.client.MessageModel.Message getTagGroupMapMap "{params,returnObj,throwExp}" -x 2
|