单机eureka服务与注册

2020-06-11  本文已影响0人  李霖神谷
image.png

整体系统架构分为四个模块,一个是eureka服务,生产者服务,消费者服务,最后一个是一些带有一些工具依赖的服务,打完包后方便其他的服务调用。
eureka用到的依赖有:
用于eureka处理服务与注册的依赖:没有依赖版本是因为方便与spring boot整合.以及yml配置文件。最后在启动类中配置@EnableEurekaServe注解:

 <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
    </dependency>

eureka:
  instance:
    hostname: localhost
  client:
    register-with-eureka: false
    fetch-registry: false
    service-url:
      defaulZone: http://localhost:8761/eureka/

用于服务注册进eureka的依赖以及配置文件。最后在主启动类配置@EnableEurekaClient注解:

<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>
eureka:
  instance:
    hostname: localhost
  client:
    serviceUrl:
      defaulZone: http://localhost:8761/eureka/
上一篇 下一篇

猜你喜欢

热点阅读