Micro Service Configuration

bootstrap.yml file as follows:

spring:
  application:  name: 微服务应用名  cloud:  config:  label: ${config.label:dev}  profile: ${config.profile:dev}  discovery:  enabled: true  serviceId: config-server eureka:  instance:  #Renew频率。默认是30秒,每30秒会向Eureka Server发起Renew操作。  lease-renewal-interval-in-seconds: 30  #服务失效时间。默认是90秒,Eureka Server在90秒内没有接收到来自Service Provider的Renew操作,就会把Service Provider剔除。  lease-expiration-duration-in-seconds: 90  prefer-ip-address: true  instance-id: ${spring.cloud.client.ipAddress}:${server.port}  client:  serviceUrl:  defaultZone: ${defaultZones:http://172.20.69.70:1111/eureka/,http://172.20.69.71:1111/eureka/}  register-with-eureka: true

1, the local-tone

The spring.cloud.config.discovery set to false, then copy the contents of the configuration file to application.yml in to

2, package deployment environment

Git is to read the configuration corresponding to the branch, at which time is set to true spring.cloud.config.discovery

Center Configuration profiles application.yml follows

spring:
  application:  name: config-server # profiles: # active: native # cloud: # config: # server: # native: # search-locations: ${config.url:E:/locationConfigCenter}  cloud:  config:  discovery:  enabled: true  server:  git:  uri: ${config.url:http://git.timacloud.cn/TIMA-DMP/config-center.git}  searchPaths: ${config.folder:dmp}  username: ${config.username:jenkins.notify}  password: ${config.password:J8GUrST5}  force-pull: true server:  port: 2222 eureka:  instance:  #Renew频率。默认是30秒,每30秒会向Eureka Server发起Renew操作。  lease-renewal-interval-in-seconds: 30  #服务失效时间。默认是90秒,Eureka Server在90秒内没有接收到来自Service Provider的Renew操作,就会把Service Provider剔除。  lease-expiration-duration-in-seconds: 90  prefer-ip-address: true  instance-id: ${spring.cloud.client.ipAddress}:${server.port}  client:  serviceUrl: # defaultZone: ${defaultZones:http://localhost:1111/eureka/}  defaultZone: ${defaultZones:http://172.20.69.70:1111/eureka/,http://172.20.69.71:1111/eureka/}  register-with-eureka: true

Guess you like

Origin www.cnblogs.com/gouhaiping/p/12098449.html