Manage/connect multiple Agents remotely via Arthas Tunnel Server/Client.
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.
In this case, Arthas Tunnel Server/Client can be used.
Arthas tunnel server is a spring boot fat jar application, start with the `java -jar` command:
```bash
java -jar arthas-tunnel-server.jar
```
By default, the web port of the arthas tunnel server is `8080`, and the port connected by the arthas agent is `7777`.
Once started, you can go to [http://127.0.0.1:8080/](http://127.0.0.1:8080/) and connect to the registered arthas agent via `agentId`.
Through Spring Boot's Endpoint, you can view the specific connection information: [http://127.0.0.1:8080/actuator/arthas](http://127.0.0.1:8080/actuator/arthas), the login user name is `arthas`, and the password can be found in the log of arthas tunnel server, for example:
```
32851 [main] INFO o.s.b.a.s.s.UserDetailsServiceAutoConfiguration
Using generated security password: f1dca050-3777-48f4-a577-6367e55a78a2
If the connection is not connected to the tunnel server at startup, you can also obtain the agentId through the `session` command after reconnection succeeds:
For the above example, go to [http://47.75.156.201/arthas/?port=80](http://47.75.156.201/arthas/?port=80) in the browser and input the `agentId` to connect to arthas on remote machine.
If the arthas agent is configured with `appName`, the generated agentId will be prefixed with `appName`.
For example, if you add the startup parameter `as.sh --tunnel-server 'ws://127.0.0.1:7777/ws' --app-name demoapp`, the generated agentId might be `demoapp_URJZ5L48RPBR2ALI5K4V`.
Tunnel server will use `_` as a delimiter to extract `appName`, which is convenient to manage by application.
Alternatively, you can configure `appName` in `arthas.properties` in the unzipped arthas directory, or in `application.properties` of the spring boot application.
You need to configure `arthas.enable-detail-pages=true` in `application.properties` of tunnel-server, or you can specify it with command line parameters: `java -Darthas.enable-detail-pages=true -jar arthas-tunnel-server.jar`
**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. **
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 `ip_hash`.