Arthas中文文档
https://arthas.aliyun.com/doc/
1.pom.xml
<dependency>
<groupId>com.taobao.arthas</groupId>
<artifactId>arthas-spring-boot-starter</artifactId>
<version>${arthas.version}</version>
</dependency>
2.yml配置文件
# arthas中文文档 https://arthas.aliyun.com/doc/
# arthas配置
# 查看配置项 http://localhost:port/actuator/arthas
# 默认配置:
#arthas.config.overrideAll=true
# arthas.telnetPort=3658
# arthas.httpPort=8563
# arthas.ip=127.0.0.1
#
# # seconds
# arthas.sessionTimeout=1800
arthas:
# telnetPort、httpPort为 -1 ,则不listen telnet端口,为 0 ,则随机telnet端口
# 如果是防止一个机器上启动多个 arthas端口冲突。可以配置为随机端口,或者配置为 -1,并且通过tunnel server来使用arthas。
# ~/logs/arthas/arthas.log (用户目录下面)里可以找到具体端口日志
telnetPort: -1
httpPort: -1
# 127.0.0.1只能本地访问,0.0.0.0则可网络访问,但是存在安全问题
ip: 127.0.0.1
appName: ${spring.application.name}
# 默认情况下,会生成随机ID,如果 arthas agent配置了 appName,则生成的agentId会带上appName的前缀。
# agent-id: hsehdfsfghhwertyfad
# tunnel-server地址
tunnel-server: ws://localhost:7777/ws
3.通过Arthas Tunnel Server/Client 来远程管理/连接多个Agent。
1. 下载arthas-tunnel-server-3.4.5-fatjar.jar
https://github.com/alibaba/arthas/releases
2. 运行
windows
java -jar arthas-tunnel-server-3.4.5-fatjar.jar
linux
nohup java -jar arthas-tunnel-server-3.4.5-fatjar.jar > /dev/null 2>&1 &
3.登录查看注册上来的应用
http://127.0.0.1:8080/actuator/arthas 登陆用户名是arthas
密码在arthas tunnel server的日志里可以找到,比如:
启动Arthas Tunnel Server:
登录Arthas Tunnel Server
查看AgentId
打开arthas tunnel server输入AgentId操作arthas
arthas web console控制台复制粘贴操作(chrome):
复制 ctrl + insert
粘贴 shift + insert
IDEA的Arthas插件,相当nice:
https://github.com/WangJi92/arthas-idea-plugin