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 install and use the link tracking tool Zipkin

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article will explain in detail how to install and use the link tracking tool Zipkin. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Preface

Zipkin is an open source distributed tracking system. Each service reports timing data to zipkin, and zipkin generates a dependency graph through Zipkin UI according to the invocation relationship.

Zipkin provides pluggable data storage: In-Memory, MySql, Cassandra and Elasticsearch. In order to facilitate the storage of In-Memory in the development environment, Elasticsearch is recommended when there is a large amount of production data.

Basic operation

Zipkin is a distributed tracking system. It helps to collect the timing data needed to solve latency problems in the service architecture. Functions include the collection and lookup of this data.

If there is a trace ID in the log file, you can jump directly to the trace ID. Otherwise, you can query based on attributes, such as service, operation name, label, and duration. Some interesting data will be summarized for you, such as the percentage of time spent in the service and whether the operation failed.

Zipkin UI also provides a dependency diagram that shows how many requests are tracked in each application. This may be helpful in identifying summary behavior, including incorrect paths or calls to services that are not approved of use.

Build a zipkin server

There are three ways to build zipkin services. Docker container is recommended, jar installation and source code package installation.

Install and run using the docker container

Docker run-d-p 9411 openzipkin/zipkin# or add es storage environment docker run-d-p 9411 docker run 9411\-env STORAGE_TYPE=elasticsearch\-- env ES_HOSTS= http://192.168.0.100:9200\ openzipkin/zipkin

Using ElasticSearch for storage, the log data will be stored in memory by default, and will be emptied once the service is restarted. It is recommended to use es for persistent storage. The startup example parameters are as follows:

STORAGE_TYPE=elasticsearch ES_HOSTS= http://192.168.0.100:9200

There are also some other configurable parameters

* `ES_ HOSTS`: A comma separated list of elasticsearch base urls to connect to ex. Http://host:9200. Defaults to "http://localhost:9200".* `ES_ PIPELINE`: Only valid when the destination is Elasticsearch 5. Indicates the ingest pipeline used before spans are indexed. No default.* `ES_ TimEOUT`: Controls the connect, read and write socket timeouts (in milliseconds) for Elasticsearch Api. Defaults to 10000 (10 seconds) * `ES_MAX_ requests: Only valid when the transport is http. Sets maximum in-flight requests from this process to any Elasticsearch host. Defaults to 64. * `ES_ index: The index prefix to use when generating daily index names. Defaults to zipkin.* `ES_DATE_ SEPARATOR`: The date separator to use when generating daily index names. Defaults to'-'. * `ES_INDEX_ shares: The number of shards to split the index into. Each shard and its replicas are assigned to a machine in the cluster. Increasing the number of shards and machines in the cluster will improve read and write performance. Number of shards cannot be changed for existing indices, but new daily indices will pick up changes to the setting. Defaults to 5.* `ES_INDEX_ REPLICAS`: The number of replica copies of each shard in the index. Each shard and its replicas are assigned to a machine in the cluster. Increasing the number of replicas and machines in the cluster will improve read performance, but not write performance. Number of replicas can be changed for existing indices. Defaults to 1. It is highly discouraged to set this to 0 as it would mean a machine failure results in data loss.* `ES_ USERNAME` and `ES_ PASSWORD`: Elasticsearch basic authentication, which defaults to empty string. Use when X-Pack security (formerly Shield) is in place.* `ES_HTTP_ LOGING`: When set, controls the volume of HTTP logging of the Elasticsearch Api. Options are BASIC, HEADERS, BODY

By default, the monitoring page of zipkin can be accessed through port 9411 after the service is started.

Http://localhost:9411/zipkin/

Note: zipkin creates an index in es that ends with a date beginning with zipkin, and it is split by default in days. When using this storage mode, the dependency information in zipkin cannot be displayed and needs to be calculated through the zipkin-dependencies toolkit.

Run using jar

If you have Java 8 or later installed, the quickest way to install is to get the latest version in a separate executable jar:

Curl-sSL https://zipkin.io/quickstart.sh | bash-sjava-jar zipkin.jar

Install and run using source code

If you are developing new functionality, you can run Zipkin from the source code. To do this, you need to get the source code for Zipkin and build it.

# get the latest source git address, git clone https://github.com/openzipkin/zipkincd zipkin# mvn, compile and package. / mvnw-DskipTests-- also-make-pl zipkin-server clean install# jar package run java-jar. / zipkin-server/target/zipkin-server-*exec.jarzipkin-dependencies to generate dependency chain

Zipkin-dependencies generates a global call chain based on spark job. Download address: https://github.com/openzipkin/zipkin-dependencies

STORAGE_TYPE=elasticsearch ES_HOSTS=127.0.0.1:9200 java-jar zipkin-dependencies.jar &

After the download is completed, start zipkin-dependencies with the above command. Note here that the program will only calculate the dependency once based on the zipkin data of the day, store it in es with an index of zipkin:dependency-2020-9-28, and then exit. Therefore, if you want to rely on real-time updates, you need to find a way to execute zipkin- dependencies periodically.

Configure spring: zipkin: base-url: http://127.0.0.1:9411 depending on the configuration Hoxton.SR8 org.springframework.cloud spring-cloud-dependencies ${spring.cloud-version} pom import org.springframework.cloud spring-cloud-starter-sleuth org.springframework.cloud spring-cloud-starter-zipkin parameter

The base-url here is the address of the zipkin server, and the default address is also http://localhost:9411/. After configuration, we visit the API of our service. Click run query to get the following tracking information.

Commercial link tracking product recommendation

Aliyun Commercial Link tracing (TracingAnalysis) provides complete tools for developers of distributed applications, such as link recovery, call request statistics, link topology, application dependency analysis and so on. It can help developers quickly analyze and diagnose performance bottlenecks in distributed application architecture, and improve the efficiency of development diagnosis in the era of micro-services.

Commercial product architecture

The product architecture for link tracking is shown in the figure.

Figure 1. Link tracking product architecture

The main workflow is as follows:

The client-side application reports service invocation data through a multilingual client with integrated link tracking, SDK. Link tracing supports SDK from a variety of open source communities and supports the OpenTracing standard.

After the data is reported to the link tracking console, the link tracking component carries out real-time aggregation calculation and persistence to form monitoring data such as link details, performance overview, real-time topology and so on. You can troubleshoot and diagnose problems accordingly.

Call chain data can be connected to downstream Ali Cloud products, such as LogSearch, CloudMonitor, MaxCompute, etc., for offline analysis, alarm and other scenarios.

Commercial product function

The main functions of link tracking are:

Distributed call chain query and diagnostics: track all micro-service user requests in the distributed architecture and aggregate them into a distributed call chain.

Real-time summary of application performance: summarize the individual services and resources that make up the application in real time by tracking user requests throughout the application.

Distributed topology dynamic discovery: all users' distributed micro-service applications and related PaaS products can track the distributed call information collected through the link.

Multilingual development program access: based on OpenTracing standards, fully compatible with open source communities such as Jaeger and Zipkin.

Rich downstream docking scenarios: the collected links can be directly used for log analysis and can be connected to downstream analysis platforms such as MaxCompute.

This is the end of the article on "how to install and use the link tracking tool Zipkin". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please 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

Internet Technology

Wechat

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

12
Report