update doc

pull/483/head
hengyunabc 6 years ago
parent 5030277ccc
commit a2b65725d9

@ -1,14 +1,14 @@
Arthas Install
=============
## 快速安装
## 全平台通用(推荐)
### 使用`arthas-boot`
最新版本,点击下载:[![Arthas](https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square "Arthas")](http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.taobao.arthas&a=arthas-packaging&e=zip&c=bin&v=LATEST)
解压后,在文件夹里有`arthas-boot.jar`,直接用`java -jar`的方式启动:
下载`arthas-boot.jar`,然后用`java -jar`的方式启动:
```bash
wget https://alibaba.github.io/arthas/arthas-boot.jar
java -jar arthas-boot.jar
```
@ -18,8 +18,9 @@ java -jar arthas-boot.jar
java -jar arthas-boot.jar -h
```
* 如果下载速度比较慢可以使用aliyun的镜像`java -jar arthas-boot.jar --repo-mirror aliyun --use-http`
## Linux/Unix/Mac
### 使用`as.sh`
Arthas 支持在 Linux/Unix/Mac 等平台上一键安装,请复制以下内容,并粘贴到命令行中,敲 `回车` 执行即可:
@ -33,58 +34,26 @@ curl -L https://alibaba.github.io/arthas/install.sh | sh
也可以执行`./as.sh -h`来获取更多参数信息。
## Windows
## 全量安装
最新版本,点击下载:[![Arthas](https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square "Arthas")](http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.taobao.arthas&a=arthas-packaging&e=zip&c=bin&v=LATEST)
解压后,在文件夹里有`arthas-boot.jar`,直接用`java -jar`的方式启动:
下载解压后在bin目录有 `as.bat`。此脚本暂时只接受一个参数 pid即只能诊断本机上的 Java 进程。欢迎精通bat脚本的开发者改进
```
as.bat <pid>
```bash
java -jar arthas-boot.jar
```
## 手动安装
[手动安装](manual-install.md)
## 手动拼接命令行启动
如果启动遇到问题,可以尝试手动拼接出命令行参数来启动。
1. 查找目录jvm的java文件路径。
在linux/mac上执行`ps aux | grep java`在windows上可以通过进程管理器来查看。假设是`/opt/jdk1.8/bin/java`。
2. 拼接出命令行
```bash
/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.jar
```
命令行分几部分组成:
* `-Xbootclasspath` 增加tools.jar
* `-jar /tmp/arthas-packaging/arthas-core.jar` 指定main函数入口
* `-pid 15146` 指定目标java进程ID
* `-target-ip 127.0.0.1` 指定IP
* `-telnet-port 3658 -http-port 8563` 指定telnet和http端口
* `-core /tmp/arthas-packaging/arthas-core.jar -agent /tmp/arthas-packaging/arthas/arthas-agent.jar` 指定core/agent jar包
打印帮助信息:
如果是`jdk > 9`即9/10/11以上的版本不需要指定`tools.jar`,直接去掉`-Xbootclasspath` 的配置即可。
```bash
java -jar arthas-boot.jar -h
```
启动目志输出在`~/logs/arthas/arthas.log`里。
3. attach成功之后使用telnet连接
```bash
telnet 127.0.0.1 3658
```
## 手动安装
[手动安装](manual-install.md)
## 离线帮助文档
@ -100,4 +69,4 @@ as.bat <pid>
rm -rf ~/.arthas/
```
* Windows平台直接删除zip包和解压的文件
* Windows平台直接删除user home下面的`.arthas`目录

@ -1,6 +1,9 @@
手动安装Arthas
===
## 手动安装Arthas
1. 下载最新版本
**最新版本,点击下载**[![Arthas](https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square "Arthas")](http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.taobao.arthas&a=arthas-packaging&e=zip&c=bin&v=LATEST)
@ -34,4 +37,70 @@
```
./as.sh
```
```
## 以脚本的方式启动as.sh/as.bat
### Linux/Unix/Mac
Arthas 支持在 Linux/Unix/Mac 等平台上一键安装,请复制以下内容,并粘贴到命令行中,敲 `回车` 执行即可:
```bash
curl -L https://alibaba.github.io/arthas/install.sh | sh
```
上述命令会下载启动脚本文件 `as.sh` 到当前目录,你可以放在任何地方或将其加入到 `$PATH` 中。
直接在shell下面执行`./as.sh`,就会进入交互界面。
也可以执行`./as.sh -h`来获取更多参数信息。
### Windows
最新版本,点击下载:[![Arthas](https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square "Arthas")](http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.taobao.arthas&a=arthas-packaging&e=zip&c=bin&v=LATEST)
下载解压后在bin目录有 `as.bat`。此脚本暂时只接受一个参数 pid即只能诊断本机上的 Java 进程。欢迎精通bat脚本的开发者改进
```
as.bat <pid>
```
## 手动拼接命令行启动
如果启动遇到问题,可以尝试手动拼接出命令行参数来启动。
1. 查找目录jvm的java文件路径。
在linux/mac上执行`ps aux | grep java`在windows上可以通过进程管理器来查看。假设是`/opt/jdk1.8/bin/java`。
2. 拼接出命令行
```bash
/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.jar
```
命令行分几部分组成:
* `-Xbootclasspath` 增加tools.jar
* `-jar /tmp/arthas-packaging/arthas-core.jar` 指定main函数入口
* `-pid 15146` 指定目标java进程ID
* `-target-ip 127.0.0.1` 指定IP
* `-telnet-port 3658 -http-port 8563` 指定telnet和http端口
* `-core /tmp/arthas-packaging/arthas-core.jar -agent /tmp/arthas-packaging/arthas/arthas-agent.jar` 指定core/agent jar包
如果是`jdk > 9`即9/10/11以上的版本不需要指定`tools.jar`,直接去掉`-Xbootclasspath` 的配置即可。
启动目志输出在`~/logs/arthas/arthas.log`里。
3. attach成功之后使用telnet连接
```bash
telnet 127.0.0.1 3658
```

