server:
  port: 8006
spring:
  application:
    name: consul-provider-payment
  cloud:
    consul:
      host: 192.168.152.131
      port: 8500
      discovery:
        service-name: ${spring.application.name}
        #此处需要设置为true,以IP地址注册到服务中心,不然会报红X,访问不了linux上的consul,显示为localhost本机
        prefer-ip-address: true


4、在centos7上使用consul时,yml配置文件:

 

 4、在centos7上使用consul时,yml配置文件:

 

 

 

 

设置为true后:

4、在centos7上使用consul时,yml配置文件:

 

4、在centos7上使用consul时,yml配置文件:

 

 

访问成功:此时的IP地址为consul注册进去的地址

 

 4、在centos7上使用consul时,yml配置文件:

 

 

 

相关文章:

  • 2021-08-19
  • 2021-08-06
  • 2022-12-23
  • 2022-12-23
  • 2022-01-20
  • 2022-01-07
  • 2023-03-21
猜你喜欢
  • 2021-12-25
  • 2021-06-28
  • 2021-07-11
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
  • 2021-05-19
相关资源
相似解决方案