阿里云 eureka 高可用 集群 互相无法注册 unavailable-replicas

<spring-cloud.version>Dalston.SR1</spring-cloud.version> 这个版本有可能不好使,不确定,

所以我改成了 <spring-cloud.version>Edgware.SR5</spring-cloud.version>

直接贴出我好使的配置:

maven pom 

<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>1.5.13.RELEASE</version>
		<relativePath />
	</parent>
<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<java.version>1.8</java.version>
		<spring-cloud.version>Edgware.SR5</spring-cloud.version>
<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter-eureka-server</artifactId>
		</dependency>

阿里云两台服务器   内网地址:176.13.0.75   176.13.0.76

1、在75配置映射   176.13.0.76  eureka76.com  这一步不懂的百度host 配置

     在76 配置映射   176.13.0.75  eureka75.com

2、75机器上的bootstrap.yml 

server:
  port: 16375

eureka:
  instance:
    hostname: eureka75.com
    appname: ${spring.application.name}
    prefer-ip-address: false
  client:
    fetch-registry: true
    register-with-eureka: true
    serviceUrl:
      defaultZone: http://${security.user.name}:${security.user.password}@eureka76.com:16376/eureka/
  server:
    enable-self-preservation: false #关闭自我保护

3、76机器上的bootstrap.yml 

eureka:
  instance:
    hostname: eureka76.com
    appname: ${spring.application.name}
    prefer-ip-address: false
  client:
    fetch-registry: true
    register-with-eureka: true
    serviceUrl:
      defaultZone: http://${security.user.name}:${security.user.password}@eureka75.com:16375/eureka/
  server:
    enable-self-preservation: false #关闭自我保护

4、这几个配置都很重要

网上说:

hostname 要用域名,我以前用的 ip 不好使

appname  要和 application.name  一样

prefer-ip-address  是否用ip作为注册中心地址,把他关闭 设置为 false 

fetch-registry: true
register-with-eureka: true 

defaultZone 这个地址设置为 其他注册中心地址,注意路径上的域名和端口 

5、我查看过的博客 

网上搜了很多,有几篇帮助很大,下面相关链接附上:

https://www.jianshu.com/p/59c54ccc6ba6

https://www.cnblogs.com/flying607/p/8317128.html

我采用这种配置文件方式好使了:https://blog.csdn.net/j080624/article/details/80507927

 

 

转载于:https://my.oschina.net/prosouly/blog/2999488

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值