哎呀呀  好难  先来打个卡

 

1:  eureka的服务注册中心:eureka-server     https://github.com/july1992/eureka_server

Spring cloud 微服务架构

2:  eureka的服务提供方:eureka-client .  https://github.com/july1992/eureka_client

Spring cloud 微服务架构

3: consul的服务提供方:consul-client .  https://github.com/july1992/consul_client

     consul 自带服务,通过终端开启,不需要跟eureka 一样配置服务,所以:

       A: 去官网下载 consul https://www.consul.io/downloads.html

       B: 解压后将consul.exe 放在 /usr/local/bin 目录下(位置可以自定义,记得在 ~/bash_profile 里配置地址的环境变量)

       C: 执行consul agent -dev ,运行结果如下 

Spring cloud 微服务架构

     D:yml文件里记得配置:

Spring cloud 微服务架构

  E:我在项目里写了一个接口调用

Spring cloud 微服务架构

F:这个时候打开网址,可能需要等待片刻,http://localhost:8500/ui/dc1/services 

Spring cloud 微服务架构

上面红叉叉的原因是忘记加入下面依赖 :

<!--监控中心-->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

 

Spring cloud 微服务架构

4:  eureka的服务消费者:eureka-consumer   出了问题  代码后续在传

5:  这个是运行了 上诉 1,2,4 的结果  

Spring cloud 微服务架构

相关文章: