Spring Cloud 微服务六:调用链跟踪Spring cloud sleuth +zipkin
前言:随着微服务系统的增加,服务之间的调用关系变得会非常复杂,这给运维以及排查问题带来了很大的麻烦,这时服务调用监控就显得非常重要了。spring cloud sleuth实现了对分布式服务的监控解决方案。
前情回顾请参考:
Spring Cloud 微服务二:API网关spring cloud zuul
Spring Cloud 微服务三: API网关Spring cloud gateway
Spring Cloud 微服务四:熔断器Spring cloud hystrix
Spring Cloud 微服务五:Spring cloud gateway限流
- 概览
- sleuth集成zipkin
- 搭建zipkin服务,可以通过docker或者jar包的方式启动,具体可参考:https://github.com/openzipkin.本章主要使用spring的方式启动。首先新建一个module sleuth-server,在pom中引入以下依赖,版本我使用的与springboot 2.0.8.RELEASE相对应的2.11.7版本,该版本已经在父工程中定义。
<artifactId>sleuth-server</artifactId> <dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-server</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
</dependency>
</dependencies> - 在启动类添加@EnableZipkinServer注解,表示该工程是一个服务器
@SpringBootApplication
@EnableZipkinServer
public class SleuthServerApplication {
public static void main(String[] args) {
SpringApplication.run(SleuthServerApplication.class, args);
}
} - 配置application.yml,加入zipkin配置
server:
port: 9411 debug: true
spring:
application:
name: sleuth-server
management:
metrics:
web:
server:
auto-time-requests: false - 启动sleuth-server,访问http://localhost:9411进入主界面
- 接下来配置user-consumer,在该工程的pom文件中添加zipkin依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency> - application.yml中添加sleuth以及zipkin配置
zipkin:
base-url: http://localhost:9411/
sleuth:
sampler:
probability: 1.0 - 同样配置user-service
- 启动user-service,user-consumer,访问服务,会在zipin页面上查询到。
- 搭建zipkin服务,可以通过docker或者jar包的方式启动,具体可参考:https://github.com/openzipkin.本章主要使用spring的方式启动。首先新建一个module sleuth-server,在pom中引入以下依赖,版本我使用的与springboot 2.0.8.RELEASE相对应的2.11.7版本,该版本已经在父工程中定义。
Spring cloud sleuth实现了分布式系统的链路监控,用户可以通过可视化、交互式页面查看服务调用情况,并能够自动更关心服务调用状态
Spring Cloud 微服务六:调用链跟踪Spring cloud sleuth +zipkin的更多相关文章
- spring cloud微服务快速教程之(十一) Sleuth(zipkin) 服务链路追踪
0.前言 微服务架构上众多微服务通过REST调用,可能需要很多个服务协同才能完成一个接口功能,如果链路上任何一个服务出现问题或者网络超时,都会形成导致接口调用失败.随着业务的不断扩张,服务之间互相调用 ...
- 【多线程】java多线程Completablefuture 详解【在spring cloud微服务之间调用,防止接口超时的应用】【未完成】
参考地址:https://www.jianshu.com/p/6f3ee90ab7d3 示例: public static void main(String[] args) throws Interr ...
- Spring Cloud 微服务三: API网关Spring cloud gateway
前言:前面介绍了一款API网关组件zuul,不过发现spring cloud自己开发了一个新网关gateway,貌似要取代zuul,spring官网上也已经没有zuul的组件了(虽然在仓库中可以更新到 ...
- Spring Cloud 微服务二:API网关spring cloud zuul
前言:本章将继续上一章Spring Cloud微服务,本章主要内容是API 网关,相关代码将延续上一章,如需了解请参考:Spring Cloud 微服务一:Consul注册中心 Spring clou ...
- Spring Cloud微服务笔记(二)Spring Cloud 简介
Spring Cloud 简介 Spring Cloud的设计理念是Integrate Everything,即充分利用现有的开源组件, 在它们之上设计一套统一的规范/接口使它们能够接入Spring ...
- Spring Cloud 微服务入门(二)--Spring Cloud 架构
Spring Cloud整体核心架构:Rest服务,在Spring Cloud配置过程中,都是遵循Rest风格规范,在Rest处理中,必不可少两个对象端:服务的提供者(provider)和服务消费者( ...
- Spring Cloud微服务学习笔记
Spring Cloud微服务学习笔记 SOA->Dubbo 微服务架构->Spring Cloud提供了一个一站式的微服务解决方案 第一部分 微服务架构 1 互联网应用架构发展 那些迫使 ...
- Spring Cloud 微服务四:熔断器Spring cloud hystrix
前言:在微服务架构中,一般都是进程间通信,有可能调用链都比较长,当有底层某服务出现问题时,比如宕机,会导致调用方的服务失败,这样就会发生一连串的反映,造成系统资源被阻塞,最终可能造成雪崩.在sprin ...
- 全链路实践Spring Cloud 微服务架构
Spring Cloud 微服务架构全链路实践Spring Cloud 微服务架构全链路实践 阅读目录: 网关请求流程 Eureka 服务治理 Config 配置中心 Hystrix 监控 服务调用链 ...
随机推荐
- 我的一次Postgre数据库Insert 、Query性能优化实践
一.前言 以前的系统由于表设计比较复杂(多张表,表与表直接有主从关系),这个是业务逻辑决定的. 插入效率简直实在无法忍受,必须优化.在了解了Postgre的Copy,unlogged table 特性 ...
- Word中如何让两个图片垂直居中对齐
如图,两个图片都剧终了,大小也一致,但是发现没有对齐,那是因为需要设置(矩阵框住的)缩进,让两个在一起,上下对齐.
- UBIFS 术语
B+ tree: base head: budgeting: 空闲空间评估 bud: 一个日志使用的eraseblock cnode: commit: 更新index到flash上的过程 commit ...
- 使用size()方法输出列表中的元素数量。需要注意的是,这个方法返回的值可能不是真实的,尤其当有线程在添加数据或者移除数据时,这个方法需要遍历整个列表来计算元素数量,而遍历过的数据可能已经改变。仅当没有任何线程修改列表时,才能保证返回的结果是准确的。
使用size()方法输出列表中的元素数量.需要注意的是,这个方法返回的值可能不是真实的,尤其当有线程在添加数据或者移除数据时,这个方法需要遍历整个列表来计算元素数量,而遍历过的数据可能已经改变.仅当没 ...
- linux MySQL Cluster MySQL集群
原文:http://lizhenliang.blog.51cto.com/7876557/1290451 官方下载地址 http://dev.mysql.com/downloads/cluster/ ...
- ASIHTTPRequest框架使用总结系列之阿堂教程4(下载数据)
从本篇开始,阿堂准备进一步介绍ASIHTTPRequest框架下载数据和上传数据的实际应用. 为了实现多线程并发请求网络能力,ASIHTTPRequest被设计成 NSOperation ...
- Android开发中多进程共享数据
# 背景 最近在工作中遇到一个需求,需要在接收到推送的时候将推送获得的数据存起来,以供app启动时使用.我们会认为这不是So easy吗?只要把数据存到SharedPreferences中,然后让ap ...
- Qt中的非模式窗口配置;
Test7_5A::Test7_5A(QWidget *parent) : QMainWindow(parent){ ui.setupUi(this); m_searchwin = new Searc ...
- mysql关于访问权限以及root密码修改
root密码修改:mysql> use mysql;mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = ' ...
- 解决dubbo问题:forbid consumer(1)
原因: 1.dubbo服务没有起动起来 2.dubbo链接的地址出现异常 3.dubbo服务端更新了服务接口,没有发布 如果已上都没有问题,那么还有一个原因就是 “ 别人的代码有问题 阻碍了 你的程序 ...