安装
下载arthas-boot.jar,然后用java -jar的方式启动:
curl -O https://arthas.aliyun.com/arthas-boot.jar
java -jar arthas-boot.jar
或者去官网下载:https://arthas.aliyun.com/download/latest_version?mirror=aliyun
github: https://github.com/alibaba/arthas/releases
离线文档: https://arthas.aliyun.com/download/doc/latest_version?mirror=aliyun
然后解压,文件夹里面有 arthas-boot.jar
卸载
rm -rf ~/.arthas/
rm -rf ~/logs/arthas
启动
需要使用与待监控进程相同的用户来运行arthas
$ java -jar arthas-boot.jar
* [1]: 35542
[2]: 71560 math-game.jar
选择2然后回车。
Arthas会attach到目标进程上,并输出日志:
[INFO] Try to attach process 71560
[INFO] Attach process 71560 success.
[INFO] arthas-client connect 127.0.0.1 3658
,---. ,------. ,--------.,--. ,--. ,---. ,---.
/ O \ | .--. ''--. .--'| '--' | / O \ ' .-'
| .-. || '--'.' | | | .--. || .-. |`. `-.
| | | || |\ \ | | | | | || | | |.-' |
`--' `--'`--' '--' `--' `--' `--'`--' `--'`-----'
wiki: https://arthas.aliyun.com/doc
version: 3.0.5.20181127201536
pid: 71560
time: 2018-11-28 19:16:24
$
命令
help 显示所有命令
dashboard 展示当前进程的信息,ctrl + C 中断执行
jad java.lang.String 反编译class
redefine d:\\nxjy\\jvm\\nxarthasDemo.class 热部署class类