mirror of https://github.com/alibaba/arthas.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
15 KiB
JavaScript
48 lines
15 KiB
JavaScript
import{_ as l,a as c,b as d}from"./tunnel-server-agents.03d5eafa.js";import{_ as p,o as h,c as u,a as e,b as a,w as r,e as n,d as t,r as i}from"./app.5024572d.js";const m={},v=e("h1",{id:"arthas-tunnel",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#arthas-tunnel","aria-hidden":"true"},"#"),n(" Arthas Tunnel")],-1),b=e("p",null,"Manage/connect multiple Agents remotely via Arthas Tunnel Server/Client.",-1),g=e("p",null,"For example, in streaming computing, Java processes can be started on different machines, and it can be difficult to use Arthas to diagnose them, because the user usually does not have access to the machine.",-1),_=e("p",null,"In this case, Arthas Tunnel Server/Client can be used.",-1),f=e("p",null,"Reference:",-1),k=n("1: "),w=n("Web Console"),y=n("2: "),x=n("Arthas Spring Boot Starter"),I=e("h2",{id:"download-and-deploy-arthas-tunnel-server",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#download-and-deploy-arthas-tunnel-server","aria-hidden":"true"},"#"),n(" Download and deploy arthas tunnel server")],-1),A={href:"https://github.com/alibaba/arthas/releases",target:"_blank",rel:"noopener noreferrer"},N=n("https://github.com/alibaba/arthas/releases"),T=t(`<p>Arthas tunnel server is a spring boot fat jar application, start with the <code>java -jar</code> command:</p><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code><span class="token function">java</span> <span class="token parameter variable">-jar</span> arthas-tunnel-server.jar
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>By default, the web port of the arthas tunnel server is <code>8080</code>, and the port connected by the arthas agent is <code>7777</code>.</p>`,3),R=n("Once started, you can go to "),E={href:"http://127.0.0.1:8080/",target:"_blank",rel:"noopener noreferrer"},S=n("http://127.0.0.1:8080/"),L=n(" and connect to the registered arthas agent via "),B=e("code",null,"agentId",-1),P=n("."),C=n("Through Spring Boot's Endpoint, you can view the specific connection information: "),V={href:"http://127.0.0.1:8080/actuator/arthas",target:"_blank",rel:"noopener noreferrer"},j=n("http://127.0.0.1:8080/actuator/arthas"),D=n(", the login user name is "),O=e("code",null,"arthas",-1),M=n(", and the password can be found in the log of arthas tunnel server, for example:"),U=t(`<div class="language-text ext-text line-numbers-mode"><pre class="language-text"><code>32851 [main] INFO o.s.b.a.s.s.UserDetailsServiceAutoConfiguration
|
|
|
|
Using generated security password: f1dca050-3777-48f4-a577-6367e55a78a2
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="connecting-to-the-tunnel-server-when-starting-arthas" tabindex="-1"><a class="header-anchor" href="#connecting-to-the-tunnel-server-when-starting-arthas" aria-hidden="true">#</a> Connecting to the tunnel server when starting arthas</h2><p>When starting arthas, you can use the <code>--tunnel-server</code> parameter, for example:</p><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code>as.sh --tunnel-server <span class="token string">'ws://127.0.0.1:7777/ws'</span>
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>You can also use the following test address (not guaranteed to be available all the time):</p><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code>as.sh --tunnel-server <span class="token string">'ws://47.75.156.201:80/ws'</span>
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><ul><li>You can specify the agentId by the <code>--agent-id</code> parameter. By default, a random ID is generated.</li></ul><p>After Arthas attach succeeds, the agentId will be printed, such as:</p><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code> ,---. ,------. ,--------.,--. ,--. ,---. ,---.
|
|
/ O <span class="token punctuation">\\</span> <span class="token operator">|</span> .--. <span class="token string">''</span>--. .--<span class="token string">'| '</span>--<span class="token string">' | / O \\ '</span> .-<span class="token string">'
|
|
| .-. || '</span>--<span class="token string">'.'</span> <span class="token operator">|</span> <span class="token operator">|</span> <span class="token operator">|</span> .--. <span class="token operator">||</span> .-. <span class="token operator">|</span><span class="token variable"><span class="token variable">\`</span><span class="token builtin class-name">.</span> <span class="token variable">\`</span></span>-.
|
|
<span class="token operator">|</span> <span class="token operator">|</span> <span class="token operator">|</span> <span class="token operator">||</span> <span class="token operator">|</span><span class="token punctuation">\\</span> <span class="token punctuation">\\</span> <span class="token operator">|</span> <span class="token operator">|</span> <span class="token operator">|</span> <span class="token operator">|</span> <span class="token operator">|</span> <span class="token operator">||</span> <span class="token operator">|</span> <span class="token operator">|</span> <span class="token operator">|</span>.-<span class="token string">' |
|
|
\`--'</span> <span class="token variable"><span class="token variable">\`</span>--'<span class="token variable">\`</span></span>--<span class="token string">' '</span>--<span class="token string">' \`--'</span> <span class="token variable"><span class="token variable">\`</span>--' <span class="token variable">\`</span></span>--<span class="token string">'\`--'</span> <span class="token variable"><span class="token variable">\`</span>--'<span class="token variable">\`</span></span>-----'
|
|
|
|
|
|
wiki https://arthas.aliyun.com/doc
|
|
tutorials https://arthas.aliyun.com/doc/arthas-tutorials.html
|
|
version <span class="token number">3.1</span>.2
|
|
pid <span class="token number">86183</span>
|
|
<span class="token function">time</span> <span class="token number">2019</span>-08-30 <span class="token number">15</span>:40:53
|
|
<span class="token function">id</span> URJZ5L48RPBR2ALI5K4V
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>If the connection is not connected to the tunnel server at startup, you can also obtain the agentId through the <code>session</code> command after reconnection succeeds:</p><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code><span class="token punctuation">[</span>arthas@86183<span class="token punctuation">]</span>$ session
|
|
Name Value
|
|
-----------------------------------------------------
|
|
JAVA_PID <span class="token number">86183</span>
|
|
SESSION_ID f7273eb5-e7b0-4a00-bc5b-3fe55d741882
|
|
AGENT_ID URJZ5L48RPBR2ALI5K4V
|
|
TUNNEL_SERVER ws://47.75.156.201:80/ws
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div>`,11),J=n("For the above example, go to "),F={href:"http://47.75.156.201/arthas/?port=80",target:"_blank",rel:"noopener noreferrer"},G=n("http://47.75.156.201/arthas/?port=80"),Y=n(" in the browser and input the "),Z=e("code",null,"agentId",-1),K=n(" to connect to arthas on remote machine."),W=t('<p><img src="'+c+'" alt=""></p><h2 id="best-practices" tabindex="-1"><a class="header-anchor" href="#best-practices" aria-hidden="true">#</a> Best practices</h2><div class="custom-container warning"><p class="custom-container-title">WARNING</p><p>Note that the agentId must be unique, otherwise it will conflict on the tunnel server and not work properly.</p></div><p>If the arthas agent is configured with <code>appName</code>, the generated agentId will be prefixed with <code>appName</code>.</p><p>For example, if you add the startup parameter <code>as.sh --tunnel-server 'ws://127.0.0.1:7777/ws' --app-name demoapp</code>, the generated agentId might be <code>demoapp_URJZ5L48RPBR2ALI5K4V</code>.</p><p>Tunnel server will use <code>_</code> as a delimiter to extract <code>appName</code>, which is convenient to manage by application.</p><div class="custom-container tip"><p class="custom-container-title">TIP</p><p>Alternatively, you can configure <code>appName</code> in <code>arthas.properties</code> in the unzipped arthas directory, or in <code>application.properties</code> of the spring boot application.</p></div><h2 id="tunnel-server-management-page" tabindex="-1"><a class="header-anchor" href="#tunnel-server-management-page" aria-hidden="true">#</a> Tunnel Server Management Page</h2>',8),$={class:"custom-container tip"},q=e("p",{class:"custom-container-title"},"TIP",-1),z=e("p",null,[n("You need to configure "),e("code",null,"arthas.enable-detail-pages=true"),n(" in "),e("code",null,"application.properties"),n(" of tunnel-server, or you can specify it with command line parameters: "),e("code",null,"java -Darthas.enable-detail-pages=true -jar arthas-tunnel-server.jar")],-1),H=n("Supported configuration: "),Q={href:"https://github.com/alibaba/arthas/blob/master/tunnel-server/src/main/resources/application.properties",target:"_blank",rel:"noopener noreferrer"},X=n("tunnel-server application.properties"),ee=e("p",null,"**Attention, opening the management page is risky! The management page is not authenticated, so you must add security measures yourself, and do not open it to the public network. **",-1),ne=t(`<p>Start the tunnel-server locally, then use <code>as.sh</code> attach, and specify the application name <code>--app-name test</code>:</p><div class="language-text ext-text line-numbers-mode"><pre class="language-text"><code>$ as.sh --tunnel-server 'ws://127.0.0.1:7777/ws' --app-name test
|
|
telnet connecting to arthas server... current timestamp is 1627539688
|
|
Trying 127.0.0.1...
|
|
Connected to 127.0.0.1.
|
|
Escape character is '^]'.
|
|
,---. ,------. ,--------.,--. ,--. ,---. ,---.
|
|
/ O \\ | .--. ''--. .--'| '--' | / O \\ ' .-'
|
|
| .-. || '--'.' | | | .--. || .-. |\`. \`-.
|
|
| | | || |\\ \\ | | | | | || | | |.-' |
|
|
\`--' \`--'\`--' '--' \`--' \`--' \`--'\`--' \`--'\`-----'
|
|
|
|
|
|
wiki https://arthas.aliyun.com/doc
|
|
tutorials https://arthas.aliyun.com/doc/arthas-tutorials.html
|
|
version 3.5.3
|
|
main_class demo.MathGame
|
|
pid 65825
|
|
time 2021-07-29 14:21:29
|
|
id test_PE3LZO9NA9ENJYTPGL9L
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>Then visit tunnel-server, you can see a list of all connected applications:</p>`,3),ae={href:"http://localhost:8080/apps.html",target:"_blank",rel:"noopener noreferrer"},se=n("http://localhost:8080/apps.html"),te=e("p",null,[e("img",{src:l,alt:""})],-1),oe=e("p",null,"Then open the details, you can see a list of all connected agents:",-1),re={href:"http://localhost:8080/agents.html?app=test",target:"_blank",rel:"noopener noreferrer"},ie=n("http://localhost:8080/agents.html?app=test"),le=t('<p><img src="'+d+`" alt=""></p><h2 id="security-and-privilege-management" tabindex="-1"><a class="header-anchor" href="#security-and-privilege-management" aria-hidden="true">#</a> Security and Privilege Management</h2><div class="custom-container tip"><p class="custom-container-title">TIP</p><p><strong>It is strongly recommended not to expose the tunnel server directly to the public network.</strong></p></div><p>Currently tunnel server does not have special permission management</p><ol><li>Users need to develop by themselves and authenticate the app name.</li><li>If the management page is opened, security measures need to be added.</li></ol><h2 id="cluster-management" tabindex="-1"><a class="header-anchor" href="#cluster-management" aria-hidden="true">#</a> Cluster Management</h2><p>If you want to deploy multiple tunnel servers, you can use nginx for forwarding and redis to store agent information.</p><p>Nginx needs to configure sticky session to ensure that the user's web socket is connected to the same back-end tunnel server. The simple configuration method is to use <code>ip_hash</code>.</p><h2 id="how-arthas-tunnel-server-works" tabindex="-1"><a class="header-anchor" href="#how-arthas-tunnel-server-works" aria-hidden="true">#</a> How arthas tunnel server works</h2><div class="language-text ext-text line-numbers-mode"><pre class="language-text"><code>browser <-> arthas tunnel server <-> arthas tunnel client <-> arthas agent
|
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div>`,10),ce={href:"https://github.com/alibaba/arthas/blob/master/tunnel-server/README.md#",target:"_blank",rel:"noopener noreferrer"},de=n("tunnel-server/README.md");function pe(he,ue){const o=i("RouterLink"),s=i("ExternalLinkIcon");return h(),u("div",null,[v,b,g,_,f,e("ul",null,[e("li",null,[k,a(o,{to:"/en/doc/web-console.html"},{default:r(()=>[w]),_:1})]),e("li",null,[y,a(o,{to:"/en/doc/spring-boot-starter.html"},{default:r(()=>[x]),_:1})])]),I,e("p",null,[e("a",A,[N,a(s)])]),T,e("p",null,[R,e("a",E,[S,a(s)]),L,B,P]),e("p",null,[C,e("a",V,[j,a(s)]),D,O,M]),U,e("p",null,[J,e("a",F,[G,a(s)]),Y,Z,K]),W,e("div",$,[q,z,e("p",null,[H,e("a",Q,[X,a(s)])]),ee]),ne,e("p",null,[e("a",ae,[se,a(s)])]),te,oe,e("p",null,[e("a",re,[ie,a(s)])]),le,e("p",null,[e("a",ce,[de,a(s)])])])}const be=p(m,[["render",pe],["__file","tunnel.html.vue"]]);export{be as default};
|