mirror of
https://github.com/alibaba/arthas.git
synced 2026-11-30 15:33:59 +00:00
update quick-start.md
This commit is contained in:
1 parent
c6b639b6cc
commit
0b302b2382
2 files changed
+13
-12
No files matched your search
@@ -4,15 +4,13 @@ Quick Start
|
|||||||
## 1. Start Demo Application
|
## 1. Start Demo Application
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
wget https://alibaba.github.io/arthas/arthas-demo.jar
|
||||||
java -jar 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.
|
`arthas-demo` is a simple program that generates a random number every second, then find all prime factors of the number.
|
||||||
|
|
||||||
|
The source code of `arthas-demo`: [View](https://github.com/alibaba/arthas/blob/master/demo/src/main/java/demo/MathGame.java)
|
||||||
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)
|
|
||||||
|
|
||||||
## 2. Start Arthas
|
## 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:
|
Execute the following command in the command line:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
wget https://alibaba.github.io/arthas/arthas-boot.jar
|
||||||
java -jar 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:
|
Select the target Java process to attach:
|
||||||
|
|
||||||
|
|||||||
@@ -4,15 +4,13 @@
|
|||||||
## 1. 启动Demo
|
## 1. 启动Demo
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
wget https://alibaba.github.io/arthas/arthas-demo.jar
|
||||||
java -jar arthas-demo.jar
|
java -jar arthas-demo.jar
|
||||||
```
|
```
|
||||||
|
|
||||||
`arthas-demo`是一个简单的程序,每隔一秒生成一个随机数,再执行质因式分解,并打印出分解结果。
|
`arthas-demo`是一个简单的程序,每隔一秒生成一个随机数,再执行质因式分解,并打印出分解结果。
|
||||||
|
|
||||||
|
`arthas-demo`源代码:[查看](https://github.com/alibaba/arthas/blob/master/demo/src/main/java/demo/MathGame.java)
|
||||||
如果本地没有`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)
|
|
||||||
|
|
||||||
|
|
||||||
## 2. 启动arthas
|
## 2. 启动arthas
|
||||||
@@ -20,12 +18,14 @@ java -jar arthas-demo.jar
|
|||||||
在命令行下面执行:
|
在命令行下面执行:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
wget https://alibaba.github.io/arthas/arthas-boot.jar
|
||||||
java -jar arthas-boot.jar
|
java -jar arthas-boot.jar
|
||||||
```
|
```
|
||||||
|
|
||||||
> 执行该程序的用户需要和目标进程具有相同的权限。比如以`admin`用户来执行:
|
* 执行该程序的用户需要和目标进程具有相同的权限。比如以`admin`用户来执行:`sudo su admin && java -jar arthas-boot.jar` 或 `sudo -u admin -EH java -jar arthas-boot.jar`。
|
||||||
> `sudo su admin && java -jar arthas-boot.jar` 或 `sudo -u admin -EH java -jar arthas-boot.jar`。
|
* 如果attatch不上目标进程,可以查看`~/logs/arthas/` 目录下的日志。
|
||||||
> 如果attatch不上目标进程,可以查看`~/logs/arthas/` 目录下的日志。
|
* 如果下载速度比较慢,可以使用aliyun的镜像:`java -jar arthas-boot.jar --repo-mirror aliyun --use-http`
|
||||||
|
* `java -jar arthas-boot.jar -h` 打印更多参数信息。
|
||||||
|
|
||||||
|
|
||||||
选择应用java进程:
|
选择应用java进程:
|
||||||
|
|||||||
Reference in new issue
Block a user