SpringBoot整合java診斷工具Arthas解讀
更新時間:2023年03月11日 10:27:17 作者:LoveDR_1995
這篇文章主要介紹了SpringBoot整合java診斷工具Arthas,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
一、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則可網(wǎng)絡訪問,但是存在安全問題 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提前配置好。后續(xù)的控制臺連接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,當前系統(tǒng)的實時數(shù)據(jù)面板
其他命令列表查看https://arthas.aliyun.com/doc/commands.html
總結
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關文章
Java8?CompletableFuture?異步多線程的實現(xiàn)
本文主要介紹了Java8?CompletableFuture?異步多線程的實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2023-04-04使用httpclient實現(xiàn)免費的google翻譯api
這篇文章主要介紹了使用httpclient實現(xiàn)免費的google翻譯api的方法,大家參考使用吧2014-01-01