(1条消息) Arthas
我们在K8S环境中部署了一个服务,想在线编译一段代码进行测试,把arthas导入进去之后,启动arthas竟然找不到Pod中的Java进程,郁闷。。。
$ java -jar arthas-boot.jar[INFO] arthas-boot version: 3.4.4[INFO] Can not find java process. Try to pass <pid> in command line.Please select an available pid.
按官方的说明文档描述,假如出现了找不到pid的情况,在当前目录下应该会输出相关的log,但是在pod中当前目录下并没有日志文件产生啊???问题跟下面参考链接中的问题基本类似;
按照有的博主的说法,如果使用openjdk,也会报这个问题,因为其没有jps,arthas是用jps去找java进程的,使用oracle jdk即可;巧的是,我们pod的容器中使用的就是openjdk。。。
参考Arthas排查Kubernetes中的应用频繁挂掉重启问题 #561 一般来说容器中会在PID=1上启动java或者其他的服务进程,所以在后面加上 1,再试试;
$ java -jar arthas-boot.jar 1[INFO] arthas-boot version: 3.4.4[INFO] Start download arthas from remote server: https://arthas.aliyun.com/download/3.4.4?mirror=center[INFO] File size: 11.94 MB, downloaded size: 1.47 MB, downloading ...[INFO] File size: 11.94 MB, downloaded size: 9.22 MB, downloading ...[INFO] Download arthas success.[INFO] arthas home: /tmp/.arthas/lib/3.4.4/arthas[INFO] Try to attach process 1[INFO] Attach process 1 success.[INFO] arthas-client connect 127.0.0.1 3658,---. ,------. ,--------.,--. ,--. ,---. ,---./ O \ | .--. ''--. .--'| '--' | / O \ ' .-'| .-. || '--'.' | | | .--. || .-. |`. `-.| | | || |\ \ | | | | | || | | |.-' |`--' `--'`--' '--' `--' `--' `--'`--' `--'`-----'wiki https://arthas.aliyun.com/doctutorials https://arthas.aliyun.com/doc/arthas-tutorials.htmlversion 3.4.4pid 1time 2020-12-02 07:32:25[arthas@1]$
因为arthas没有主动找到Pod中的java进程,在手动指定之后,就可以了。。。
赞 (0)
