环境

因为k8s中是最基本的jre,网上说缺少tools.jar,但是补充了以后还是不行,最后还是将整个jdk给移到容器中的。

jre中执行:

/home # /opt/jre/bin/java -jar /home/arthas-bin/arthas-boot.jar 1
[INFO] arthas-boot version: 3.3.7
[INFO] arthas home: /home/arthas-bin
[INFO] Try to attach process 1
Exception in thread "main" java.lang.IllegalArgumentException: Can not find tools.jar under java home: /opt/jre1.8.0_231, please try to start arthas-boot with full path java. Such as /opt/jdk/bin/java -jar arthas-boot.jar
at com.taobao.arthas.boot.ProcessUtils.findJavaHome(ProcessUtils.java:222)
at com.taobao.arthas.boot.ProcessUtils.startArthasCore(ProcessUtils.java:233)
at com.taobao.arthas.boot.Bootstrap.main(Bootstrap.java:515)

tools.jar迁移到/opt/jre/lib/

/opt/jre1.8.0_231/lib # /opt/jre/bin/java -jar /home/arthas-bin/arthas-boot.jar 1
[INFO] arthas-boot version: 3.3.7
[INFO] arthas home: /home/arthas-bin
[INFO] Try to attach process 1
java.lang.UnsatisfiedLinkError: no attach in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at sun.tools.attach.LinuxVirtualMachine.<clinit>(LinuxVirtualMachine.java:342)
at sun.tools.attach.LinuxAttachProvider.attachVirtualMachine(LinuxAttachProvider.java:78)
at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:250)
at com.taobao.arthas.core.Arthas.attachAgent(Arthas.java:86)
at com.taobao.arthas.core.Arthas.<init>(Arthas.java:28)
at com.taobao.arthas.core.Arthas.main(Arthas.java:124)
[ERROR] Start arthas failed, exception stack trace:
[ERROR] attach fail, targetPid: 1

最后还是将整个jdk迁移到容器中。

//k8s中进行迁移
kubectl cp arthas-bin/ test-huishi-server-7b5dd79689-tfsvz:/home -n irm-server

进入容器:

kubectl exec -ti test-huishi-server-test1-58fb7775fd-2n7bp -n irm-server -- /bin/sh

启动

/ # /home/jdk1.8.0_91/bin/java -jar /home/arthas-bin/arthas-boot.jar
[INFO] arthas-boot version: 3.3.7
[INFO] Can not find java process. Try to pass <pid> in command line.
Please select an available pid.

起动不了,查看帮助

/ # /home/jdk1.8.0_91/bin/java -jar /home/arthas-bin/arthas-boot.jar -help
[INFO] arthas-boot version: 3.3.7
Usage: arthas-boot [-h] [--target-ip <value>] [--telnet-port <value>]
[--http-port <value>] [--session-timeout <value>] [--arthas-home <value>]
[--use-version <value>] [--repo-mirror <value>] [--versions] [--use-http]
[--attach-only] [-c <value>] [-f <value>] [--height <value>] [--width
<value>] [-v] [--tunnel-server <value>] [--agent-id <value>] [--stat-url
<value>] [--select <value>] [pid] Bootstrap Arthas EXAMPLES:
java -jar arthas-boot.jar <pid>
java -jar arthas-boot.jar --target-ip 0.0.0.0
java -jar arthas-boot.jar --telnet-port 9999 --http-port -1
java -jar arthas-boot.jar --tunnel-server 'ws://192.168.10.11:7777/ws'
java -jar arthas-boot.jar --tunnel-server 'ws://192.168.10.11:7777/ws'
--agent-id bvDOe8XbTM2pQWjF4cfw
java -jar arthas-boot.jar --stat-url 'http://192.168.10.11:8080/api/stat'
java -jar arthas-boot.jar -c 'sysprop; thread' <pid>
java -jar arthas-boot.jar -f batch.as <pid>
java -jar arthas-boot.jar --use-version 3.3.7
java -jar arthas-boot.jar --versions
java -jar arthas-boot.jar --select arthas-demo
java -jar arthas-boot.jar --session-timeout 3600
java -jar arthas-boot.jar --attach-only
java -jar arthas-boot.jar --repo-mirror aliyun --use-http
WIKI:
https://alibaba.github.io/arthas

使用pid进行启动

/ # ps -ef |grep huishi
1 root 8:25 java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:MaxRAMFraction=1 -Xms256M -Duser.timezone=GMT+08 -Dfile.encoding=UTF-8 -javaagent:/data/jacocoagent.jar=includes=*,output=file,append=true,destfile=/data/log/huishi-server/jacoco.exec -jar /home/huishi-server.jar / # /home/jdk1.8.0_91/bin/java -jar /home/arthas-bin/arthas-boot.jar 1
[INFO] arthas-boot version: 3.3.7
[INFO] arthas home: /home/arthas-bin
[INFO] Try to attach process 1
[INFO] Attach process 1 success.
[INFO] arthas-client connect 127.0.0.1 3658
,---. ,------. ,--------.,--. ,--. ,---. ,---.
/ O \ | .--. ''--. .--'| '--' | / O \ ' .-'
| .-. || '--'.' | | | .--. || .-. |`. `-.
| | | || |\ \ | | | | | || | | |.-' |
`--' `--'`--' '--' `--' `--' `--'`--' `--'`-----' wiki https://alibaba.github.io/arthas
tutorials https://alibaba.github.io/arthas/arthas-tutorials
version 3.3.7
pid 1
time 2020-08-06 15:48:34

