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

How to deploy and install full-link distributed tracking system Apache SkyWalking

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article introduces you how to deploy and install the full-link distributed tracking system Apache SkyWalking, the content is very detailed, interested friends can refer to, hope to be helpful to you.

To ensure that there is a working Kubernetes cluster, the article defaults to using Elasticsearch7 as the back-end storage; if you want to put ES in the Kubernetes cluster, you must also ensure that the cluster is configured with the correct storage, such as the default StorageClass is available. For convenience (that is, poor) to use external ES storage and use docker-compose single-node deployment, so there is no need for cluster distributed storage; finally, make sure that your local kubectl is working properly.

Basic architecture

Skywalking is generally (inaccurate) divided into four major parts:

Oap-server: the stateless service backend, which is mainly responsible for handling the core logic, can be understood simply as a standard java web project.

Skywalking-ui: UI front end, which provides UI display such as user query through graphql connection to oap-server.

Agent: agent implemented in various languages is responsible for grabbing application running data and reporting it to oap-server, and the core indicators are reported to the source.

DB: various databases responsible for storing Skywalking indicator data. ES, TiDB and MySQL are recommended in production environment.

Deploy Skywalking3.1, deploy Elasticsearch

Elasticsearch currently uses version 7.9.2, and since it is only the first attempt and is still in the testing stage, you can start a single point of docker-compose directly:

# if necessary, you can enter the es container and use the following command to set the password # elasticsearch-setup-passwords interactiveversion: '3.8'services: elasticsearch: container_name: elasticsearch image: docker.elastic.co/elasticsearch/elasticsearch:7.9.2 restart: always network_mode: "host" volumes:-data:/data/elasticsearch environment:-http.host=172.16.11.43-http.port=9200 -transport.tcp.port=172.16.11.43-transport.tcp.port=9300-cluster.name=skyes-node.name=skyes-discovery.type=single-node-xpack.security.enabled=true-xpack.monitoring.enabled=true-ES_JAVA_OPTS=-Xms4096m-Xmx7168m volumes: data:3.2, Install Helm

Since the Kubernetes installation method officially given by Skywalking is Helm installation, it is very simple to install Helm;Helm locally first. According to the official documentation, you can directly execute the following command if there is no network problem:

Curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash

If the network is not so OK, please refer to the package manager of the official documentation to install or download binaries directly.

3.3.The clone repository initializes Helm

The Helm repository needs to be initialized according to the official documentation before Helm deployment:

# clone helm warehouse git clone https://github.com/apache/skywalking-kubernetescd skywalking-kubernetes/chart# needs to add this repo even if it uses an external ES, otherwise it will lead to dependency errors helm repo add elastic https://helm.elastic.cohelm dep up skywalking# change the release name according to your scenarioexport SKYWALKING_RELEASE_NAME=skywalking#. If the NAMESPACE is modified, subsequent deployments need to first create the NAMESPACE# change the namespace according to your scenarioexport SKYWALKING_RELEASE_NAMESPACE=default3.4 and install Skywalking through kuebctl.

After initialization of Helm, you need to adjust the configuration file by yourself. Configure oap-server to use external ES.

Values-my-es.yaml

Oap: image: tag: 8.1.-es7 # Set the right tag according to the existing Elasticsearch version storageType: elasticsearch7ui: image: tag: 8.1.elasticsearch: false config: # For users of an existing elasticsearch cluster,takes effect when `elasticsearch.enabled` is false host: 172.16.11.43 port: http: 9200 user: "elastic" password: "elastic"

After adjusting the configuration, you only need to use the Helm installation:

Helm install "${SKYWALKING_RELEASE_NAME}" skywalking-n "${SKYWALKING_RELEASE_NAMESPACE}"\-f. / skywalking/values-my-es.yaml-- set oap.image.tag=8.2.-es7-- set ui.image.tag=8.2.

If there is an installation error or other problems, you can use the following command to uninstall:

Helm uninstall "${SKYWALKING_RELEASE_NAME}" skywalking-n "${SKYWALKING_RELEASE_NAMESPACE}"

After successful installation, you should see the relevant Pod under ${SKYWALKING_RELEASE_NAMESPACE}:

K8s21 ➜~ kubectl get pod-o wide-n skywalkingNAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATESskywalking-es-init-xw6tx / 1 Completed 32h 10.30.0.62 k8s21 skywalking-oap-64c65cc6bb-lnq82 1 Running 32h 10.30.0.61 K8s21 skywalking-oap-64c65cc6bb-q7zj8 1/1 Running 32h 10.30.32.103 k8s22 skywalking-ui-695ff9d69d-wqcm8 1/1 Running 32h 10.30.161.42 k8s25

After confirming that the Pod is running properly, you can view the UI interface through the kubectl port-forward command:

# execute the following command to access 127.0.0.1 service/skywalking-ui 8080 to access skywalking-uikubectl port-forward-n ${SKYWALKING_RELEASE_NAMESPACE}

In the production environment, you may need to configure the correct Ingress or NodePort to expose the skywalking-ui service, depending on how the production cluster service is exposed. Please adjust it yourself.

Agent configuration

Since you are currently only testing on the Java project, the following Agent configuration is valid only for the Java project.

Skywalking does not require intrusive code for easy use, and for projects started by the jar package, you only need to add the-javaagent option at startup.

4.1To get Agent

Javaagent can be obtained by downloading the corresponding skywalking release installation package to extract this agent directory to any location, which will be added to the java startup parameter later.

4.2. Agent configuration

The Agent main configuration file is stored in the config/agent.config configuration file. Environment variables can be read in the configuration file, and you can add other configurations and reference other variables. Usually, there are two options for this configuration file when containerization. One is to create a ConfigMap, and then mount it to the container through ConfigMap to overwrite it. The other is to reference various variables in the default configuration and inject them through environment variables when the container starts. The method of environment variable injection is temporarily used here:

Agent.config

Deployment.yml

After the adjustment is completed, the application should be able to see the data in UI after running for a period of time

Matters needing attention

Helm-related commands are slow by default, so you may need to set http (s) _ proxy... (_ _) commands | Wall (experience this expression by yourself)

Skywalking images are generally large and slow to download. It is recommended to pull them in advance and then load them to each node.

ES if you set a password, don't forget to adjust the password configuration during Helm installation

When the jar package starts-javaagent cannot be placed after the-jar option, otherwise it may not take effect

Oap-server for intra-cluster connections is recommended to address through skywalking-oap.skywalking.svc.cluster.local domain name service discovery.

On how to deploy and install the full-link distributed tracking system Apache SkyWalking is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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

Development

Wechat

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

12
Report