搭建调用链监控Zipkin和Sleuth

项目环境:

win7、jdk8

1、添加依赖,添加了spring-cloud-starter-zipkin会自动导入Sleuth

		<!--Sleuth,zipkin-->
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter-zipkin</artifactId>
			<version>2.1.1.RELEASE</version>
		</dependency>
		<!--end Sleuth,zipkin-->

项目的Spring Cloud的版本如下:

	<dependencyManagement>
		<dependencies>
			<!--整合spring cloud-->
			<dependency>
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-dependencies</artifactId>
				<version>Greenwich.SR1</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
			<!--整合spring cloud alibaba-->
            <dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
                <version>2.1.2.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
		</dependencies>
	</dependencyManagement>

2、添加配置

spring:
  zipkin:
    base-url: http://localhost:9411/
    discoveryClientEnabled: false
  sleuth:
    sampler:
      # 抽样率,默认是0.1(10%)
      probability: 1.0

3、下载Zipkin Server

方式1:使用Zipkin官方的Shell下载
curl -sSL https://zipkin.io/quickstart.sh | bash -s

下载下来的文件名为 zipin.jar

方式2:到Maven中央仓库下载

下载地址如下:

https://search.maven.org/remote_content?g=io.zipkin.java&a=zipkin-server&v=LATEST&c=exec

下载下来的文件名为 zipkin-server-2.12.9-exec.jar

4、启动Zipkin Server

java -jar zipkin-server-2.12.9-exec.jar

出现以下界面启动成功:

5、使用Elasticsearch进行持久化

由于ES7之后需要JDK11及更高版本,所以本案例下载的是Elasticsearch 6.8.23,下载地址:

https://www.elastic.co/cn/downloads/past-releases#elasticsearch

下载下来的文件名称为:elasticsearch-6.8.23.zip

百度网盘下载:

链接:https://pan.baidu.com/s/17fNW79b0mo9PeyHViQssFw 
提取码:1234

解压elasticsearch-6.8.23.zip,双击 bin/elasticsearch.bat

访问 localhost:9200,能打开以下页面,则执行成功

重新启动zipkin server 

java -jar zipkin-server-2.12.9-exec.jar --STORAGE_TYPE=elasticsearch --ES_HOSTS=localhost:9200

相关推荐

  1. docker zipkin

    2024-07-18 04:16:02       22 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-18 04:16:02       66 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-18 04:16:02       70 阅读
  3. 在Django里面运行非项目文件

    2024-07-18 04:16:02       57 阅读
  4. Python语言-面向对象

    2024-07-18 04:16:02       68 阅读

热门阅读

  1. 牛客多校暑期第一场

    2024-07-18 04:16:02       18 阅读
  2. 记一次Mysql连接失败的处理过程

    2024-07-18 04:16:02       28 阅读
  3. 从入门到高手的99个python案例

    2024-07-18 04:16:02       18 阅读
  4. Springboot Excel 导出工具 -- EasyPoi 简介

    2024-07-18 04:16:02       22 阅读
  5. 智能家居的优缺点有哪些?

    2024-07-18 04:16:02       17 阅读
  6. RedisServer解析(一)

    2024-07-18 04:16:02       24 阅读
  7. 【算法模板】数论:杨辉三角求组合数

    2024-07-18 04:16:02       23 阅读