Springboot skywalking distributed link tracking environment preparation

Posted by staggman on Fri, 26 Nov 2021 12:23:57 +0100

"You have done a good job. I put this sentence here. When you need courage, please whisper it to yourself for me."

1, Overview  

skywalking is an excellent domestic open source framework, which was opened by Wu Sheng (Huawei developer) in 2015,   Joined Apache incubator in 2017. In just two years, it has been under the command of Apache, and its strength can be seen.

skywalking supports dubbo, SpringCloud and SpringBoot integration. The code is non intrusive. The communication mode adopts GRPC. The performance is good. The implementation mode is java probe. It supports alarm, JVM monitoring, global call statistics and so on.

skywalking is started through jar package. You need to download the jar package. Here, a certain uses docker for deployment;

To have a window version: Since SkyWalking, sleeping is so sweet!

Address: https://skywalking.apache.org/downloads/

Skywalking architecture  

The above architecture diagram is mainly divided into four parts, as follows:

  • The above Agent is responsible for collecting log data and passing it to the intermediate OAP server

  • OAP in the middle: it is responsible for receiving the tracking and Metric data information sent by the Agent, then analyzing (Analysis Core), storing it in the external Storage, and finally providing the Query function.

  • The UI on the left is responsible for providing a web console, viewing links, viewing various indicators, performance, etc.

  • Right Storage: it is responsible for data Storage and supports multiple Storage types.

After reading the architecture diagram, the idea is very clear. The Agent is responsible for collecting log transmission data, transmitting it to OAP through GRPC for analysis and storing it in the database. Finally, the analyzed statistical report, service dependency and topology diagram are displayed through the UI interface.

2, Environment construction (Docker)

1.Elasticsearch installation

① Pull image

docker search elasticsearch

docker pull elasticsearch:7.5.1

② Start container

docker run -d --name=es7 \
-p 13392:9200 -p 13393:9300  \
-e "discovery.type=single-node" elasticsearch:7.5.1

-- Copy the data coupon and restart
docker cp es7:/usr/share/elasticsearch/data /home/elasticsearch7/
docker cp es7:/usr/share/elasticsearch/logs /home/elasticsearch7/
docker rm -f es7
mkdir -p /home/elasticsearch7/

-- Restart
docker run -d --name=es7 --restart=always   \
-p 13392:9200 -p 13393:9300   \
-e "discovery.type=single-node"   \
-e ES_JAVA_OPTS="-Xms512m -Xmx512m"   \
-v /home/elasticsearch7/data:/usr/share/elasticsearch/data    \
-v /home/elasticsearch7/logs:/usr/share/elasticsearch/logs  elasticsearch:7.5.1

③ Access verification

http://IP:13392

2. Install skywalking (server)

① Pull image

docker search skywalking-oap-server 

docker pull apache/skywalking-oap-server:6.6.0-es7

② Start container

  There are two data storage methods on the server. One is the default H2 storage, that is, the data is stored in memory, and the other is stored using elastic search

Default H2 storage startup

 docker run --name skywalking -d \
 -p 13350:1234 -p 13351:11800 -p 13352:12800  \
 --restart always apache/skywalking-oap-server:6.6.0-es7 

  Using elasticsearch to store startup

docker run --name skywalking-oap-server  \
--restart always -d --restart=always   \
-e TZ=Asia/Shanghai  -p 13352:12800  -p 13351:11800  \
--link es7:es7 -e SW_STORAGE=elasticsearch  \
-e SW_STORAGE_ES_CLUSTER_NODES=IP:13392 \
apache/skywalking-oap-server:6.6.0-es7

--Also
-e SW_STORAGE_ES_CLUSTER_NODES=es7:13392 \

  3. Install skywalking UI (Management Interface)

① Pull image

docker search apache/skywalking-ui

docker pull apache/skywalking-ui:6.6.0

② Start container

docker run -d --name skywalking-ui   \
--restart=always  -e TZ=Asia/Shanghai   \
-p 13358:8080  --link skywalking-oap-server:skywalking-oap-server \
-e SW_OAP_ADDRESS=IP:13352  apache/skywalking-ui:6.6.0   \
--security.user.admin.password=admin

-- Also
-e SW_OAP_ADDRESS=skywalking-oap-server:13352 

③ Visit

http://IP:13358/trace

  Note: when downloading the source package, agent will be used in the project

https://archive.apache.org/dist/skywalking/6.6.0/apache-skywalking-apm-6.6.0.tar.gz

Join VM when project starts

-javaagent:Download file address\apache-skywalking-apm-es7-8.7.0\apache-skywalking-apm-bin-es7\agent\skywalking-agent.jar
-Dskywalking.agent.service_name=skywalking-product-service
-Dskywalking.collector.backend_service=IP:13351 -- Deployed skywalking Server address

It doesn't matter. Everyone will make a wrong choice, shed tears inexplicably, and suddenly collapse on the road, but it doesn't affect us to see the sunset glow and fall in love with the world again.

Topics: Docker skywalking