Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the various methods used by Arthas?

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

Arthas uses all kinds of ways, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Arthas is Alibaba's open source Java diagnostic tool. Allows us to troubleshoot problems with the project online. In addition to knowing that it exists, we also need to know how to install and use it in order to improve the efficiency of our daily development to solve BUG.

Scheme introduction scenario 1: local direct operation

Often the simplest method is actually the most effective, it itself is a runnable program, so we can run it directly.

We can download the corresponding jar directly through the official website, then run it and then jar it to execute the corresponding command.

The command is as follows:

Java-jar arthas-boot.jar [option]

The demonstration is as follows:

Scheme 2: Web Console implementation

We can not execute the program every time we enter the ssh, we can also access the program through web. Through the introduction of arthas's Web Console on the official website, you can understand the general idea of building.

By downloading arthas-tunnel-server. We can get the server side of the corresponding arthas. Just run it directly after the download (I run it directly on ECS).

Start arthas-boot at the corresponding client. And append the address of the server by the startup parameter (I run it locally).

Select the corresponding process to attach, and the corresponding agent-id will appear, and then enter it into the corresponding server http page.

Finally, we can operate on the server side, that is, the Web Console implementation is completed.

Option 3: project dependence

Projects built based on Spring directly add dependencies (corresponding environment support is required, for example, tools.jar cannot be missing).

The SpringBoot project depends on:

Com.taobao.arthas arthas-spring-boot-starter ${arthas.version}

Non-SpringBoot project dependencies:

Com.taobao.arthas arthas-agent-attach ${arthas.version} com.taobao.arthas arthas-packaging ${arthas.version}

After the local project is started, you can directly access:

Http://127.0.0.1:3658/

Of course, you can also combine the Web Console introduced above. For example, add the corresponding configuration information to the configuration file:

Arthas.agent-id=qwejqjnnnunnqarthas.tunnel-server=ws://server address: 7777/ws

The demonstration is as follows:

The above step is to start tunnel-server first, and then locally configure to connect to tunnel-server. Then enter the configured Id to complete the corresponding debugging.

Scenario 4: container configuration

Based on docker configuration, there are not a few enterprises that use CCS at present. It is also applicable to container services. The ADD operation is performed after downloading the jar, or each time you build the Dockerfile, an image file containing the arthas is generated.

Here's how to build through Dockerfile:

FROM openjdk:8-jdk-alpineADD target/*.jar app.jar# copy arthasCOPY-- from=hengyunabc/arthas:latest / opt/arthas / opt/arthasRUN apk add-- no-cache tiniENTRYPOINT ["/ sbin/tini", "-"] CMD ["java", "- Djava.security.egd=file:/dev/./urandom", "- jar", "/ app.jar"] MAINTAINER Montos 1367654518@qq.com

The above is done by building a Dockerfile. Here, the image file is pasted directly. Here, the files in the current arthas are copied into the corresponding container, and then we can execute them through exec-it. The steps are similar to method 1.

Summary

Through the above introduction, in fact, I recommend using Web access method is better, for the following reasons:

When the service is deployed directly on the server or on the ECS CVM. We can run it directly on the corresponding client side, but how do we get to the server where each service is located? Through the springboard? Then it is not possible for us to have an impact on the server when we operate, and it is definitely not possible to connect directly to the server.

The service is in the case of the pod it is running. At this point, the impact of allowing you to connect to the service is much smaller than the situation above, and if it does, it only affects the currently running pod. But if you want to connect to pod directly, you need to map the corresponding pod port to the corresponding host, and then provide an external link to ecs. This will make the ports that need to be mapped out of each pod require certain rules, which undoubtedly increases the work of operation and maintenance, and consumes the current resources (if you visit the page, etc., use the http API to request, if you connect through ws, reduce the consumption of layer 7).

If we use the above method, then we can run server on another machine. Every time we visit server, we can connect to the corresponding client end, and the corresponding agent-id can be specified. We can specify the current agent-id every time pod runs client, so that we can bind it to the current pod, so that we can connect through server.

Of course, the above views see benevolence and wisdom. The above describes several deployments and ways to run arthas. Enterprises can choose the appropriate deployment according to the current project architecture. Why do you need it? Because it can help developers solve problems, there is no need to send the version back and forth!

Welcome to the start.aliyun.com Action hand Lab to experience the 57 hands-on experiments of Arthas: https://start.aliyun.com/handson-lab/#!category=arthas

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report