美文网首页
单机eureka服务与注册

单机eureka服务与注册

作者: 李霖神谷 | 来源:发表于2020-06-11 17:32 被阅读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/

相关文章

网友评论

      本文标题:单机eureka服务与注册

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