美文网首页
Eureka多机高可用

Eureka多机高可用

作者: wesker8080 | 来源:发表于2018-09-06 20:25 被阅读0次

    我不知道这个是不是可用于生产环境或者说是不是终版,但是它确实是第一版

    #多服务器
    spring:
      application:
        name: mima-cloud-eureka-ha
    management:
      security:
        enabled: false
    #关闭安全验证
    security:
      basic:
        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://192.168.1.83:8763/eureka/,http://192.168.1.162:8764/eureka/
    ---
    #启动命令nohup java -jar mima-cloud-eureka-ha.jar --spring.profiles.active=peer2
    
    spring:
      profiles: peer2
    eureka:
      instance:
        hostname: localhost
        prefer-ip-address: true
        instance-id: ${spring.application.name}:${server.port}
      client:
        serviceUrl:
          defaultZone: http://192.168.1.162:8764/eureka/,http://192.168.1.71:8762/eureka/
    server:
      port: 8763
    ---
    #启动命令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://192.168.1.71:8762/eureka/,http://192.168.1.83:8763/eureka/
    

    这里做了3个Eureka节点,分别布署到3台服务器,然后client要注册到这3个eureka里去

    eureka:
      client:
        serviceUrl: 
          #defaultZone: http://wesker:wesker@localhost:8762/eureka/
          defaultZone: http://192.168.1.83:8763/eureka/,http://192.168.1.71:8762/eureka/,http://192.168.1.162:8764/eureka/
    

    此外Eureka的应用监控地址是 ip:port/eureka/apps
    打开是个XML,里面是各个应用的配置详细信息

    相关文章

      网友评论

          本文标题:Eureka多机高可用

          本文链接:https://www.haomeiwen.com/subject/ptxfgftx.html