原项目:https://github.com/Lovnx/micro-service
Ribbon负载均衡策略配置:https://blog.csdn.net/rickiyeat/article/details/64918756
eureka-sever
config-server
service-one
eureka-sever -> config-server -> service-one
访问service-one服务:http://localhost:7074/from
访问service-one服务:http://localhost:7074/addition?a=1&b=2
通过修改文件demo-dev.properties得知,并不是实时取的。
修改配置后,重启项目配置才生效。改配置还需要重启项目吗?
service-two
service-two1
ribbon
依赖环境:redis、mysql
eureka-sever -> ribbon -> service-two -> service-two1
访问ribbon服务器:http://localhost:7071/addition?a=1&b=1
zuul
eureka-sever -> config-server -> service-one -> service-two -> service-two1 -> zuul
访问service-one服务器:http://localhost:7073/api-one/addition?a=1&b=1 访问service-two服务器(会随机分发请求到2台服务器):http://localhost:7073/api-two/addition?a=1&b=1
问题:如何把zuul和ribbon结合起来呢?
service-admin
eureka-sever -> service-admin -> service-two
访问admin系统:http://localhost:7088
hystrix-feign
eureka-sever -> hystrix-feign
访问熔断配置的接口:http://localhost:7079/addition?a=1&b=1
问题:每一个一个接口配一个熔断,岂不是很麻烦?
hystrix-dashboard
访问断路器的监控台:http://localhost:7080/hystrix.stream
sleuth
service-one的application.properties配置如下:
spring.zipkin.baseUrl=http://localhost:7082
spring.zipkin.enabled=true
依赖环境:redis、mysql
eureka-sever -> config-server -> service-one -> service-two -> sleuth
- 访问service-one接口:http://localhost:7074/testServiceTwo?a=1&b=1
- 传送可能有延迟,需要等几秒钟
- 访问sleuth系统:http://localhost:7082/
eureka-sever 7070
config-server 7072
service-one 7074
service-two 7075
service-two1 7067
ribbon 7071
zuul 7073
service-admin 7088
feign 7078
hystrix-dashboard 7080
sleuth 7082