Spring Cloud Eureka 常用配置及说明

Eureka Server 配置

server:
  port: 8888

spring:
  profiles:
    active: dev
  application:
    name: @pom.artifactId@

eureka:
  instance:
    status-page-url-path: /actuator/info #状态页面的URL,相对路径,默认使用 HTTP 访问,如果需要使用 HTTPS则需要使用绝对路径配置
    health-check-url-path: /actuator/health #健康检查页面的URL,相对路径,默认使用 HTTP 访问,如果需要使用 HTTPS则需要使用绝对路径配置
spring:
  security:
    user:
      password: root
      name: root

eureka:
  server:
    enable-self-preservation: false # 设为false,关闭自我保护。根据需求配置相关参数
    response-cache-update-interval-ms: 3000 #客户端的有效负载缓存应该更新的时间间隔,默认为30s(单位/毫秒)
    response-cache-auto-expiration-in-seconds: 120 #当注册表信息被改变时,则其被保存在缓存中不失效的时间,默认为180秒(单位/秒)
    eviction-interval-timer-in-ms: 3000 #清理无效节点的时间间隔。默认60秒(单位/毫秒)
  instance:
    prefer-ip-address : true # 注册时使用ip而不是主机名
    hostname: localhost
    ip-address: 127.0.0.1
  client:
    fetch-registry: false # 表示自己端就是注册中心,我的职责就是维护服务实例,并不需要去检索服务
    register-with-eureka: false #表示是否注册自身到eureka服务器
    serviceUrl:
          #设置与 Eureka Server 交互的地址查询服务和注册服务都需要依赖这个地址(服务暴露的地址)
          defaultZone: http://root:root@${eureka.instance.hostname}:${server.port}/eureka/

你可能感兴趣的:(JAVA)