<liclass="toctree-l2"><aclass="reference internal"href="#download-and-deploy-arthas-tunnel-server">Download and deploy arthas tunnel server</a></li>
<liclass="toctree-l2"><aclass="reference internal"href="#connecting-to-the-tunnel-server-when-starting-arthas">Connecting to the tunnel server when starting arthas</a></li>
<liclass="toctree-l1"><aclass="reference external"href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md#">Compile and debug/CONTRIBUTING</a></li>
<h1>Arthas Tunnel<aclass="headerlink"href="#arthas-tunnel"title="Permalink to this headline">¶</a></h1>
<p>Manage/connect multiple Agents remotely via Arthas Tunnel Server/Client.</p>
<p>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.</p>
<p>In this case, Arthas Tunnel Server/Client can be used.</p>
<h2>Download and deploy arthas tunnel server<aclass="headerlink"href="#download-and-deploy-arthas-tunnel-server"title="Permalink to this headline">¶</a></h2>
<p>Arthas tunnel server is a spring boot fat jar application, start with the <codeclass="docutils literal notranslate"><spanclass="pre">java</span><spanclass="pre">-jar</span></code> command:</p>
<p>By default, the web port of the arthas tunnel server is <codeclass="docutils literal notranslate"><spanclass="pre">8080</span></code>, and the port connected by the arthas agent is <codeclass="docutils literal notranslate"><spanclass="pre">7777</span></code>.</p>
<p>Once started, you can go to <aclass="reference external"href="http://127.0.0.1:8080/">http://127.0.0.1:8080/</a> and connect to the registered arthas agent via <codeclass="docutils literal notranslate"><spanclass="pre">agentId</span></code>.</p>
<p>Through Spring Boot’s Endpoint, you can view the specific connection information: <aclass="reference external"href="http://127.0.0.1:8080/actuator/arthas">http://127.0.0.1:8080/actuator/arthas</a>, the login user name is <codeclass="docutils literal notranslate"><spanclass="pre">arthas</span></code>, and the password can be found in the log of arthas tunnel server, for example:</p>
<divclass="highlight-default notranslate"><preclass="literal-block">32851 [main] INFO o.s.b.a.s.s.UserDetailsServiceAutoConfiguration
Using generated security password: f1dca050-3777-48f4-a577-6367e55a78a2</pre>
<h2>Connecting to the tunnel server when starting arthas<aclass="headerlink"href="#connecting-to-the-tunnel-server-when-starting-arthas"title="Permalink to this headline">¶</a></h2>
<p>When starting arthas, you can use the <codeclass="docutils literal notranslate"><spanclass="pre">--tunnel-server</span></code> parameter, for example:</p>
<li><p>You can specify the agentId by the <codeclass="docutils literal notranslate"><spanclass="pre">--agent-id</span></code> parameter. By default, a random ID is generated.</p></li>
</ul>
<p>After Arthas attach succeeds, the agentId will be printed, such as:</p>
<p>If the connection is not connected to the tunnel server at startup, you can also obtain the agentId through the <codeclass="docutils literal notranslate"><spanclass="pre">session</span></code> command after reconnection succeeds:</p>
<p>For the above example, go to <aclass="reference external"href="http://47.75.156.201/arthas/?port=80">http://47.75.156.201/arthas/?port=80</a> in the browser and input the <codeclass="docutils literal notranslate"><spanclass="pre">agentId</span></code> to connect to arthas on remote machine.</p>
<h2>Best practices<aclass="headerlink"href="#best-practices"title="Permalink to this headline">¶</a></h2>
<p>If the arthas agent is configured with <codeclass="docutils literal notranslate"><spanclass="pre">appName</span></code>, the generated agentId will be prefixed with <codeclass="docutils literal notranslate"><spanclass="pre">appName</span></code>.</p>
<p>For example, if you add the startup parameter <codeclass="docutils literal notranslate"><spanclass="pre">as.sh</span><spanclass="pre">--tunnel-server</span><spanclass="pre">'ws://127.0.0.1:7777/ws'</span><spanclass="pre">--app-name</span><spanclass="pre">demoapp</span></code>, the generated agentId might be <codeclass="docutils literal notranslate"><spanclass="pre">demoapp_URJZ5L48RPBR2ALI5K4V</span></code>.</p>
<p>Tunnel server will use <codeclass="docutils literal notranslate"><spanclass="pre">_</span></code> as a delimiter to extract <codeclass="docutils literal notranslate"><spanclass="pre">appName</span></code>, which is convenient to manage by application.</p>
<blockquote>
<div><p>Alternatively, you can configure <codeclass="docutils literal notranslate"><spanclass="pre">appName</span></code> in <codeclass="docutils literal notranslate"><spanclass="pre">arthas.properties</span></code> in the unzipped arthas directory, or in <codeclass="docutils literal notranslate"><spanclass="pre">application.properties</span></code> of the spring boot application.</p>
</div></blockquote>
</div>
<divclass="section"id="cluster-management">
<h2>Cluster Management<aclass="headerlink"href="#cluster-management"title="Permalink to this headline">¶</a></h2>
<p>If you want to deploy multiple tunnel servers, you can use nginx for forwarding and redis to store agent information.</p>
Built with <ahref="http://sphinx-doc.org/">Sphinx</a> using a <ahref="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <ahref="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<scripttype="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
<divclass="github-fork-ribbon-wrapper right">
<divclass="github-fork-ribbon">
<ahref="https://github.com/alibaba/arthas"target="_blank">Fork me at GitHub</a>