spring boot admin 使用consul discovery

maven

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>org.springframework.cloud</groupId>-->
            <!--<artifactId>spring-cloud-starter-consul-discovery</artifactId>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-consul-all</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jolokia</groupId>
            <artifactId>jolokia-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-turbine</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.cloud</groupId>
                    <artifactId>spring-cloud-starter-eureka</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!--spring boot admin-->
        <!-- https://mvnrepository.com/artifact/de.codecentric/spring-boot-admin-server -->
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-server</artifactId>
            <version>${admim.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-web</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-server-ui-turbine</artifactId>
            <version>${admim.version}</version>
        </dependency>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-server-ui</artifactId>
            <version>${admim.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
        </dependency>

config

turbine:
  appConfig: product-service,recommend-service
  clusterNameExpression: new String("default")

spring.boot.admin:
  discovery:
    ignored-services: consul
  turbine:
    clusters: default
    url: http://localhost:8989/turbine.stream

bootstrap

spring:
  application:
    name: turbine
  cloud:
    consul:
      enabled: true
      host: 192.168.99.100
      port: 8500
      discovery:
        enabled: true
        register: true
        healthCheckInterval: 15s
        health-check-timeout: 1s
        instance-id: ${spring.application.name}:${spring.cloud.consul.discovery.instance_id:${random.value}}
        tags: dev

doc

相关推荐