mirror of
https://github.com/alibaba/arthas.git
synced 2026-11-30 15:33:59 +00:00
fix bash codeblock highlight.
This commit is contained in:
1 parent
d025657457
commit
b0bec341a0
18 files changed
+32
-32
No files matched your search
@@ -19,7 +19,7 @@ Arthas 3.0开始支持管道, 率先提供了`grep`,`wc`,`plaintext`的支持。
|
|||||||
|
|
||||||
groovy表达式在arthas2.0中大量使用,例如watch表达式
|
groovy表达式在arthas2.0中大量使用,例如watch表达式
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
watch com.alibaba.sample.petstore.web.store.module.screen.ItemList add "params + ' ' + returnObj" params.size()==2
|
watch com.alibaba.sample.petstore.web.store.module.screen.ItemList add "params + ' ' + returnObj" params.size()==2
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ Arthas 3.0最重要的特性,通过Arthas在线诊断平台,无需再登陆
|
|||||||
|
|
||||||
Arthas 3.0开始支持管道, 率先提供了`grep`,`wc`,`plaintext`的支持。
|
Arthas 3.0开始支持管道, 率先提供了`grep`,`wc`,`plaintext`的支持。
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
java.vendor.url http://java.oracle.com/
|
java.vendor.url http://java.oracle.com/
|
||||||
java.vm.vendor Oracle Corporation
|
java.vm.vendor Oracle Corporation
|
||||||
java.runtime.name Java(TM) SE Runtime Environment
|
java.runtime.name Java(TM) SE Runtime Environment
|
||||||
@@ -55,7 +55,7 @@ To solve this, choose one of the following command:
|
|||||||
|
|
||||||
groovy表达式在arthas2.0中大量使用,例如watch表达式
|
groovy表达式在arthas2.0中大量使用,例如watch表达式
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
watch com.alibaba.sample.petstore.web.store.module.screen.ItemList add "params + ' ' + returnObj" params.size()==2
|
watch com.alibaba.sample.petstore.web.store.module.screen.ItemList add "params + ' ' + returnObj" params.size()==2
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -6,14 +6,14 @@ arthas中的异步调用,使用了仿linux系统任务相关的命令。[linux
|
|||||||
## 1. 使用&在后台执行任务
|
## 1. 使用&在后台执行任务
|
||||||
比如希望执行后台执行trace命令,那么调用下面命令
|
比如希望执行后台执行trace命令,那么调用下面命令
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
trace Test t &
|
trace Test t &
|
||||||
```
|
```
|
||||||
这时命令在后台执行,可以在console中继续执行其他命令。
|
这时命令在后台执行,可以在console中继续执行其他命令。
|
||||||
|
|
||||||
## 2. 通过jobs查看任务
|
## 2. 通过jobs查看任务
|
||||||
如果希望查看当前有哪些arthas任务在执行,可以执行jobs命令,执行结果如下
|
如果希望查看当前有哪些arthas任务在执行,可以执行jobs命令,执行结果如下
|
||||||
```sh
|
```bash
|
||||||
$ jobs
|
$ jobs
|
||||||
[10]*
|
[10]*
|
||||||
Stopped watch com.taobao.container.Test test "params[0].{? #this.name == null }" -x 2
|
Stopped watch com.taobao.container.Test test "params[0].{? #this.name == null }" -x 2
|
||||||
@@ -43,13 +43,13 @@ $ jobs
|
|||||||
## 5. 任务输出重定向
|
## 5. 任务输出重定向
|
||||||
可通过`>`或者`>>`将任务输出结果输出到指定的文件中,可以和`&`一起使用,实现arthas命令的异步调用。比如:
|
可通过`>`或者`>>`将任务输出结果输出到指定的文件中,可以和`&`一起使用,实现arthas命令的异步调用。比如:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
$ trace Test t >> test.out &
|
$ trace Test t >> test.out &
|
||||||
```
|
```
|
||||||
这时trace命令会在后台执行,并且把结果输出到~/logs/arthas-cache/test.out。可继续执行其他命令。并可查看文件中的命令执行结果。
|
这时trace命令会在后台执行,并且把结果输出到~/logs/arthas-cache/test.out。可继续执行其他命令。并可查看文件中的命令执行结果。
|
||||||
|
|
||||||
当连接到远程的arthas server时,可能无法查看远程机器的文件,arthas同时支持了自动重定向到本地缓存路径。使用方法如下:
|
当连接到远程的arthas server时,可能无法查看远程机器的文件,arthas同时支持了自动重定向到本地缓存路径。使用方法如下:
|
||||||
```sh
|
```bash
|
||||||
$ trace Test t >> &
|
$ trace Test t >> &
|
||||||
job id : 2
|
job id : 2
|
||||||
cache location : /Users/gehui/logs/arthas-cache/28198/2
|
cache location : /Users/gehui/logs/arthas-cache/28198/2
|
||||||
|
|||||||
@@ -28,12 +28,12 @@ sc -d org.apache.commons.lang.StringUtils
|
|||||||
|
|
||||||
通过`-b`开启批处理模式, `-f`执行脚本文件, 批处理脚本默认会输出到标准输出中,可以将结果重定向到文件中。
|
通过`-b`开启批处理模式, `-f`执行脚本文件, 批处理脚本默认会输出到标准输出中,可以将结果重定向到文件中。
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
./as.sh -b -f /var/tmp/test.as 56328 > test.out
|
./as.sh -b -f /var/tmp/test.as 56328 > test.out
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 第三步: 查看运行结果
|
#### 第三步: 查看运行结果
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
cat test.out
|
cat test.out
|
||||||
```
|
```
|
||||||
@@ -41,7 +41,7 @@ Affect(row-cnt:11) cost in 66 ms.
|
|||||||
|
|
||||||
* 按类加载实例查看统计信息
|
* 按类加载实例查看统计信息
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
$ classloader -l
|
$ classloader -l
|
||||||
name loadedCount hash parent
|
name loadedCount hash parent
|
||||||
BootstrapClassLoader 3711 null null
|
BootstrapClassLoader 3711 null null
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ Asynchronous jobs in arthas, using commands related to linux jobs.[linux man job
|
|||||||
|
|
||||||
For example, execute the trace command in the background:
|
For example, execute the trace command in the background:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
trace Test t &
|
trace Test t &
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ trace Test t &
|
|||||||
If you want to list all background jobs, you can execute the `jobs` command and the results are as follows:
|
If you want to list all background jobs, you can execute the `jobs` command and the results are as follows:
|
||||||
|
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
$ jobs
|
$ jobs
|
||||||
[10]*
|
[10]*
|
||||||
Stopped watch com.taobao.container.Test test "params[0].{? #this.name == null }" -x 2
|
Stopped watch com.taobao.container.Test test "params[0].{? #this.name == null }" -x 2
|
||||||
@@ -54,7 +54,7 @@ When the job is executing in the foreground, such as directly calling the comman
|
|||||||
|
|
||||||
The job output can be redirect to the specified file by `>` or `>>`, and can be used together with `&` to implement the asynchronous job of the arthas command. such as:
|
The job output can be redirect to the specified file by `>` or `>>`, and can be used together with `&` to implement the asynchronous job of the arthas command. such as:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
$ trace Test t >> test.out &
|
$ trace Test t >> test.out &
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ The trace command will be executed in the background and the output will be redi
|
|||||||
|
|
||||||
When connecting to a remote arthas server, you may not be able to view the files of the remote machine. Arthas also supports automatic redirection to the local cache file. Examples are as follows:
|
When connecting to a remote arthas server, you may not be able to view the files of the remote machine. Arthas also supports automatic redirection to the local cache file. Examples are as follows:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
$ trace Test t >> &
|
$ trace Test t >> &
|
||||||
job id : 2
|
job id : 2
|
||||||
cache location : /Users/gehui/logs/arthas-cache/28198/2
|
cache location : /Users/gehui/logs/arthas-cache/28198/2
|
||||||
|
|||||||
@@ -28,12 +28,12 @@ Attention:
|
|||||||
|
|
||||||
Using `-b` to turn on script mode, and `-f` to run it and you can also *redirect* the output as:
|
Using `-b` to turn on script mode, and `-f` to run it and you can also *redirect* the output as:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
./as.sh -b -f /var/tmp/test.as 56328 > test.out
|
./as.sh -b -f /var/tmp/test.as 56328 > test.out
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Step-3: Check the outputs
|
#### Step-3: Check the outputs
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
cat test.out
|
cat test.out
|
||||||
```
|
```
|
||||||
@@ -19,7 +19,7 @@ It can be a great help for `ResourceNotFoundException` when you can use command
|
|||||||
|
|
||||||
* Categorised by class loader
|
* Categorised by class loader
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
$ classloader
|
$ classloader
|
||||||
name numberOfInstances loadedCountTotal
|
name numberOfInstances loadedCountTotal
|
||||||
com.taobao.pandora.service.loader.ModuleClassLoader 29 11659
|
com.taobao.pandora.service.loader.ModuleClassLoader 29 11659
|
||||||
@@ -38,7 +38,7 @@ Affect(row-cnt:11) cost in 66 ms.
|
|||||||
|
|
||||||
* Categorized by class loader instance
|
* Categorized by class loader instance
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
$ classloader -l
|
$ classloader -l
|
||||||
name loadedCount hash parent
|
name loadedCount hash parent
|
||||||
BootstrapClassLoader 3711 null null
|
BootstrapClassLoader 3711 null null
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ Affect(row-cnt:1) cost in 190 ms.
|
|||||||
|
|
||||||
De-compile the specified method:
|
De-compile the specified method:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
$ jad com.taobao.container.web.arthas.rest.MetricsController directMetrics
|
$ jad com.taobao.container.web.arthas.rest.MetricsController directMetrics
|
||||||
|
|
||||||
ClassLoader:
|
ClassLoader:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ Log command outputs for later analysis, turned off by default.
|
|||||||
|
|
||||||
To turn it on, using [options](options.md) as:
|
To turn it on, using [options](options.md) as:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
$ options save-result true
|
$ options save-result true
|
||||||
NAME BEFORE-VALUE AFTER-VALUE
|
NAME BEFORE-VALUE AFTER-VALUE
|
||||||
----------------------------------------
|
----------------------------------------
|
||||||
@@ -23,7 +23,7 @@ F.Y.I
|
|||||||
:notes: :notes:
|
:notes: :notes:
|
||||||
With the latest Arthas, you can log the outputs asynchronously in the background:
|
With the latest Arthas, you can log the outputs asynchronously in the background:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
$ trace Test t >> &
|
$ trace Test t >> &
|
||||||
job id : 2
|
job id : 2
|
||||||
cache location : /Users/zhuyong/logs/arthas-cache/28198/2
|
cache location : /Users/zhuyong/logs/arthas-cache/28198/2
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ org.apache.catalina.connector.Connector->getMaxCookieCount
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
$ sm org.apache.catalina.connector.Connector -d
|
$ sm org.apache.catalina.connector.Connector -d
|
||||||
declaring-class org.apache.catalina.connector.Connector
|
declaring-class org.apache.catalina.connector.Connector
|
||||||
constructor-name <init>
|
constructor-name <init>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Start Arthas
|
|||||||
./as.sh
|
./as.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
➜ bin git:(develop) ✗ ./as.sh
|
➜ bin git:(develop) ✗ ./as.sh
|
||||||
Found existing java process, please choose one and hit RETURN.
|
Found existing java process, please choose one and hit RETURN.
|
||||||
[1]: 3088 org.jetbrains.idea.maven.server.RemoteMavenServer
|
[1]: 3088 org.jetbrains.idea.maven.server.RemoteMavenServer
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ $ thread 1
|
|||||||
|
|
||||||
Using `-b`, we can effectively locate the threads holding locks blocking other threads resulting in a frozen system.
|
Using `-b`, we can effectively locate the threads holding locks blocking other threads resulting in a frozen system.
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
$ thread -b
|
$ thread -b
|
||||||
"http-bio-8080-exec-4" Id=27 TIMED_WAITING
|
"http-bio-8080-exec-4" Id=27 TIMED_WAITING
|
||||||
at java.lang.Thread.sleep(Native Method)
|
at java.lang.Thread.sleep(Native Method)
|
||||||
@@ -144,7 +144,7 @@ $ thread -b
|
|||||||
|
|
||||||
#### thread -i specify the collecting interval
|
#### thread -i specify the collecting interval
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
$ thread -n 3 -i 1000
|
$ thread -n 3 -i 1000
|
||||||
"as-command-execute-daemon" Id=4759 cpuUsage=23% RUNNABLE
|
"as-command-execute-daemon" Id=4759 cpuUsage=23% RUNNABLE
|
||||||
at sun.management.ThreadImpl.dumpThreads0(Native Method)
|
at sun.management.ThreadImpl.dumpThreads0(Native Method)
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ Affect(row-cnt:1) cost in 190 ms.
|
|||||||
|
|
||||||
反编译指定的方法:
|
反编译指定的方法:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
$ jad com.taobao.container.web.arthas.rest.MetricsController directMetrics
|
$ jad com.taobao.container.web.arthas.rest.MetricsController directMetrics
|
||||||
|
|
||||||
ClassLoader:
|
ClassLoader:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
* 默认情况下,该功能是关闭的,如果需要开启,请执行以下命令:
|
* 默认情况下,该功能是关闭的,如果需要开启,请执行以下命令:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
$ options save-result true
|
$ options save-result true
|
||||||
NAME BEFORE-VALUE AFTER-VALUE
|
NAME BEFORE-VALUE AFTER-VALUE
|
||||||
----------------------------------------
|
----------------------------------------
|
||||||
@@ -21,7 +21,7 @@ Affect(row-cnt:1) cost in 3 ms.
|
|||||||
|
|
||||||
### 使用新版本Arthas的异步后台任务将结果存日志文件
|
### 使用新版本Arthas的异步后台任务将结果存日志文件
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
$ trace Test t >> &
|
$ trace Test t >> &
|
||||||
job id : 2
|
job id : 2
|
||||||
cache location : /Users/zhuyong/logs/arthas-cache/28198/2
|
cache location : /Users/zhuyong/logs/arthas-cache/28198/2
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ org.apache.catalina.connector.Connector->getMaxCookieCount
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
$ sm org.apache.catalina.connector.Connector -d
|
$ sm org.apache.catalina.connector.Connector -d
|
||||||
declaring-class org.apache.catalina.connector.Connector
|
declaring-class org.apache.catalina.connector.Connector
|
||||||
constructor-name <init>
|
constructor-name <init>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
./as.sh
|
./as.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
➜ bin git:(develop) ✗ ./as.sh
|
➜ bin git:(develop) ✗ ./as.sh
|
||||||
Found existing java process, please choose one and hit RETURN.
|
Found existing java process, please choose one and hit RETURN.
|
||||||
[1]: 3088 org.jetbrains.idea.maven.server.RemoteMavenServer
|
[1]: 3088 org.jetbrains.idea.maven.server.RemoteMavenServer
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ $ thread 1
|
|||||||
|
|
||||||
有时候我们发现应用卡住了, 通常是由于某个线程拿住了某个锁, 并且其他线程都在等待这把锁造成的。 为了排查这类问题, arthas提供了`thread -b`, 一键找出那个罪魁祸首。
|
有时候我们发现应用卡住了, 通常是由于某个线程拿住了某个锁, 并且其他线程都在等待这把锁造成的。 为了排查这类问题, arthas提供了`thread -b`, 一键找出那个罪魁祸首。
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
$ thread -b
|
$ thread -b
|
||||||
"http-bio-8080-exec-4" Id=27 TIMED_WAITING
|
"http-bio-8080-exec-4" Id=27 TIMED_WAITING
|
||||||
at java.lang.Thread.sleep(Native Method)
|
at java.lang.Thread.sleep(Native Method)
|
||||||
@@ -143,7 +143,7 @@ $ thread -b
|
|||||||
|
|
||||||
#### thread -i, 指定采样时间间隔
|
#### thread -i, 指定采样时间间隔
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
$ thread -n 3 -i 1000
|
$ thread -n 3 -i 1000
|
||||||
"as-command-execute-daemon" Id=4759 cpuUsage=23% RUNNABLE
|
"as-command-execute-daemon" Id=4759 cpuUsage=23% RUNNABLE
|
||||||
at sun.management.ThreadImpl.dumpThreads0(Native Method)
|
at sun.management.ThreadImpl.dumpThreads0(Native Method)
|
||||||
|
|||||||
Reference in new issue
Block a user