@ -4,15 +4,13 @@
## 1. 启动Demo
```bash
wget https://alibaba.github.io/arthas/arthas-demo.jar
java -jar arthas-demo.jar
```
`arthas-demo`是一个简单的程序,每隔一秒生成一个随机数,再执行质因式分解,并打印出分解结果。
如果本地没有`arthas-demo.jar`, 可以从这里下载: [点击](http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.taobao.arthas&a=arthas-boot&v=LATEST)
也可以自己从代码里编绎运行:[查看](https://github.com/alibaba/arthas/blob/master/demo/src/main/java/demo)
`arthas-demo`源代码:[查看](https://github.com/alibaba/arthas/blob/master/demo/src/main/java/demo/MathGame.java)
## 2. 启动arthas
@ -20,12 +18,14 @@ java -jar arthas-demo.jar
在命令行下面执行:
```bash
wget https://alibaba.github.io/arthas/arthas-boot.jar
java -jar arthas-boot.jar
```
> 执行该程序的用户需要和目标进程具有相同的权限。比如以`admin`用户来执行:
> `sudo su admin && java -jar arthas-boot.jar` 或 `sudo -u admin -EH java -jar arthas-boot.jar`。
> 如果attatch不上目标进程可以查看`~/logs/arthas/` 目录下的日志。
* 执行该程序的用户需要和目标进程具有相同的权限。比如以`admin`用户来执行:`sudo su admin && java -jar arthas-boot.jar` 或 `sudo -u admin -EH java -jar arthas-boot.jar`。
* 如果attatch不上目标进程可以查看`~/logs/arthas/` 目录下的日志。
* 如果下载速度比较慢可以使用aliyun的镜像`java -jar arthas-boot.jar --repo-mirror aliyun --use-http`
* `java -jar arthas-boot.jar -h` 打印更多参数信息。
选择应用java进程

@ -1,24 +1,26 @@
Install Arthas
==============
## All Platform (recommended)
## Quick installation
Latest Version, Click To Download: [![Arthas](https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square "Arthas")](http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.taobao.arthas&a=arthas-packaging&e=zip&c=bin&v=LATEST)
Download and unzip, find `arthas-boot.jar` in the directory. Start with `java` command:
### Use `arthas-boot`
Download`arthas-boot.jar`Start with `java` command:
```bash
wget https://alibaba.github.io/arthas/arthas-boot.jar
java -jar arthas-boot.jar
```
Print help information:
Print usage:
```bash
java -jar arthas-boot.jar -h
```
## Linux/Unix/Mac
### Use `as.sh`
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:
@ -30,59 +32,27 @@ The command above will download the bootstrap script `as.sh` to the current dire
You can enter its interactive interface by executing `as.sh`, or execute `as.sh -h` for more help information.
## Windows
## Full installation
Latest Version, Click To Download: [![Arthas](https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square "Arthas")](http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.taobao.arthas&a=arthas-packaging&e=zip&c=bin&v=LATEST)
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:)
Download and unzip, find `arthas-boot.jar` in the directory. Start with `java` command:
```bash
as.bat <pid>
java -jar arthas-boot.jar
```
## Manual Installation
[Manual Installation](manual-install.md)
If you fail to boot Arthas with the provided batch file, you could try to assemble the bootstrap command in the following way.
1. Locate java in the target JVM:
Print usage:
- Linux/Unix/Mac: `ps aux | grep java`
- Windows: open the Process Monitor to search java
2. Assemble bootstrap command:
Let's suppose we are using `/opt/jdk1.8/bin/java`, then the command should be:
```bash
/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.jar
```
Note:
* `-Xbootclasspath` adds tools.jar
* `-jar /tmp/arthas-packaging/arthas-core.jar` specifies main entry
* `-pid 15146` specifies the target java process PID
* `-target-ip 127.0.0.1` specifies the IP
* `-telnet-port 3658 -http-port 8563` specifies telnet and HTTP ports for remote access
* `-core /tmp/arthas-packaging/arthas-core.jar -agent /tmp/arthas-packaging/arthas/arthas-agent.jar` specifies core/agent jar package
```bash
java -jar arthas-boot.jar -h
```
If you are running on JDK 1.9 or abovethen it's unncessary to add `tools.jar` in option `-Xbootclasspath`.
You can find the logs from `~/logs/arthas/arthas.log`.
## Manual Installation
3. Use telnet to connect once attaching to the target JVM (in step 2) succeeds
[Manual Installation](manual-install.md)
```bash
telnet 127.0.0.1 3658
```
## Offline Help Documentation
@ -97,4 +67,4 @@ Latest Version, Click To Download:[![Arthas](https://img.shields.io/maven-centra
rm -rf ~/.arthas/
```
* On Windows, simply delete the zip file and unzipped files.
* On Windows, delete `.arthas` directory under user home.

@ -1,6 +1,8 @@
Manually Install Arthas
===================
## Manually Install Arthas
1. Download the latest version
**Latest version, Click To Download**: [![Arthas](https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square "Arthas")](http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.taobao.arthas&a=arthas-packaging&e=zip&c=bin&v=LATEST)
@ -31,3 +33,70 @@ Manually Install Arthas
```bash
./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:
```bash
curl -L https://alibaba.github.io/arthas/install.sh | sh
```
The 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: [![Arthas](https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square "Arthas")](http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.taobao.arthas&a=arthas-packaging&e=zip&c=bin&v=LATEST)
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:)
```bash
as.bat <pid>
```
## Manual 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.
1. Locate java in the target JVM:
- Linux/Unix/Mac: `ps aux | grep java`
- Windows: open the Process Monitor to search java
2. Assemble bootstrap command:
Let's suppose we are using `/opt/jdk1.8/bin/java`, then the command should be:
```bash
/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.jar
```
Note:
* `-Xbootclasspath` adds tools.jar
* `-jar /tmp/arthas-packaging/arthas-core.jar` specifies main entry
* `-pid 15146` specifies the target java process PID
* `-target-ip 127.0.0.1` specifies the IP
* `-telnet-port 3658 -http-port 8563` specifies telnet and HTTP ports for remote access
* `-core /tmp/arthas-packaging/arthas-core.jar -agent /tmp/arthas-packaging/arthas/arthas-agent.jar` specifies core/agent jar package
If you are running on JDK 1.9 or abovethen it's unncessary to add `tools.jar` in option `-Xbootclasspath`.
You can find the logs from `~/logs/arthas/arthas.log`.
3. Use telnet to connect once attaching to the target JVM (in step 2) succeeds
```bash
telnet 127.0.0.1 3658
```

@ -4,15 +4,13 @@ Quick Start
## 1. Start Demo Application
```bash
wget https://alibaba.github.io/arthas/arthas-demo.jar
java -jar arthas-demo.jar
```
`arthas-demo` is a simple program that generates a random number every second, then find all prime factors of the number.
If there is no `arthas-demo.jar` locally, you can download it from here:[Click](http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.taobao.arthas&a=arthas-boot&v=LATEST)
You can also compile code by youself:[View](https://github.com/alibaba/arthas/blob/master/demo/src/main/java/demo)
The source code of `arthas-demo`: [View](https://github.com/alibaba/arthas/blob/master/demo/src/main/java/demo/MathGame.java)
## 2. Start Arthas
@ -21,10 +19,13 @@ You can also compile code by youself:[View](https://github.com/alibaba/arthas/bl
Execute the following command in the command line:
```bash
wget https://alibaba.github.io/arthas/arthas-boot.jar
java -jar arthas-boot.jar
```
> The user to run this command *MUST* have the same privilege as the owner of the target process, as a simple example you can try the following command if the target process is managed by user `admin`: `sudo su admin && java -jar arthas-boot.jar` or `sudo -u admin -EH java -jar arthas-boot.jar`.If you cannot be able to attach to the target process, please check the logs under `~/logs/arthas` for troubleshooting.
* The user to run this command *MUST* have the same privilege as the owner of the target process, as a simple example you can try the following command if the target process is managed by user `admin`: `sudo su admin && java -jar arthas-boot.jar` or `sudo -u admin -EH java -jar arthas-boot.jar`
* .If you cannot be able to attach to the target process, please check the logs under `~/logs/arthas` for troubleshooting.
* `java -jar arthas-boot.jar -h` print usage.
Select the target Java process to attach:

@ -90,9 +90,12 @@
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">Installation</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#all-platform-recommended">All Platform (recommended)</a></li>
<li class="toctree-l2"><a class="reference internal" href="#linux-unix-mac">Linux/Unix/Mac</a></li>
<li class="toctree-l2"><a class="reference internal" href="#windows">Windows</a></li>
<li class="toctree-l2"><a class="reference internal" href="#quick-installation">Quick installation</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#use-arthas-boot">Use <code class="docutils literal notranslate"><span class="pre">arthas-boot</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#use-as-sh">Use <code class="docutils literal notranslate"><span class="pre">as.sh</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#full-installation">Full installation</a></li>
<li class="toctree-l2"><a class="reference internal" href="#manual-installation">Manual Installation</a></li>
<li class="toctree-l2"><a class="reference internal" href="#offline-help-documentation">Offline Help Documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="#uninstall">Uninstall</a></li>
@ -174,20 +177,22 @@
<div class="section" id="install-arthas">
<span id="install-arthas"></span><h1>Install Arthas<a class="headerlink" href="#install-arthas" title="Permalink to this headline"></a></h1>
<div class="section" id="all-platform-recommended">
<span id="all-platform-recommended"></span><h2>All Platform (recommended)<a class="headerlink" href="#all-platform-recommended" title="Permalink to this headline"></a></h2>
<p>Latest Version, Click To Download: <a class="reference external" href="http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&amp;g=com.taobao.arthas&amp;a=arthas-packaging&amp;e=zip&amp;c=bin&amp;v=LATEST"><img alt="Arthas" src="https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square" /></a></p>
<p>Download and unzip, find <code class="docutils literal notranslate"><span class="pre">arthas-boot.jar</span></code> in the directory. Start with <code class="docutils literal notranslate"><span class="pre">java</span></code> command:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>java -jar arthas-boot.jar
<div class="section" id="quick-installation">
<span id="quick-installation"></span><h2>Quick installation<a class="headerlink" href="#quick-installation" title="Permalink to this headline"></a></h2>
<div class="section" id="use-arthas-boot">
<span id="use-arthas-boot"></span><h3>Use <code class="docutils literal notranslate"><span class="pre">arthas-boot</span></code><a class="headerlink" href="#use-arthas-boot" title="Permalink to this headline"></a></h3>
<p>Download<code class="docutils literal notranslate"><span class="pre">arthas-boot.jar</span></code>Start with <code class="docutils literal notranslate"><span class="pre">java</span></code> command:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>wget https://alibaba.github.io/arthas/arthas-boot.jar
java -jar arthas-boot.jar
</pre></div>
</div>
<p>Print help information:</p>
<p>Print usage:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>java -jar arthas-boot.jar -h
</pre></div>
</div>
</div>
<div class="section" id="linux-unix-mac">
<span id="linux-unix-mac"></span><h2>Linux/Unix/Mac<a class="headerlink" href="#linux-unix-mac" title="Permalink to this headline"></a></h2>
<div class="section" id="use-as-sh">
<span id="use-as-sh"></span><h3>Use <code class="docutils literal notranslate"><span class="pre">as.sh</span></code><a class="headerlink" href="#use-as-sh" title="Permalink to this headline"></a></h3>
<p>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 <em>Enter</em> to run:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>curl -L https://alibaba.github.io/arthas/install.sh <span class="p">|</span> sh
</pre></div>
@ -195,53 +200,22 @@
<p>The command above will download the bootstrap script <code class="docutils literal notranslate"><span class="pre">as.sh</span></code> to the current directory. You can move it the any other place you want, or put its location in <code class="docutils literal notranslate"><span class="pre">$PATH</span></code>.</p>
<p>You can enter its interactive interface by executing <code class="docutils literal notranslate"><span class="pre">as.sh</span></code>, or execute <code class="docutils literal notranslate"><span class="pre">as.sh</span> <span class="pre">-h</span></code> for more help information.</p>
</div>
<div class="section" id="windows">
<span id="windows"></span><h2>Windows<a class="headerlink" href="#windows" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="full-installation">
<span id="full-installation"></span><h2>Full installation<a class="headerlink" href="#full-installation" title="Permalink to this headline"></a></h2>
<p>Latest Version, Click To Download: <a class="reference external" href="http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&amp;g=com.taobao.arthas&amp;a=arthas-packaging&amp;e=zip&amp;c=bin&amp;v=LATEST"><img alt="Arthas" src="https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square" /></a></p>
<p>Download and unzip, then find <code class="docutils literal notranslate"><span class="pre">as.bat</span></code> from bin directory. For now this script will only take one argument <code class="docutils literal notranslate"><span class="pre">pid</span></code>, which means you can only diagnose the local Java process. (Welcome any bat script expert to make it better :heart:)</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>as.bat &lt;pid&gt;
<p>Download and unzip, find <code class="docutils literal notranslate"><span class="pre">arthas-boot.jar</span></code> in the directory. Start with <code class="docutils literal notranslate"><span class="pre">java</span></code> command:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>java -jar arthas-boot.jar
</pre></div>
</div>
<p>Print usage:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>java -jar arthas-boot.jar -h
</pre></div>
</div>
</div>
<div class="section" id="manual-installation">
<span id="manual-installation"></span><h2>Manual Installation<a class="headerlink" href="#manual-installation" title="Permalink to this headline"></a></h2>
<p><a class="reference internal" href="manual-install.html"><span class="doc">Manual Installation</span></a></p>
<p>If you fail to boot Arthas with the provided batch file, you could try to assemble the bootstrap command in the following way.</p>
<ol>
<li><p class="first">Locate java in the target JVM:</p>
<ul class="simple">
<li>Linux/Unix/Mac: <code class="docutils literal notranslate"><span class="pre">ps</span> <span class="pre">aux</span> <span class="pre">|</span> <span class="pre">grep</span> <span class="pre">java</span></code></li>
<li>Windows: open the Process Monitor to search java</li>
</ul>
</li>
<li><p class="first">Assemble bootstrap command:</p>
<p>Lets suppose we are using <code class="docutils literal notranslate"><span class="pre">/opt/jdk1.8/bin/java</span></code>, then the command should be:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>/opt/jdk1.8/bin/java -Xbootclasspath/a:/opt/jdk1.8/lib/tools.jar <span class="se">\</span>
-jar /tmp/arthas-packaging/arthas-core.jar <span class="se">\</span>
-pid <span class="m">15146</span> <span class="se">\</span>
-target-ip <span class="m">127</span>.0.0.1 -telnet-port <span class="m">3658</span> -http-port <span class="m">8563</span> <span class="se">\</span>
-core /tmp/arthas-packaging/arthas-core.jar <span class="se">\</span>
-agent /tmp/arthas-packaging/arthas/arthas-agent.jar
</pre></div>
</div>
<p>Note:</p>
<ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">-Xbootclasspath</span></code> adds tools.jar</li>
<li><code class="docutils literal notranslate"><span class="pre">-jar</span> <span class="pre">/tmp/arthas-packaging/arthas-core.jar</span></code> specifies main entry</li>
<li><code class="docutils literal notranslate"><span class="pre">-pid</span> <span class="pre">15146</span></code> specifies the target java process PID</li>
<li><code class="docutils literal notranslate"><span class="pre">-target-ip</span> <span class="pre">127.0.0.1</span></code> specifies the IP</li>
<li><code class="docutils literal notranslate"><span class="pre">-telnet-port</span> <span class="pre">3658</span> <span class="pre">-http-port</span> <span class="pre">8563</span></code> specifies telnet and HTTP ports for remote access</li>
<li><code class="docutils literal notranslate"><span class="pre">-core</span> <span class="pre">/tmp/arthas-packaging/arthas-core.jar</span> <span class="pre">-agent</span> <span class="pre">/tmp/arthas-packaging/arthas/arthas-agent.jar</span></code> specifies core/agent jar package</li>
</ul>
<p>If you are running on JDK 1.9 or abovethen its unncessary to add <code class="docutils literal notranslate"><span class="pre">tools.jar</span></code> in option <code class="docutils literal notranslate"><span class="pre">-Xbootclasspath</span></code>.</p>
<p>You can find the logs from <code class="docutils literal notranslate"><span class="pre">~/logs/arthas/arthas.log</span></code>.</p>
</li>
<li><p class="first">Use telnet to connect once attaching to the target JVM (in step 2) succeeds</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>telnet <span class="m">127</span>.0.0.1 <span class="m">3658</span>
</pre></div>
</div>
</li>
</ol>
</div>
<div class="section" id="offline-help-documentation">
<span id="offline-help-documentation"></span><h2>Offline Help Documentation<a class="headerlink" href="#offline-help-documentation" title="Permalink to this headline"></a></h2>
@ -255,7 +229,7 @@
</pre></div>
</div>
</li>
<li><p class="first">On Windows, simply delete the zip file and unzipped files.</p>
<li><p class="first">On Windows, delete <code class="docutils literal notranslate"><span class="pre">.arthas</span></code> directory under user home.</p>
</li>
</ul>
</div>

@ -164,6 +164,8 @@
<div class="section" id="manually-install-arthas">
<span id="manually-install-arthas"></span><h1>Manually Install Arthas<a class="headerlink" href="#manually-install-arthas" title="Permalink to this headline"></a></h1>
<div class="section" id="manually-install-arthas">
<span id="id1"></span><h2>Manually Install Arthas<a class="headerlink" href="#manually-install-arthas" title="Permalink to this headline"></a></h2>
<ol>
<li><p class="first">Download the latest version</p>
<p><strong>Latest version, Click To Download</strong>: <a class="reference external" href="http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&amp;g=com.taobao.arthas&amp;a=arthas-packaging&amp;e=zip&amp;c=bin&amp;v=LATEST"><img alt="Arthas" src="https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square" /></a></p>
@ -190,6 +192,66 @@ rm -rf /home/admin/.arthas/lib/* <span class="c1"># remove all the leftover of t
</div>
</li>
</ol>
</div>
<div class="section" id="startup-with-as-sh-as-bat">
<span id="startup-with-as-sh-as-bat"></span><h2>Startup with as.sh/as.bat<a class="headerlink" href="#startup-with-as-sh-as-bat" title="Permalink to this headline"></a></h2>
<div class="section" id="linux-unix-mac">
<span id="linux-unix-mac"></span><h3>Linux/Unix/Mac<a class="headerlink" href="#linux-unix-mac" title="Permalink to this headline"></a></h3>
<p>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 <em>Enter</em> to run:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>curl -L https://alibaba.github.io/arthas/install.sh <span class="p">|</span> sh
</pre></div>
</div>
<p>The command above will download the bootstrap script <code class="docutils literal notranslate"><span class="pre">as.sh</span></code> to the current directory. You can move it the any other place you want, or put its location in <code class="docutils literal notranslate"><span class="pre">$PATH</span></code>.</p>
<p>You can enter its interactive interface by executing <code class="docutils literal notranslate"><span class="pre">as.sh</span></code>, or execute <code class="docutils literal notranslate"><span class="pre">as.sh</span> <span class="pre">-h</span></code> for more help information.</p>
</div>
<div class="section" id="windows">
<span id="windows"></span><h3>Windows<a class="headerlink" href="#windows" title="Permalink to this headline"></a></h3>
<p>Latest Version, Click To Download: <a class="reference external" href="http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&amp;g=com.taobao.arthas&amp;a=arthas-packaging&amp;e=zip&amp;c=bin&amp;v=LATEST"><img alt="Arthas" src="https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square" /></a></p>
<p>Download and unzip, then find <code class="docutils literal notranslate"><span class="pre">as.bat</span></code> from bin directory. For now this script will only take one argument <code class="docutils literal notranslate"><span class="pre">pid</span></code>, which means you can only diagnose the local Java process. (Welcome any bat script expert to make it better :heart:)</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>as.bat &lt;pid&gt;
</pre></div>
</div>
</div>
</div>
<div class="section" id="manual-command-line-startup">
<span id="manual-command-line-startup"></span><h2>Manual command line startup<a class="headerlink" href="#manual-command-line-startup" title="Permalink to this headline"></a></h2>
<p>If you fail to boot Arthas with the provided batch file, you could try to assemble the bootstrap command in the following way.</p>
<ol>
<li><p class="first">Locate java in the target JVM:</p>
<ul class="simple">
<li>Linux/Unix/Mac: <code class="docutils literal notranslate"><span class="pre">ps</span> <span class="pre">aux</span> <span class="pre">|</span> <span class="pre">grep</span> <span class="pre">java</span></code></li>
<li>Windows: open the Process Monitor to search java</li>
</ul>
</li>
<li><p class="first">Assemble bootstrap command:</p>
<p>Lets suppose we are using <code class="docutils literal notranslate"><span class="pre">/opt/jdk1.8/bin/java</span></code>, then the command should be:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>/opt/jdk1.8/bin/java -Xbootclasspath/a:/opt/jdk1.8/lib/tools.jar <span class="se">\</span>
-jar /tmp/arthas-packaging/arthas-core.jar <span class="se">\</span>
-pid <span class="m">15146</span> <span class="se">\</span>
-target-ip <span class="m">127</span>.0.0.1 -telnet-port <span class="m">3658</span> -http-port <span class="m">8563</span> <span class="se">\</span>
-core /tmp/arthas-packaging/arthas-core.jar <span class="se">\</span>
-agent /tmp/arthas-packaging/arthas/arthas-agent.jar
</pre></div>
</div>
<p>Note:</p>
<ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">-Xbootclasspath</span></code> adds tools.jar</li>
<li><code class="docutils literal notranslate"><span class="pre">-jar</span> <span class="pre">/tmp/arthas-packaging/arthas-core.jar</span></code> specifies main entry</li>
<li><code class="docutils literal notranslate"><span class="pre">-pid</span> <span class="pre">15146</span></code> specifies the target java process PID</li>
<li><code class="docutils literal notranslate"><span class="pre">-target-ip</span> <span class="pre">127.0.0.1</span></code> specifies the IP</li>
<li><code class="docutils literal notranslate"><span class="pre">-telnet-port</span> <span class="pre">3658</span> <span class="pre">-http-port</span> <span class="pre">8563</span></code> specifies telnet and HTTP ports for remote access</li>
<li><code class="docutils literal notranslate"><span class="pre">-core</span> <span class="pre">/tmp/arthas-packaging/arthas-core.jar</span> <span class="pre">-agent</span> <span class="pre">/tmp/arthas-packaging/arthas/arthas-agent.jar</span></code> specifies core/agent jar package</li>
</ul>
<p>If you are running on JDK 1.9 or abovethen its unncessary to add <code class="docutils literal notranslate"><span class="pre">tools.jar</span></code> in option <code class="docutils literal notranslate"><span class="pre">-Xbootclasspath</span></code>.</p>
<p>You can find the logs from <code class="docutils literal notranslate"><span class="pre">~/logs/arthas/arthas.log</span></code>.</p>
</li>
<li><p class="first">Use telnet to connect once attaching to the target JVM (in step 2) succeeds</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>telnet <span class="m">127</span>.0.0.1 <span class="m">3658</span>
</pre></div>
</div>
</li>
</ol>
</div>
</div>

@ -180,23 +180,27 @@
<span id="quick-start"></span><h1>Quick Start<a class="headerlink" href="#quick-start" title="Permalink to this headline"></a></h1>
<div class="section" id="start-demo-application">
<span id="start-demo-application"></span><h2>1. Start Demo Application<a class="headerlink" href="#start-demo-application" title="Permalink to this headline"></a></h2>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>java -jar arthas-demo.jar
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>wget https://alibaba.github.io/arthas/arthas-demo.jar
java -jar arthas-demo.jar
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">arthas-demo</span></code> is a simple program that generates a random number every second, then find all prime factors of the number.</p>
<p>If there is no <code class="docutils literal notranslate"><span class="pre">arthas-demo.jar</span></code> locally, you can download it from here:<a class="reference external" href="http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&amp;g=com.taobao.arthas&amp;a=arthas-boot&amp;v=LATEST">Click</a></p>
<p>You can also compile code by youself:<a class="reference external" href="https://github.com/alibaba/arthas/blob/master/demo/src/main/java/demo">View</a></p>
<p>The source code of <code class="docutils literal notranslate"><span class="pre">arthas-demo</span></code>: <a class="reference external" href="https://github.com/alibaba/arthas/blob/master/demo/src/main/java/demo/MathGame.java">View</a></p>
</div>
<div class="section" id="start-arthas">
<span id="start-arthas"></span><h2>2. Start Arthas<a class="headerlink" href="#start-arthas" title="Permalink to this headline"></a></h2>
<div class="section" id="linux-unix-mac">
<span id="linux-unix-mac"></span><h3>Linux/Unix/Mac<a class="headerlink" href="#linux-unix-mac" title="Permalink to this headline"></a></h3>
<p>Execute the following command in the command line:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>java -jar arthas-boot.jar
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>wget https://alibaba.github.io/arthas/arthas-boot.jar
java -jar arthas-boot.jar
</pre></div>
</div>
<blockquote>
<div>The user to run this command <em>MUST</em> have the same privilege as the owner of the target process, as a simple example you can try the following command if the target process is managed by user <code class="docutils literal notranslate"><span class="pre">admin</span></code>: <code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">su</span> <span class="pre">admin</span> <span class="pre">&amp;&amp;</span> <span class="pre">java</span> <span class="pre">-jar</span> <span class="pre">arthas-boot.jar</span></code> or <code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">-u</span> <span class="pre">admin</span> <span class="pre">-EH</span> <span class="pre">java</span> <span class="pre">-jar</span> <span class="pre">arthas-boot.jar</span></code>.If you cannot be able to attach to the target process, please check the logs under <code class="docutils literal notranslate"><span class="pre">~/logs/arthas</span></code> for troubleshooting.</div></blockquote>
<ul class="simple">
<li>The user to run this command <em>MUST</em> have the same privilege as the owner of the target process, as a simple example you can try the following command if the target process is managed by user <code class="docutils literal notranslate"><span class="pre">admin</span></code>: <code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">su</span> <span class="pre">admin</span> <span class="pre">&amp;&amp;</span> <span class="pre">java</span> <span class="pre">-jar</span> <span class="pre">arthas-boot.jar</span></code> or <code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">-u</span> <span class="pre">admin</span> <span class="pre">-EH</span> <span class="pre">java</span> <span class="pre">-jar</span> <span class="pre">arthas-boot.jar</span></code></li>
<li>.If you cannot be able to attach to the target process, please check the logs under <code class="docutils literal notranslate"><span class="pre">~/logs/arthas</span></code> for troubleshooting.</li>
<li><code class="docutils literal notranslate"><span class="pre">java</span> <span class="pre">-jar</span> <span class="pre">arthas-boot.jar</span> <span class="pre">-h</span></code> print usage.</li>
</ul>
<p>Select the target Java process to attach:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ $ java -jar arthas-boot.jar
* <span class="o">[</span><span class="m">1</span><span class="o">]</span>: <span class="m">35542</span>

File diff suppressed because one or more lines are too long

@ -91,11 +91,13 @@
<ul class="current">
<li class="toctree-l1"><a class="reference external" href="https://alibaba.github.io/arthas/en/">English Docs</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">安装</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#">全平台通用(推荐)</a></li>
<li class="toctree-l2"><a class="reference internal" href="#linux-unix-mac">Linux/Unix/Mac</a></li>
<li class="toctree-l2"><a class="reference internal" href="#windows">Windows</a></li>
<li class="toctree-l2"><a class="reference internal" href="#">快速安装</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#arthas-boot">使用<code class="docutils literal notranslate"><span class="pre">arthas-boot</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#as-sh">使用<code class="docutils literal notranslate"><span class="pre">as.sh</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#">全量安装</a></li>
<li class="toctree-l2"><a class="reference internal" href="#">手动安装</a></li>
<li class="toctree-l2"><a class="reference internal" href="#">手动拼接命令行启动</a></li>
<li class="toctree-l2"><a class="reference internal" href="#">离线帮助文档</a></li>
<li class="toctree-l2"><a class="reference internal" href="#">卸载</a></li>
</ul>
@ -178,19 +180,24 @@
<div class="section" id="arthas-install">
<span id="arthas-install"></span><h1>Arthas Install<a class="headerlink" href="#arthas-install" title="永久链接至标题"></a></h1>
<div class="section" id="">
<span id="id1"></span><h2>全平台通用(推荐)<a class="headerlink" href="#" title="永久链接至标题"></a></h2>
<p>最新版本,点击下载:<a class="reference external" href="http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&amp;g=com.taobao.arthas&amp;a=arthas-packaging&amp;e=zip&amp;c=bin&amp;v=LATEST"><img alt="Arthas" src="https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square" /></a></p>
<p>解压后,在文件夹里有<code class="docutils literal notranslate"><span class="pre">arthas-boot.jar</span></code>,直接用<code class="docutils literal notranslate"><span class="pre">java</span> <span class="pre">-jar</span></code>的方式启动:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>java -jar arthas-boot.jar
<span id="id1"></span><h2>快速安装<a class="headerlink" href="#" title="永久链接至标题"></a></h2>
<div class="section" id="arthas-boot">
<span id="arthas-boot"></span><h3>使用<code class="docutils literal notranslate"><span class="pre">arthas-boot</span></code><a class="headerlink" href="#arthas-boot" title="永久链接至标题"></a></h3>
<p>下载<code class="docutils literal notranslate"><span class="pre">arthas-boot.jar</span></code>,然后用<code class="docutils literal notranslate"><span class="pre">java</span> <span class="pre">-jar</span></code>的方式启动:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>wget https://alibaba.github.io/arthas/arthas-boot.jar
java -jar arthas-boot.jar
</pre></div>
</div>
<p>打印帮助信息:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>java -jar arthas-boot.jar -h
</pre></div>
</div>
<ul class="simple">
<li>如果下载速度比较慢可以使用aliyun的镜像<code class="docutils literal notranslate"><span class="pre">java</span> <span class="pre">-jar</span> <span class="pre">arthas-boot.jar</span> <span class="pre">--repo-mirror</span> <span class="pre">aliyun</span> <span class="pre">--use-http</span></code></li>
</ul>
</div>
<div class="section" id="linux-unix-mac">
<span id="linux-unix-mac"></span><h2>Linux/Unix/Mac<a class="headerlink" href="#linux-unix-mac" title="永久链接至标题"></a></h2>
<div class="section" id="as-sh">
<span id="as-sh"></span><h3>使用<code class="docutils literal notranslate"><span class="pre">as.sh</span></code><a class="headerlink" href="#as-sh" title="永久链接至标题"></a></h3>
<p>Arthas 支持在 Linux/Unix/Mac 等平台上一键安装,请复制以下内容,并粘贴到命令行中,敲 <code class="docutils literal notranslate"><span class="pre">回车</span></code> 执行即可:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>curl -L https://alibaba.github.io/arthas/install.sh <span class="p">|</span> sh
</pre></div>
@ -199,52 +206,22 @@
<p>直接在shell下面执行<code class="docutils literal notranslate"><span class="pre">./as.sh</span></code>,就会进入交互界面。</p>
<p>也可以执行<code class="docutils literal notranslate"><span class="pre">./as.sh</span> <span class="pre">-h</span></code>来获取更多参数信息。</p>
</div>
<div class="section" id="windows">
<span id="windows"></span><h2>Windows<a class="headerlink" href="#windows" title="永久链接至标题"></a></h2>
<p>最新版本,点击下载:<a class="reference external" href="http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&amp;g=com.taobao.arthas&amp;a=arthas-packaging&amp;e=zip&amp;c=bin&amp;v=LATEST"><img alt="Arthas" src="https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square" /></a></p>
<p>下载解压后在bin目录有 <code class="docutils literal notranslate"><span class="pre">as.bat</span></code>。此脚本暂时只接受一个参数 pid即只能诊断本机上的 Java 进程。欢迎精通bat脚本的开发者改进</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">as</span><span class="o">.</span><span class="n">bat</span> <span class="o">&lt;</span><span class="n">pid</span><span class="o">&gt;</span>
</pre></div>
</div>
</div>
<div class="section" id="">
<span id="id2"></span><h2>手动安装<a class="headerlink" href="#" title="永久链接至标题"></a></h2>
<p><a class="reference internal" href="manual-install.html"><span class="doc">手动安装</span></a></p>
</div>
<div class="section" id="">
<span id="id3"></span><h2>手动拼接命令行启动<a class="headerlink" href="#" title="永久链接至标题"></a></h2>
<p>如果启动遇到问题,可以尝试手动拼接出命令行参数来启动。</p>
<ol>
<li><p class="first">查找目录jvm的java文件路径。</p>
<p>在linux/mac上执行<code class="docutils literal notranslate"><span class="pre">ps</span> <span class="pre">aux</span> <span class="pre">|</span> <span class="pre">grep</span> <span class="pre">java</span></code>在windows上可以通过进程管理器来查看。假设是<code class="docutils literal notranslate"><span class="pre">/opt/jdk1.8/bin/java</span></code></p>
</li>
<li><p class="first">拼接出命令行</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>/opt/jdk1.8/bin/java -Xbootclasspath/a:/opt/jdk1.8/lib/tools.jar <span class="se">\</span>
-jar /tmp/arthas-packaging/arthas-core.jar <span class="se">\</span>
-pid <span class="m">15146</span> <span class="se">\</span>
-target-ip <span class="m">127</span>.0.0.1 -telnet-port <span class="m">3658</span> -http-port <span class="m">8563</span> <span class="se">\</span>
-core /tmp/arthas-packaging/arthas-core.jar <span class="se">\</span>
-agent /tmp/arthas-packaging/arthas/arthas-agent.jar
<span id="id2"></span><h2>全量安装<a class="headerlink" href="#" title="永久链接至标题"></a></h2>
<p>最新版本,点击下载:<a class="reference external" href="http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&amp;g=com.taobao.arthas&amp;a=arthas-packaging&amp;e=zip&amp;c=bin&amp;v=LATEST"><img alt="Arthas" src="https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square" /></a></p>
<p>解压后,在文件夹里有<code class="docutils literal notranslate"><span class="pre">arthas-boot.jar</span></code>,直接用<code class="docutils literal notranslate"><span class="pre">java</span> <span class="pre">-jar</span></code>的方式启动:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>java -jar arthas-boot.jar
</pre></div>
</div>
<p>命令行分几部分组成:</p>
<ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">-Xbootclasspath</span></code> 增加tools.jar</li>
<li><code class="docutils literal notranslate"><span class="pre">-jar</span> <span class="pre">/tmp/arthas-packaging/arthas-core.jar</span></code> 指定main函数入口</li>
<li><code class="docutils literal notranslate"><span class="pre">-pid</span> <span class="pre">15146</span></code> 指定目标java进程ID</li>
<li><code class="docutils literal notranslate"><span class="pre">-target-ip</span> <span class="pre">127.0.0.1</span></code> 指定IP</li>
<li><code class="docutils literal notranslate"><span class="pre">-telnet-port</span> <span class="pre">3658</span> <span class="pre">-http-port</span> <span class="pre">8563</span></code> 指定telnet和http端口</li>
<li><code class="docutils literal notranslate"><span class="pre">-core</span> <span class="pre">/tmp/arthas-packaging/arthas-core.jar</span> <span class="pre">-agent</span> <span class="pre">/tmp/arthas-packaging/arthas/arthas-agent.jar</span></code> 指定core/agent jar包</li>
</ul>
<p>如果是<code class="docutils literal notranslate"><span class="pre">jdk</span> <span class="pre">&gt;</span> <span class="pre">9</span></code>即9/10/11以上的版本不需要指定<code class="docutils literal notranslate"><span class="pre">tools.jar</span></code>,直接去掉<code class="docutils literal notranslate"><span class="pre">-Xbootclasspath</span></code> 的配置即可。</p>
<p>启动目志输出在<code class="docutils literal notranslate"><span class="pre">~/logs/arthas/arthas.log</span></code>里。</p>
</li>
<li><p class="first">attach成功之后使用telnet连接</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>telnet <span class="m">127</span>.0.0.1 <span class="m">3658</span>
<p>打印帮助信息:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>java -jar arthas-boot.jar -h
</pre></div>
</div>
</li>
</ol>
</div>
<div class="section" id="">
<span id="id3"></span><h2>手动安装<a class="headerlink" href="#" title="永久链接至标题"></a></h2>
<p><a class="reference internal" href="manual-install.html"><span class="doc">手动安装</span></a></p>
</div>
<div class="section" id="">
<span id="id4"></span><h2>离线帮助文档<a class="headerlink" href="#" title="永久链接至标题"></a></h2>
@ -259,7 +236,7 @@
</pre></div>
</div>
</li>
<li><p class="first">Windows平台直接删除zip包和解压的文件</p>
<li><p class="first">Windows平台直接删除user home下面的<code class="docutils literal notranslate"><span class="pre">.arthas</span></code>目录</p>
</li>
</ul>
</div>

@ -166,6 +166,8 @@
<div class="section" id="arthas">
<span id="arthas"></span><h1>手动安装Arthas<a class="headerlink" href="#arthas" title="永久链接至标题"></a></h1>
<div class="section" id="arthas">
<span id="id1"></span><h2>手动安装Arthas<a class="headerlink" href="#arthas" title="永久链接至标题"></a></h2>
<ol>
<li><p class="first">下载最新版本</p>
<p><strong>最新版本,点击下载</strong><a class="reference external" href="http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&amp;g=com.taobao.arthas&amp;a=arthas-packaging&amp;e=zip&amp;c=bin&amp;v=LATEST"><img alt="Arthas" src="https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square" /></a></p>
@ -196,6 +198,63 @@
</div>
</li>
</ol>
</div>
<div class="section" id="as-sh-as-bat">
<span id="as-sh-as-bat"></span><h2>以脚本的方式启动as.sh/as.bat<a class="headerlink" href="#as-sh-as-bat" title="永久链接至标题"></a></h2>
<div class="section" id="linux-unix-mac">
<span id="linux-unix-mac"></span><h3>Linux/Unix/Mac<a class="headerlink" href="#linux-unix-mac" title="永久链接至标题"></a></h3>
<p>Arthas 支持在 Linux/Unix/Mac 等平台上一键安装,请复制以下内容,并粘贴到命令行中,敲 <code class="docutils literal notranslate"><span class="pre">回车</span></code> 执行即可:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>curl -L https://alibaba.github.io/arthas/install.sh <span class="p">|</span> sh
</pre></div>
</div>
<p>上述命令会下载启动脚本文件 <code class="docutils literal notranslate"><span class="pre">as.sh</span></code> 到当前目录,你可以放在任何地方或将其加入到 <code class="docutils literal notranslate"><span class="pre">$PATH</span></code> 中。</p>
<p>直接在shell下面执行<code class="docutils literal notranslate"><span class="pre">./as.sh</span></code>,就会进入交互界面。</p>
<p>也可以执行<code class="docutils literal notranslate"><span class="pre">./as.sh</span> <span class="pre">-h</span></code>来获取更多参数信息。</p>
</div>
<div class="section" id="windows">
<span id="windows"></span><h3>Windows<a class="headerlink" href="#windows" title="永久链接至标题"></a></h3>
<p>最新版本,点击下载:<a class="reference external" href="http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&amp;g=com.taobao.arthas&amp;a=arthas-packaging&amp;e=zip&amp;c=bin&amp;v=LATEST"><img alt="Arthas" src="https://img.shields.io/maven-central/v/com.taobao.arthas/arthas-packaging.svg?style=flat-square" /></a></p>
<p>下载解压后在bin目录有 <code class="docutils literal notranslate"><span class="pre">as.bat</span></code>。此脚本暂时只接受一个参数 pid即只能诊断本机上的 Java 进程。欢迎精通bat脚本的开发者改进</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">as</span><span class="o">.</span><span class="n">bat</span> <span class="o">&lt;</span><span class="n">pid</span><span class="o">&gt;</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="">
<span id="id2"></span><h2>手动拼接命令行启动<a class="headerlink" href="#" title="永久链接至标题"></a></h2>
<p>如果启动遇到问题,可以尝试手动拼接出命令行参数来启动。</p>
<ol>
<li><p class="first">查找目录jvm的java文件路径。</p>
<p>在linux/mac上执行<code class="docutils literal notranslate"><span class="pre">ps</span> <span class="pre">aux</span> <span class="pre">|</span> <span class="pre">grep</span> <span class="pre">java</span></code>在windows上可以通过进程管理器来查看。假设是<code class="docutils literal notranslate"><span class="pre">/opt/jdk1.8/bin/java</span></code></p>
</li>
<li><p class="first">拼接出命令行</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>/opt/jdk1.8/bin/java -Xbootclasspath/a:/opt/jdk1.8/lib/tools.jar <span class="se">\</span>
-jar /tmp/arthas-packaging/arthas-core.jar <span class="se">\</span>
-pid <span class="m">15146</span> <span class="se">\</span>
-target-ip <span class="m">127</span>.0.0.1 -telnet-port <span class="m">3658</span> -http-port <span class="m">8563</span> <span class="se">\</span>
-core /tmp/arthas-packaging/arthas-core.jar <span class="se">\</span>
-agent /tmp/arthas-packaging/arthas/arthas-agent.jar
</pre></div>
</div>
<p>命令行分几部分组成:</p>
<ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">-Xbootclasspath</span></code> 增加tools.jar</li>
<li><code class="docutils literal notranslate"><span class="pre">-jar</span> <span class="pre">/tmp/arthas-packaging/arthas-core.jar</span></code> 指定main函数入口</li>
<li><code class="docutils literal notranslate"><span class="pre">-pid</span> <span class="pre">15146</span></code> 指定目标java进程ID</li>
<li><code class="docutils literal notranslate"><span class="pre">-target-ip</span> <span class="pre">127.0.0.1</span></code> 指定IP</li>
<li><code class="docutils literal notranslate"><span class="pre">-telnet-port</span> <span class="pre">3658</span> <span class="pre">-http-port</span> <span class="pre">8563</span></code> 指定telnet和http端口</li>
<li><code class="docutils literal notranslate"><span class="pre">-core</span> <span class="pre">/tmp/arthas-packaging/arthas-core.jar</span> <span class="pre">-agent</span> <span class="pre">/tmp/arthas-packaging/arthas/arthas-agent.jar</span></code> 指定core/agent jar包</li>
</ul>
<p>如果是<code class="docutils literal notranslate"><span class="pre">jdk</span> <span class="pre">&gt;</span> <span class="pre">9</span></code>即9/10/11以上的版本不需要指定<code class="docutils literal notranslate"><span class="pre">tools.jar</span></code>,直接去掉<code class="docutils literal notranslate"><span class="pre">-Xbootclasspath</span></code> 的配置即可。</p>
<p>启动目志输出在<code class="docutils literal notranslate"><span class="pre">~/logs/arthas/arthas.log</span></code>里。</p>
</li>
<li><p class="first">attach成功之后使用telnet连接</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>telnet <span class="m">127</span>.0.0.1 <span class="m">3658</span>
</pre></div>
</div>
</li>
</ol>
</div>
</div>

@ -179,23 +179,26 @@
<span id="id1"></span><h1>快速入门<a class="headerlink" href="#" title="永久链接至标题"></a></h1>
<div class="section" id="demo">
<span id="demo"></span><h2>1. 启动Demo<a class="headerlink" href="#demo" title="永久链接至标题"></a></h2>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>java -jar arthas-demo.jar
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>wget https://alibaba.github.io/arthas/arthas-demo.jar
java -jar arthas-demo.jar
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">arthas-demo</span></code>是一个简单的程序,每隔一秒生成一个随机数,再执行质因式分解,并打印出分解结果。</p>
<p>如果本地没有<code class="docutils literal notranslate"><span class="pre">arthas-demo.jar</span></code>, 可以从这里下载: <a class="reference external" href="http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&amp;g=com.taobao.arthas&amp;a=arthas-boot&amp;v=LATEST">点击</a></p>
<p>也可以自己从代码里编绎运行:<a class="reference external" href="https://github.com/alibaba/arthas/blob/master/demo/src/main/java/demo">查看</a></p>
<p><code class="docutils literal notranslate"><span class="pre">arthas-demo</span></code>源代码:<a class="reference external" href="https://github.com/alibaba/arthas/blob/master/demo/src/main/java/demo/MathGame.java">查看</a></p>
</div>
<div class="section" id="arthas">
<span id="arthas"></span><h2>2. 启动arthas<a class="headerlink" href="#arthas" title="永久链接至标题"></a></h2>
<p>在命令行下面执行:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>java -jar arthas-boot.jar
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>wget https://alibaba.github.io/arthas/arthas-boot.jar
java -jar arthas-boot.jar
</pre></div>
</div>
<blockquote>
<div>执行该程序的用户需要和目标进程具有相同的权限。比如以<code class="docutils literal notranslate"><span class="pre">admin</span></code>用户来执行:
<code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">su</span> <span class="pre">admin</span> <span class="pre">&amp;&amp;</span> <span class="pre">java</span> <span class="pre">-jar</span> <span class="pre">arthas-boot.jar</span></code><code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">-u</span> <span class="pre">admin</span> <span class="pre">-EH</span> <span class="pre">java</span> <span class="pre">-jar</span> <span class="pre">arthas-boot.jar</span></code>
如果attatch不上目标进程可以查看<code class="docutils literal notranslate"><span class="pre">~/logs/arthas/</span></code> 目录下的日志。</div></blockquote>
<ul class="simple">
<li>执行该程序的用户需要和目标进程具有相同的权限。比如以<code class="docutils literal notranslate"><span class="pre">admin</span></code>用户来执行:<code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">su</span> <span class="pre">admin</span> <span class="pre">&amp;&amp;</span> <span class="pre">java</span> <span class="pre">-jar</span> <span class="pre">arthas-boot.jar</span></code><code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">-u</span> <span class="pre">admin</span> <span class="pre">-EH</span> <span class="pre">java</span> <span class="pre">-jar</span> <span class="pre">arthas-boot.jar</span></code></li>
<li>如果attatch不上目标进程可以查看<code class="docutils literal notranslate"><span class="pre">~/logs/arthas/</span></code> 目录下的日志。</li>
<li>如果下载速度比较慢可以使用aliyun的镜像<code class="docutils literal notranslate"><span class="pre">java</span> <span class="pre">-jar</span> <span class="pre">arthas-boot.jar</span> <span class="pre">--repo-mirror</span> <span class="pre">aliyun</span> <span class="pre">--use-http</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">java</span> <span class="pre">-jar</span> <span class="pre">arthas-boot.jar</span> <span class="pre">-h</span></code> 打印更多参数信息。</li>
</ul>
<p>选择应用java进程</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ $ java -jar arthas-boot.jar
* [1]: 35542

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save