zoukankan      html  css  js  c++  java
  • Eureka多机高可用

    线上Eureka高可用集群,至少三个节点组成一个集群,推荐部署在不同的服务器上,IP用域名绑定,端口保持一致。

    10.1.22.26:8762
    10.1.22.27:8762
    10.1.22.28:8762

    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:8762/eureka/,http://10.1.22.28:8762/eureka/
    ---
    #启动命令nohup java -jar mima-cloud-eureka-ha.jar --spring.profiles.active=peer2 &
    server:
      port: 8762
    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:8762/eureka/
    ---
    #启动命令nohup java -jar mima-cloud-eureka-ha.jar --spring.profiles.active=peer3 &
    server:
      port: 8762
    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:8762/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:8762/eureka/,http://10.1.22.28:8762/eureka/

     

  • 相关阅读:
    CentOS 5.5 安装 Oracle 11gR2 并随系统启动
    使用blockrecover 对有坏块的数据文件进行恢复
    用yum下载安装包
    PInvoke时候StringBuilder的陷阱
    mac:添加环境变量
    win8:metro app UI 设计
    用户体验&UI 实用小技巧
    Win8:To Do List Demo
    JavaScript语言精粹 ——笔记
    win8: 确保 WinJS.xhr 重新发送请求
  • 原文地址:https://www.cnblogs.com/linjiqin/p/10093300.html
Copyright © 2011-2022 走看看