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
      
    记得快乐
  • 相关阅读:
    Laravel源码解析 — 服务容器
    Java日志框架中需要判断log.isDebugEnabled()吗?
    使用C语言实现线性表
    new-delete
    webrtc-AudioprcessingModule 3A算法demo
    关于iPhone语音备忘录访问
    关于音频通话耗时
    关于Windows上使用OpenAL API声源音效
    c++ 类术语
    二分法查找
  • 原文地址:https://www.cnblogs.com/Y-wee/p/14130571.html
Copyright © 2011-2022 走看看