工作筆記

1.register項目,是eureka server

application.yml

server:
  port: 9010 # server HTTP port

spring:
  application:
    name: hlhlo-registion
  cloud:
    config: 
      uri: ${CONFIG_SERVER_URL:http://localhost:8888} #The URI of the remote server (default http://localhost:8888).
      profile: dev #The default profile to use when fetching remote configuration (comma-separated). Default is "default".
      label: master #The label name to use to pull remote configuration properties. The default is set on the server (generally "master" for a git based server).
      discovery:
        enabled: true #Flag to indicate that config server discovery is enabled (config server URL will be looked up via discovery).
eureka:
  instance:
    hostname: localhost #主機名
  client:
    register-with-eureka: false #是否要註冊到別的eureka服務器上
    fetch-registry: false #是否要合併到別的eureka服務器上
    service-url:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
  server:
    eviction-interval-timer-in-ms: 5000 #清理間隔,默認60 * 1000毫秒
    enable-self-preservation: false #關閉自我包含,解決Eureka Server不踢出已關停的節點的問題
endpoints:
  health:
    sensitive: false
    enabled: true
management:
  security:
    enabled: true
    #4.endpoints.sensitive該配置屬性用於配置敏感信息,即是否需要授權的操作,如果設置爲true,則所有的原生端點都需要授權操作,設置爲false則不需要,默認是false,這裏需要注意的是如果沒有主動設置該值的話,有些原生端點是需要授權才能訪問的,如/beans,/env等,當與management.security.enabled一起使用時以management.security.enabled爲主。
    #5.endpoints.{name}.sensitive該配置屬性是相對endpoints.sensitive來說的,endpoints.sensitive是將所有的原生端點進行授權操作,而endpoints.{name}.sensitive是對某個具體的原生端點進行控制,設置爲true時該原生端點需要授權操作,設置爲false的時候不需要授權訪問,具體的默認值需要看具體的原生端點。

2.config

application.yml

server:
  port: 8888
spring:
  application:
    name: hlhlo-config
  profiles:
    active: mybatis #Additional files will also be loaded based on active profiles. For example if a 'web' profile is active 'application-web.properties' and 'application-web.yml' will be considered.
  datasource:
    url: jdbc:mysql://192.168.1.168:3306/hlhlo-config?useUnicode=true&characterEncoding=utf8
    username: root
    password: root
    driver-class-name: com.mysql.jdbc.Driver
  cloud:
      config:
        uri: http://localhost:8888
        profile: dev
        label: master
        discovery:
          enabled: true
eureka:
  instance:
    prefer-ip-address: true #將IP註冊到eureka server,Flag to say that, when guessing a hostname, the IP address of the server should be used in prference to the hostname reported by the OS.
    lease-renewal-interval-in-seconds: 5 #eureka client間隔多久給eureka server發心跳,表明自己還“活着”.如果eureka server在規定時間lease-expiration-duration-in-seconds內(單位秒),eureka server會把實例移除
    lease-expiration-duration-in-seconds: 20 #表明eureka server自上一次收到client的心跳,等候下一次心跳的超時時間,在這個時間裏如果沒有收到心跳,就移除此instance
  client:
    serviceUrl:
      defaultZone: http://localhost:9010/eureka
    registry-fetch-interval-seconds: 10 #間隔多久從eureka server拉取服務註冊信息。
management:
  security:
    enabled: false

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章