[Docker] Docker+Zipkin+Elasticsearch+Kibana deploys distributed link tracking


点击跳转:Docker安装MySQL、Redis、RabbitMQ、Elasticsearch、Nacos等常见服务全套(质量有保证,内容详情)

This article mainly discusses the premise of continuing to integrate Zipkin on the premise that the appropriate versions of Elasticsearch and Kibana are installed.

1. Component introduction

Generally, their working process is as follows: Spring Cloud microservice sends the log of the call link to Zipkin, Zipkin sends the data to Elasticsearch for saving, and Kibana graphically displays the Elasticsearch data.

Both Zipkin and Elaticsearch can be used independently, but Zipkin saves data in memory, and the data disappears after restarting, so it is usually paired with Elasticsearch to save the data in Elasticsearch. Kibana is a visualization platform and must be paired with Elaticsearch.

For separate installation, please refer to Installing Elaticsearch Separately by Docker and Installing Zipkin Separately by Docker .

  • **Elasticsearch: **Elaticsearch, referred to as es for short, es is an open source, highly scalable distributed full-text search engine, which can store and retrieve data in near real time; it has good scalability and can be extended to hundreds of servers. Process petabytes of data. es is also developed in Java and uses Lucene as its core to implement all indexing and search functions, but its purpose is to hide the complexity of Lucene through a simple RESTful API, thus making full-text search easy.
  • Kibana: Kibana is a data visualization and management tool for Elasticsearch that provides real-time histograms, line charts, pie charts, and maps. Supports user security permission system and plug-ins of various dimensions, usually used together with Elasticsearch and Logstash.
  • **Zipkin:**Zipkin is an open source project from Twitter that can be used to obtain and analyze the request link tracking logs generated in Spring Cloud Sleuth. It provides a web interface to help us visually view the request link tracking information. Call link tracking of commonly used microservices.

2. Service Integration

2.1. Prerequisite: Install Elaticsearch and Kibana

After installing Elaticsearch and Kibana, integrate Zipkin. Install Elasticsearch and Kibana under Docker, Docker installs Kibana service

  • Install and start Elasticsearch
# 
docker run -p 9200:9200 -p 9300:9300 --name elasticsearch \
-e "discovery.type=single-node" \
-e "cluster.name=elasticsearch" \
-e "ES_JAVA_OPTS=-Xms512m -Xmx1024m" \
-d "docker.elastic.co/elasticsearch/elasticsearch:6.6.2"
  • Install and start Kibana
# 
docker run -d --name kibana -p 5601:5601 \
--link elasticsearch:elasticsearch \
kibana:6.6.2

2.2. Reintegrating Zipkin

The version requirements of Elasticsearch and Kibana are the same, but there are no requirements for Zipkin version. After installing and starting Elasticsearch and Kibana, continue integrating Zipkin. The following takes Elasticsearch 6.6.2, Kibana 6.6.2, and Zipkin as examples to integrate:

  • Docker starts Zipkin to connect to Elasticsearch, as follows:
docker run -d --name zipkin -p 9411:9411 \
-e STORAGE_TYPE=elasticsearch \
-e ES_HOSTS=http://192.168.1.6:9200 \
openzipkin/zipkin

Note: fill in the ip address of your own host ip address

  • View Zipkin's log
docker logs -f zipkin
  • Zipkin page access address: http://localhost:9411, click to query a few times

  • If there is zipkin in the Elasticsearch log, there is basically no problem.
docker logs -f elasticsearch

  • After everything is installed, the next startup sequence is required. Elasticsearch must be started first, as follows:
docker start elasticsearch
docker start zipkin
docker start kibana
  • If a distributed call between microservices occurs, you can also see the log information of the call link through Kibana, as shown in the following figure:

Guess you like

Origin blog.csdn.net/yuchangyuan5237/article/details/132053737