代码之家  ›  专栏  ›  技术社区  ›  Nitishkumar Singh user3744342

gcp上的spring cloud consul健康检查和状态配置

  •  0
  • Nitishkumar Singh user3744342  · 技术社区  · 7 年前

    我们想注册一个 spring-cloud-consul 四黄水蜜外敷 consul GCP compute engine ,它可以向领事馆注册申请,但我们在申请时面临两个问题。下面是 bootstrap.yaml 塞尔维亚 对于申请,

    application.yaml

    server:
      port: 10003
    spring:
      application:
        name: hello-service
      cloud:
        consul:
          enabled: true
        inetutils:
          useOnlySiteLocalInterfaces: true
      endpoints:
        actuator:
          sensitive: false
    

    引导程序.yaml

    spring:
      cloud:
        consul:
          enabled: true
          host: 10.160.0.18
          port: 8500
          discovery:
            prefer-ip-address: true
    
    1. consul无法对计算引擎调用运行状况检查,可能是因为它已在实例的内部域名上注册。

    领事馆服务:newservice{id='hello-service-10003', name='hello-service',tags=[secure=false], address=-consul-app-test.c.name-of-project.internal',meta=null, 端口=10003,enabletagoverride=null,check=check{script='null', interval='10s',ttl='null', http= http://consul-app-test.c.name-of-project.internal:10003/actuator/health ', method='null',header={},tcp='null',timeout='null', 注销criticalserviceafter='null',tlsskipverify=null, status='null'},checks=null}

    1. 申请,而不是从领事处注销。我们已经停止了应用程序,它仍然显示在领事ui上。
    0 回复  |  直到 7 年前
        1
  •  1
  •   Nitishkumar Singh user3744342    7 年前

    我在 应用程序.yaml 引导程序.yaml 对我有用。

    应用程序.yaml

    spring:
      application:
        name: hello-service
      cloud:
        consul:
          discovery:
            instanceId: ${spring.application.name}:${random.value}
            health-check-critical-timeout: 3m
            prefer-ip-address: true # disable if we want to use google cloud internal DNS 
    

    引导程序.yaml

    spring:
      cloud:
        consul:
          enabled: true
          host: 10.160.0.18
          port: 8500
    
    推荐文章