Manually Install Arthas¶
Manually Install Arthas¶
Download the latest version
Latest version, Click To Download:
If the download speed is slow, try to use Ali cloud mirror repository, for example, to download version
3.x.x(you can replace3.x.xin the example URL if you want to download other version), the download URL is: https://maven.aliyun.com/repository/public/com/taobao/arthas/arthas-packaging/3.x.x/arthas-packaging-3.x.x-bin.zipUnzip zip file
unzip arthas-packaging-bin.zip
Install Arthas
It is recommended to completely remove all old versions of Arthas before installation.
sudo su admin rm -rf /home/admin/.arthas/lib/* # remove all the leftover of the old outdated Arthas cd arthas ./install-local.sh # switch the user based on the owner of the target Java process.
Start Arthas
Make sure
shutdownthe old Arthas server before start../as.sh
Startup with as.sh/as.bat¶
Linux/Unix/Mac¶
You can install Arthas with one single line command on Linux, Unix, and Mac. Pls. copy the following command and paste it into the command line, then press Enter to run:
curl -L https://alibaba.github.io/arthas/install.sh | shThe command above will download the bootstrap script as.sh to the current directory. You can move it the any other place you want, or put its location in $PATH.
You can enter its interactive interface by executing as.sh, or execute as.sh -h for more help information.
Windows¶
Latest Version, Click To Download:
Download and unzip, then find as.bat from ‘bin’ directory. For now this script will only take one argument pid, which means you can only diagnose the local Java process. (Welcome any bat script expert to make it better :heart:)
as.bat <pid>If you want to diagnose Java process run as windows service, try these commands:
as-service.bat -port <port>
as-service.bat -pid <pid>
as-service.bat -pid <pid> --interactUse this command to remove arthas service:
as-service.bat -removeManual command line startup¶
If you fail to boot Arthas with the provided batch file, you could try to assemble the bootstrap command in the following way.
Locate java in the target JVM:
Linux/Unix/Mac:
ps aux | grep javaWindows: open the Process Monitor to search java
Assemble bootstrap command:
Let’s suppose we are using
/opt/jdk1.8/bin/java, then the command should be:/opt/jdk1.8/bin/java -Xbootclasspath/a:/opt/jdk1.8/lib/tools.jar \ -jar /tmp/arthas-packaging/arthas-core.jar \ -pid 15146 \ -target-ip 127.0.0.1 -telnet-port 3658 -http-port 8563 \ -core /tmp/arthas-packaging/arthas-core.jar \ -agent /tmp/arthas-packaging/arthas/arthas-agent.jarNote:
-Xbootclasspathadds tools.jar-jar /tmp/arthas-packaging/arthas-core.jarspecifies main entry-pid 15146specifies the target java process PID-target-ip 127.0.0.1specifies the IP-telnet-port 3658 -http-port 8563specifies telnet and HTTP ports for remote access-core /tmp/arthas-packaging/arthas-core.jar -agent /tmp/arthas-packaging/arthas/arthas-agent.jarspecifies core/agent jar package
If you are running on JDK 1.9 or above,then it’s unnecessary to add
tools.jarin option-Xbootclasspath.You can find the logs from
~/logs/arthas/arthas.log.Use telnet to connect once attaching to the target JVM (in step 2) succeeds
telnet 127.0.0.1 3658