码迷,mamicode.com
首页 > 其他好文 > 详细

Eureka多机高可用

时间:2018-12-09 21:28:51      阅读:293      评论:0      收藏:0      [点我收藏+]

标签:span   client   zone   man   com   lin   ble   app   spring   

1、Eureka服务端集群配置文件

#多服务器HA
spring:
  application:
    name: mima-cloud-eureka-ha
management:
  security:
    enabled: false
---
#启动命令nohup java -jar mima-cloud-eureka-ha.jar --spring.profiles.active=peer1 &
server:
  port: 8762
spring:
  profiles: peer1
eureka:
  instance:
    hostname: localhost
    prefer-ip-address: true
    instance-id: ${spring.application.name}:${server.port}
  client:
    serviceUrl:
      defaultZone: http://10.1.22.27:8763/eureka/,http://10.1.22.28:8764/eureka/
---
#启动命令nohup java -jar mima-cloud-eureka-ha.jar --spring.profiles.active=peer2 &
server:
  port: 8763
spring:
  profiles: peer2
eureka:
  instance:
    hostname: localhost
    prefer-ip-address: true
    instance-id: ${spring.application.name}:${server.port}
  client:
    serviceUrl:
      defaultZone: http://10.1.22.26:8762/eureka/,http://10.1.22.28:8764/eureka/
---
#启动命令nohup java -jar mima-cloud-eureka-ha.jar --spring.profiles.active=peer3 &
server:
  port: 8764
spring:
  profiles: peer3
eureka:
  instance:
    hostname: localhost
    prefer-ip-address: true
    instance-id: ${spring.application.name}:${server.port}
  client:
    serviceUrl:
      defaultZone: http://10.1.22.26:8762/eureka/,http://10.1.22.27:8763/eureka/

 如何打包mima-cloud-eureka-ha.jar可执行文件,点击此处查看

2、Eureka客户端集群配置文件

debug: true
spring:
  application:
    name: mima-cloud-producer
server:
  port: 9906
eureka:
  instance:
    prefer-ip-address: true
    instance-id: ${spring.application.name}:${spring.cloud.client.ipAddress}:${server.port}
  client: 
    serviceUrl: 
      #如果需要使用主机名,则需要配置服务器的/etc/hosts文件
      defaultZone: http://10.1.22.26:8762/eureka/,http://10.1.22.27:8763/eureka/,http://10.1.22.28:8764/eureka/

 

Eureka多机高可用

标签:span   client   zone   man   com   lin   ble   app   spring   

原文地址:https://www.cnblogs.com/linjiqin/p/10093300.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!