zoukankan      html  css  js  c++  java
  • 搭建eureka集群

    搭建eureka集群

    搭建三个eureka服务,修改全局配置文件

    • eureka01配置全局文件

      spring:
        application:
          name: eureka01
      server:
        port: 7001
        #eureka的基本信息
      eureka:
        instance:
          hostname: eureka7001.com
        client:
          service-url:
            defaultZone:  http://eureka7002.com:7002/eureka/,http://eureka7003.com:7003/eureka/
          #本身就是注册中心,不需要注册
          register-with-eureka: false
          #本身就是注册中心,不需要获取注册信息
          fetch-registry: false
      
    • eureka02配置全局文件

      spring:
        application:
          name: eureka02
      server:
        port: 7002
        #eureka的基本信息
      eureka:
        instance:
          hostname: eureka7002.com
        client:
          service-url:
            defaultZone: http://eureka7001.com:7001/eureka/,http://eureka7003.com:7003/eureka/
          #本身就是注册中心,不需要注册
          register-with-eureka: false
          #本身就是注册中心,不需要获取注册信息
          fetch-registry: false
      
    • eureka03配置全局文件

      spring:
        application:
          name: eureka03
      server:
        port: 7003
        #eureka的基本信息
      eureka:
        instance:
          hostname: eureka7003.com
        client:
          service-url:
            defaultZone: http://eureka7001.com:7001/eureka/,http://eureka7002.com:7002/eureka/
          #本身就是注册中心,不需要注册
          register-with-eureka: false
          #本身就是注册中心,不需要获取注册信息
          fetch-registry: false
      
    • 注意要配置windows的hosts文件(C:WindowsSystem32driversetchosts)

      127.0.0.1 eureka7001.com
      127.0.0.1 eureka7002.com
      127.0.0.1 eureka7003.com
      
    • 提供方的配置文件

      spring:
        application:
          name: server01
      server:
        port: 8082
        #eureka的基本信息
      eureka:
        instance:
          hostname: 127.0.0.1
        client:
          service-url:
            defaultZone: http://127.0.0.1:7001/eureka/,http://127.0.0.1:7002/eureka/,http://127.0.0.1:7003/eureka/
          #它本身是一个普通的服务,需要在eureka-server注册
          register-with-eureka: true
          #需要获取注册信息
          fetch-registry: true
      
    • 消费方的配置文件

      spring:
        application:
          name: client_01
      server:
        port: 8080
        #eureka的基本信息
      eureka:
        instance:
          hostname: 127.0.0.1
        client:
          service-url:
            defaultZone: http://127.0.0.1:7001/eureka/,http://127.0.0.1:7002/eureka/,http://127.0.0.1:7003/eureka/
          #它本身是一个普通的服务,需要在eureka-server注册
          register-with-eureka: true
          #需要获取注册信息
          fetch-registry: true
      
    记得快乐
  • 相关阅读:
    SUM游戏
    指针入门(四)
    MSP430 G2553 寄存器列表与引脚功能
    MSP430G2553头文件解析
    修复Kaos的中文显示
    VIM使用技巧3
    VIM使用技巧2
    Java学习之路(3)
    指针入门(三)
    共享VIM配置文件
  • 原文地址:https://www.cnblogs.com/Y-wee/p/14130571.html
Copyright © 2011-2022 走看看