调试

仪表盘

[arthas@1]$ dashboard
ID NAME GROUP PRIORITY STATE %CPU TIME INTERRUPTED DAEMON 207 Timer-for-arthas-dashboard-d85134f6-3f4c-4e5b-ae6f-6 system 5 RUNNABLE 67 0:0 false true
76 DubboResponseTimeoutScanTimer main 5 TIMED_WAITING 21 0:14 false true
40 Hashed wheel timer #1 main 5 TIMED_WAITING 11 0:5 false false
24 Abandoned connection cleanup thread main 5 TIMED_WAITING 0 0:0 false true
161 Attach Listener system 9 RUNNABLE 0 0:0 false true
22 ContainerBackgroundProcessor[StandardEngine[Tomcat]] main 5 TIMED_WAITING 0 0:0 false true
50 Curator-ConnectionStateManager-0 main 5 WAITING 0 0:0 false true
53 Curator-Framework-0 main 5 WAITING 0 0:0 false true
75 DestroyJavaVM main 5 RUNNABLE 0 3:16 false false
25 Druid-ConnectionPool-Create-1936208710 main 5 WAITING 0 0:0 false true
26 Druid-ConnectionPool-Destroy-1936208710 main 5 TIMED_WAITING 0 0:0 false true
43 DubboClientReconnectTimer-thread-1 main 5 TIMED_WAITING 0 0:0 false true
46 DubboClientReconnectTimer-thread-2 main 5 WAITING 0 0:0 false true
33 DubboRegistryFailedRetryTimer-thread-1 main 5 TIMED_WAITING 0 0:0 false true
37 DubboSaveRegistryCache-thread-1 main 5 WAITING 0 0:0 false true
3 Finalizer system 8 WAITING 0 0:0 false true
89 Java2D Disposer system 10 WAITING 0 0:0 false true
41 New I/O boss #3 main 5 RUNNABLE 0 0:1 false true
38 New I/O worker #1 main 5 RUNNABLE 0 0:1 false true
39 New I/O worker #2 main 5 RUNNABLE 0 0:1 false true
59 NioBlockingSelector.BlockPoller-1 main 5 RUNNABLE 0 0:0 false true
Memory used total max usage GC heap 389M 510M 1979M 19.68% gc.copy.count 838 eden_space 104M 140M 546M 19.10% gc.copy.time(ms) 14061
survivor_space 3M 17M 68M 4.48% gc.marksweepcompact.count 6 tenured_gen 282M 351M 1365M 20.67% gc.marksweepcompact.time(ms) 2640
nonheap 267M 278M -1 96.01%
code_cache 84M 84M 240M 35.03%
metaspace 166M 175M -1 94.89%
compressed_class_space 16M 18M 1024M 1.64%
direct 211K 211K - 100.00%
mapped 0K 0K - NaN%
Runtime os.name Linux
os.version 3.10.0-693.el7.x86_64
java.version 1.8.0_231
java.home /opt/jre1.8.0_231
systemload.average 0.40
processors 1
uptime 8607s

查看JVM信息

参考:

Arthas排查Kubernetes中的应用频繁挂掉重启问题

最新文章

  1. 关于linq to sql类线程同步问题
  2. Java优化
  3. Java for LeetCode 233 Number of Digit One
  4. 转:bash: /dev/null: Permission denied
  5. Yii表单验证
  6. linux源码阅读笔记 asm函数
  7. MapReduce计算模型
  8. delphi OnMouseLeave 事件不灵敏及解决之道(使用TrackMouseEvent函数进行加强)
  9. CodeForces 371C Hamburgers
  10. Python用pip安装IPython/Jupyter最佳交互环境
  11. CentOS7 配置FTP服务器
  12. [PHP] 算法-将一个字符串转换成一个整数的PHP实现
  13. 前端入门2-HTML标签
  14. 《Mysql 用户管理》
  15. 学习C++,应该循序渐进的看哪些书?
  16. 强大的矩阵奇异值分解(SVD)
  17. (转)No row with the given identifier exists问题的解决
  18. 分享一个oracle 完整备份的批处理文件
  19. ecloipse背景修改豆沙
  20. bzoj1215 24点游戏

热门文章

  1. Flask 基础组件(八):message
  2. ant-design-vue中实现modal模态框的复用(添加,编辑展示同一个模态框)
  3. Ethical Hacking - POST EXPLOITATION(2)
  4. Python Ethical Hacking - Intercepting and Modifying Packets
  5. solr8.4.1开发测试环境的简单应用
  6. 洛谷 P1080 国王游戏 题解
  7. ztree : checkbox 选中/不选中时动态添加/删除DOM元素
  8. 团队转型,Scrum与DevOps要如何取舍?
  9. k_means算法+python实现
  10. windows上Scrapy 框架的安装