HongHu云架构 - eureka的相关配置
1.在启动类入口引用eureka的相关配置,代码如下:package com.ml.honghu;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;@EnableEurekaServer@SpringBootApplicationpublic class ServiceApplication { public static void main(String[] args) { SpringApplication.run(ServiceApplication.class, args); }}2.配置application.yml文件
# server (eureka 默认端口为:8761)server:port: 8761# springspring:application: name: particle-commonservice-erueka# eurekaeureka: client: # 是否注册到eureka register-with-eureka: true # 是否从eureka获取注册信息 fetch-registry: false availability-zones: honghu: honghuZone service-url: honghuZone: http://honghu:123456@localhost:8761/eureka/ defaultZone: http://honghu:123456@localhost:8761/eureka/instance: prefer-ip-address: true hostname: localhost metadataMap: zone: honghuZone user: ${security.user.name} password: {security.user.password} # 指定环境environment: dev#指定数据中心datacenter: honghu# 关闭自我保护模式server: enable-self-preservation: false#设置清理无效节点的时间间隔,默认60000,即是60s eviction-interval-timer-in-ms: 60000# 服务认证security: basic: enabled: trueuser: name: honghu password: 123456management:security: enabled: falsehttp://minglisoft.cn/honghu/technology.html]资料和源码来源
页:
[1]