docker+zipkin+mysql+rabbitmq

服务端

一、集成docker外部的mysql,rabbitmq的docker-compose.yml的配置如下

# This file uses the version 2 docker-compose file format, described here:
# https://docs.docker.com/compose/compose-file/#version-2
#
# This runs the zipkin and zipkin-mysql containers, using docker-compose's
# default networking to wire the containers together.
#
# Note that this file is meant for learning Zipkin, not production deployments.

version: '2'

services:  

  zipkin:
    image: openzipkin/zipkin
    container_name: zipkin
    # Environment settings are defined here https://github.com/openzipkin/zipkin/tree/1.19.0/zipkin-server#environment-variables
    environment:
      - STORAGE_TYPE=mysql
      # Point the zipkin at the storage backend
      - MYSQL_DB=shop_zipkin
      - MYSQL_USER=root
      - MYSQL_PASS=root
      - MYSQL_HOST=192.168.1.81
      - MYSQL_TCP_PORT=3306
      # Uncomment to enable scribe
      # - SCRIBE_ENABLED=true
      # Uncomment to enable self-tracing
      # - SELF_TRACING_ENABLED=true
      # Uncomment to enable debug logging
      # - JAVA_OPTS=-Dlogging.level.zipkin=DEBUG -Dlogging.level.zipkin2=DEBUG
      - RABBIT_ADDRESSES=192.168.1.81:5672
      - RABBIT_USER=guest
      - RABBIT_PASSWORD=guest
      - RABBIT_QUEUE=zipkin
      - RABBIT_VIRTUAL_HOST=/admin_host
    ports:
      # Port used for the Zipkin UI and HTTP Api
      - 9411:9411
      # Uncomment if you set SCRIBE_ENABLED=true
      # - 9410:9410

二、docker配置完docker-compose.yml启动zipkin服务端镜像(下载,启动)

       zipkin启动可参考文章https://blog.csdn.net/qq_42714869/article/details/90052903

三、zipkin服务端启动成功后rabbitmq会生成消息队列,如下图

客户端ZipkinClient

一、Maven依赖

        <!-- ZipkinClient集成 -->
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter-zipkin</artifactId>
		</dependency>
		<!-- ZipkinClient集成rabbitMQ -->
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-stream-binder-rabbit</artifactId>
		</dependency>
        
        <!-- 添加springboot对amqp的支持,RabbitMQ依赖 -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-amqp</artifactId>
		</dependency>

二、application.yml配置

spring:
  application:
    name:  app-shop-member
  ###zipkin链路监控与追踪
  zipkin: 
      base-url: http://192.168.1.81:9411/
  ###全部采集  
  sleuth:
     sampler:
      probability: 1.0
  ####集成rabbitmq
  rabbitmq:
  ####连接地址
    host: 192.168.1.81
   ####端口号   
    port: 5672
   ####账号 
    username: guest
   ####密码  
    password: guest
   ### 地址
    virtual-host: /admin_host
    ###开启消息确认机制 confirms
    publisher-confirms: true
    publisher-returns: true 

 

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值