SpringBoot整合java诊断工具Arthas解读
作者:LoveDR_1995 时间:2023-08-07 10:39:03
一、Arthas官方文档
https://arthas.aliyun.com/doc/
二、springBoot整合方式
1、pom文件引入
<dependency>
<groupId>com.taobao.arthas</groupId>
<artifactId>arthas-spring-boot-starter</artifactId>
<version>3.6.7</version>
</dependency>
2、yaml文件引入
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: arthas_test
# 默认情况下,会生成随机ID,如果 arthas agent配置了 appName,则生成的agentId会带上appName的前缀。
agent-id: hsehdfsfghhwertyfad
# tunnel-server地址
tunnel-server: ws://127.0.0.1:7777/ws
这里建议agent_id提前配置好。后续的控制台连接arthas需要使用。
3、下载arthas-tunnel-server
通过Arthas Tunnel Server/Client 来远程管理/连接多个Agent
1. 下载arthas-tunnel-server-3.6.7-fatjar.jar
https://github.com/alibaba/arthas/releases
2. 运行
windows
java -jar arthas-tunnel-server-3.6.7-fatjar.jar
linux
nohup java -jar arthas-tunnel-server-3.6.7-fatjar.jar > /dev/null 2>&1 &
3.登录查看注册上来的应用
http://127.0.0.1:8080/actuator/arthas 登陆用户名是arthas
密码在arthas tunnel server的日志里可以找到,比如:
Using generated security password: 6e00d3bd-e2b3-4147-b959-63854347cdc1
4、启动Arthas Tunnel Server及spring项目
5、登录Arthas Tunnel Server
输入地址:http://127.0.0.1:8080/并输入agent_id,界面如下图。
6、输入命令进行测试
dashboard,当前系统的实时数据面板
其他命令列表查看https://arthas.aliyun.com/doc/commands.html
来源:https://blog.csdn.net/xrq1995/article/details/128579477
标签:SpringBoot,java,诊断工具,Arthas
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Android编程之文件读写操作与技巧总结【经典收藏】
2023-10-16 02:20:52
C# Csv实现基本的读写和转换DataTable
2023-11-20 10:55:22
![](https://img.aspxhome.com/file/2023/3/96333_0s.png)
Android Studio 中获取屏幕宽度实例
2022-03-25 11:55:36
![](https://img.aspxhome.com/file/2023/0/137360_0s.jpg)
c# 实现文件上传下载功能的实例代码
2021-12-10 15:00:30
SpringMVC的注解@RequestMapping属性及使用
2022-12-31 02:03:00
![](https://img.aspxhome.com/file/2023/6/129116_0s.png)
java多线程关键字final和static详解
2022-12-19 19:02:01
Mybatis 动态SQL的几种实现方法
2023-11-10 12:15:15
Android实现为Notification加上一个进度条的方法
2022-12-14 00:39:01
Java利用读写的方式实现音频播放代码实例
2022-08-21 15:38:52
IntelliJ IDEA使用git初始化仓库的使用方法
2022-05-24 12:37:26
![](https://img.aspxhome.com/file/2023/4/68534_0s.png)
Android读取assets目录下的所有图片并显示的方法
2023-03-09 22:06:30
Java使用application.property读取文件里面的值
2023-11-01 07:24:56
Kotlin Flow常用封装类StateFlow使用详解
2022-07-16 03:46:28
java迷宫算法的理解(递归分割,递归回溯,深搜,广搜)
2022-10-22 10:36:31
![](https://img.aspxhome.com/file/2023/1/72901_0s.png)
Android实现简单画中画功能
2022-07-18 04:51:25
![](https://img.aspxhome.com/file/2023/6/139156_0s.gif)
Java学习-打印1-1000以内的水仙花数代码实例
2023-05-02 03:58:45
SpringBoot2.7 WebSecurityConfigurerAdapter类过期配置
2022-09-23 00:27:32
![](https://img.aspxhome.com/file/2023/8/92708_0s.jpg)
elasticsearch数据信息索引操作action support示例分析
2022-03-18 02:09:07
Springboot WebJar打包及使用实现流程解析
2023-06-21 22:08:00
![](https://img.aspxhome.com/file/2023/3/66633_0s.png)
Android多媒体之VideoView视频播放器
2023-11-12 14:38:35
![](https://img.aspxhome.com/file/2023/8/139618_0s.jpg)