sleuth+zipkin+rabbitmq+elasticsearchz整合

sleuth+zipkin+rabbitmq+elasticsearchz整合

版本 spring-boot-starter-parent---------------------1.5.9.RELEASE

1.http+mysql

在zipkin-server项目中引入

    
            io.zipkin.java
            zipkin-server
         
        
            io.zipkin.java
            zipkin-autoconfigure-ui
        
        
        
            io.zipkin.java
            zipkin-autoconfigure-storage-mysql
        
        
        
            org.springframework.boot
            spring-boot-starter-jdbc
        
        
            mysql
            mysql-connector-java
            runtime
        
        
            com.alibaba
            druid
            1.0.11
        
    

application.properties

server.port=17601
spring.application.name=zddk-server-zipkin
spring.sleuth.enabled=false
zipkin.storage.type=mysql
spring.datasource.schema[0]=classpath:/zipkin.sql
spring.datasource.url=jdbc:mysql://localhost:3306/zddk-zipkin?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.initialize=true
spring.datasource.continue-on-error=true

在启动方法上添加@EnableZipkinServer

@SpringBootApplication
//@EnableZipkinStreamServer
@EnableZipkinServer
public class ZddkServerZipkinApplication {
​
    public static void main(String[] args) {
        /*args = new String[1];
        args[0] = "--spring.profiles.active=zipkin-http";*/
        SpringApplication.run(ZddkServerZipkinApplication.class, args);
    }
}

在其他服务pom中引入

 
        
            org.springframework.cloud
            spring-cloud-starter-sleuth
          
        
            org.springframework.cloud
            spring-cloud-starter-zipkin
        

2.rabbitmq+mysql

     
   
            io.zipkin.java
            zipkin-server
        
        
            io.zipkin.java
            zipkin-autoconfigure-ui
        
        
            org.springframework.cloud
            spring-cloud-sleuth-zipkin-stream
        
        
            org.springframework.cloud
            spring-cloud-starter-stream-rabbit
        
        
            mysql
            mysql-connector-java
        
        
            org.springframework.boot
            spring-boot-starter-jdbc
        

application.properties

server.port=17601
spring.application.name=zddk-server-zipkin
spring.sleuth.enabled=false
zipkin.storage.type=mysql
spring.datasource.schema[0]=classpath:/zipkin.sql
spring.datasource.url=jdbc:mysql://localhost:3306/zddk-zipkin?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.initialize=true
spring.datasource.continue-on-error=true
spring.rabbitmq.host=192.****.***.***
spring.rabbitmq.port=5672
spring.rabbitmq.username=guest
spring.rabbitmq.password=guest

在启动方法上添加@EnableZipkinStreamServer

@SpringBootApplication
@EnableZipkinStreamServer
//@EnableZipkinServer
public class ZddkServerZipkinApplication {
​
    public static void main(String[] args) {
        /*args = new String[1];
        args[0] = "--spring.profiles.active=zipkin-http";*/
        SpringApplication.run(ZddkServerZipkinApplication.class, args);
    }
}

在其他服务pom中引入

   
    
            org.springframework.cloud
            spring-cloud-sleuth-zipkin-stream
        
        
            org.springframework.cloud
            spring-cloud-starter-stream-rabbit
        

3.rabbitmq+elasticsearch

     
    
            io.zipkin.java
            zipkin-server
        
        
            io.zipkin.java
            zipkin-autoconfigure-ui
        
            org.springframework.cloud
            spring-cloud-sleuth-zipkin-stream
        
        
            org.springframework.cloud
            spring-cloud-starter-stream-rabbit
        
            io.zipkin.java
            zipkin
            1.28.1
        
        
            io.zipkin.java
        zipkin-autoconfigure-storage-elasticsearch-                              http
            1.28.1
               
         

application.yml

eureka:
  client:
    serviceUrl:
      defaultZone: http://192.168.1.***:8011/eureka/
server:
  port: 9411
spring:
  application:
    name: zipkin-server
  sleuth:
    enabled: false
  rabbitmq:
    host: 192.168.1.***
    port: 5672
    username: guest
    password: guest
 # datasource:
 #   url: jdbc:mysql://localhost:3306/zddk-zipkin?useUnicode=true&characterEncoding=utf8&useSSL=false
 #   username: root
 #   password: 123456
 #   driver-class-name: com.mysql.jdbc.Driver
#zipkin:
 #storage:
  #  type: mysql
zipkin:
  storage:
    type: elasticsearch
    StorageComponent: elasticsearch
    elasticsearch:
      cluster: elasticsearch
      max-requests: 30
      index: zipkin
      index-shards: 3
      index-replicas: 1
      hosts: 192.168.1.143:9200

在启动方法上添加@EnableZipkinStreamServer

@SpringBootApplication
@EnableZipkinStreamServer
//@EnableZipkinServer
public class ZddkServerZipkinApplication {
​
    public static void main(String[] args) {
        /*args = new String[1];
        args[0] = "--spring.profiles.active=zipkin-http";*/
        SpringApplication.run(ZddkServerZipkinApplication.class, args);
    }
}

在其他服务pom中引入

      
  
            org.springframework.cloud
            spring-cloud-sleuth-zipkin-stream
        
        
            org.springframework.cloud
            spring-cloud-starter-stream-rabbit
        

 

你可能感兴趣的:(springcloud)