原创

springcloud+seluth+rabbitmq+zipkin+elasticsearch+docker-compose链路监控

1.安装好rabbitmq和elasticsearch

2.基于docker-compose搭建zipkin服务端

1.编写docker-compose.yml文件

version: '2'
services:
zipkin:
container_name: zipkin
image: openzipkin/zipkin
environment:
- STORAGE_TYPE=elasticsearch
- ES_HOSTS=192.168.1.110:9200
- RABBIT_ADDRESSES=192.168.1.110:5672
- RABBIT_USER=admin
- RABBIT_PASSWORD=admin
ports:
- 9411:9411


2.启动zipkin容器

在docker-compose.yml当前目录使用命令 启动 zipkin容器   docker-compose up -d


3.微服务配置

1.添加maven依赖 

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-rabbit</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>

2.在application.yml中添加rabbitmq配置

#rabbitmq配置
spring.rabbitmq.host=192.168.0.10
spring.rabbitmq.port=5672
spring.rabbitmq.username=guest
spring.rabbitmq.password=guest
正文到此结束
Loading...