arthas無網(wǎng)絡(luò)環(huán)境下離線安裝方法

本文主要介紹當(dāng)服務(wù)器無法連接互聯(lián)網(wǎng)情況下,無法安裝arthas的解決方法

一、下載

參考文末參考文章3中下載。也可以直接把下面文中的鏈接取出,直接用下載器下載。

# github下載
wget https://alibaba.github.io/arthas/arthas-boot.jar
# 或者 Gitee 下載
wget https://arthas.gitee.io/arthas-boot.jar
# 打印幫助信息
java -jar arthas-boot.jar -h

二、安裝

# 運(yùn)行方式1,先運(yùn)行,在選擇 Java 進(jìn)程 PID
java -jar arthas-boot.jar

當(dāng)聯(lián)網(wǎng)安裝時(shí),可以正常安裝??聪旅娴膱?zhí)行日志,可以看到,聯(lián)網(wǎng)時(shí)會(huì)到maven.aliyun.com的私服庫里去獲取jar包。但是離線時(shí),是無法直接獲取的,執(zhí)行時(shí),會(huì)出現(xiàn)無法連接aliyun.com等error。

Downloads herman$ java -jar arthas-boot.jar
[INFO] arthas-boot version: 3.1.7
[INFO] Found existing java process, please choose one and hit RETURN.
* [1]: 59874 com.dtm.starter.StartApplication
  [2]: 26057
  [3]: 68065 com.bayss.infin.core.AppStarter
1
[INFO] Start download arthas from remote server: http://maven.aliyun.com/repository/public/com/taobao/arthas/arthas-packaging/3.1.7/arthas-packaging-3.1.7-bin.zip
[INFO] File size: 10.33 MB, downloaded size: 1.08 MB, downloading ...
[INFO] File size: 10.33 MB, downloaded size: 2.15 MB, downloading ...
[INFO] File size: 10.33 MB, downloaded size: 3.23 MB, downloading ...
[INFO] File size: 10.33 MB, downloaded size: 4.38 MB, downloading ...
[INFO] File size: 10.33 MB, downloaded size: 5.40 MB, downloading ...
[INFO] File size: 10.33 MB, downloaded size: 6.54 MB, downloading ...
[INFO] File size: 10.33 MB, downloaded size: 7.52 MB, downloading ...
[INFO] File size: 10.33 MB, downloaded size: 8.66 MB, downloading ...
[INFO] File size: 10.33 MB, downloaded size: 9.71 MB, downloading ...
[INFO] Download arthas success.
[INFO] arthas home: /Users/herman/.arthas/lib/3.1.7/arthas
[INFO] Try to attach process 59874
[WARN] Current VM java version: 1.7 do not match target VM java version: 1.8, attach may fail.
[WARN] Target VM JAVA_HOME is /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre, arthas-boot JAVA_HOME is /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/jre, try to set the same JAVA_HOME.
[INFO] Attach process 59874 success.
[INFO] arthas-client connect 127.0.0.1 3658
  ,---.  ,------. ,--------.,--.  ,--.  ,---.   ,---.
 /  O  \ |  .--. ''--.  .--'|  '--'  | /  O  \ '   .-'
|  .-.  ||  '--'.'   |  |   |  .--.  ||  .-.  |`.  `-.
|  | |  ||  |\  \    |  |   |  |  |  ||  | |  |.-'    |
`--' `--'`--' '--'   `--'   `--'  `--'`--' `--'`-----'


wiki      https://alibaba.github.io/arthas
tutorials https://alibaba.github.io/arthas/arthas-tutorials
version   3.1.7
pid       59874
time      2020-01-02 10:48:28

三、離線安裝

其實(shí)方法很簡單,只是有時(shí)候不容易想的到。
步驟1:先在可聯(lián)網(wǎng)的電腦上,執(zhí)行java -jar arthas-boot.jar,從執(zhí)行記錄中可以看到,下載下來的依賴包放在了

[INFO] arthas home: /Users/herman/.arthas/lib/3.1.7/arthas

步驟2:進(jìn)入到/Users/herman/.arthas/lib/3.1.7/arthas路徑下,把所有的內(nèi)容打包即可,與arthas-boot.jar一起上傳到離線的服務(wù)器。

BUG:arthas herman$ ll
total 23048
-rw-r--r--  1 herman  staff      5993  1  2 10:48 arthas-spy.jar
-rw-r--r--  1 herman  staff      8347  1  2 10:48 arthas-agent.jar
-rw-r--r--  1 herman  staff    403091  1  2 10:48 arthas-client.jar
-rw-r--r--  1 herman  staff    111090  1  2 10:48 arthas-boot.jar
-rw-r--r--  1 herman  staff      3739  1  2 10:48 arthas-demo.jar
-rw-r--r--  1 herman  staff       635  1  2 10:48 install-local.sh
-rw-r--r--  1 herman  staff     28075  1  2 10:48 as.sh
-rw-r--r--  1 herman  staff      3127  1  2 10:48 as.bat
-rw-r--r--  1 herman  staff      7744  1  2 10:48 as-service.bat
drwxr-xr-x  4 herman  staff       128  1  2 10:48 async-profiler
-rw-r--r--  1 herman  staff  11207868  1  2 10:48 arthas-core.jar
BUG:arthas herman$ pwd
/Users/herman/.arthas/lib/3.1.7/arthas

打包命令:tar -cvf 或者 zip,用文件瀏覽器都行

步驟3:把打包的文件放在服務(wù)器上的用戶根目錄下,比如herman用戶,放在/home/herman/.arthas下就可以。當(dāng)然也可以指定執(zhí)行路徑。

相關(guān)參考文章:

1. 《arthas安裝使用說明》 https://blog.csdn.net/zou100/article/details/84998559

2. 《arthas的安裝和使用小結(jié)》https://blog.csdn.net/wangwei249/article/details/86595540

3. 《Arthas - Java 線上問題定位處理的終極利器》https://mp.weixin.qq.com/s/55gBspFp8yH0TCymdbZfkQ

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 《小學(xué)問》這本書一共分為八章,分別討論了八種困擾,比如焦慮、智慧、謀生、自律、效率等等的問題。下面我想分享一些我的...
    芳芳金芳芳閱讀 436評(píng)論 0 0
  • 一、OC 對象的種類 1.OC 對象的種類 OC 對象有三個(gè)大的種類: instance 對象(實(shí)例對象) cla...
    666真666閱讀 1,830評(píng)論 0 5
  • 一直只知道騰訊是成功的大公司可是看了?騰訊傳?才明白成功的人是相似的。馬化騰,丁磊,馬云,張朝陽等人開始創(chuàng)立自己公...
    lucky哈哦閱讀 787評(píng)論 0 0

友情鏈接更多精彩內(nèi)容