This commit is contained in:
baidu 2018-05-26 16:35:44 +08:00
parent e60ad1ad74
commit 4ed6abf4ea

View File

@ -1,20 +1,22 @@
# Eureka+Zuul+Feign+Hystrix构建微服务架构
最近研究了微服务搭建了高可用的demo。
本文参考了https://github.com/forezp/SpringCloudLearning 如有侵权,请告知笔者。
## 首先介绍下微服务
微服务最早由Martin Fowler与James Lewis于2014年共同提出微服务架构风格是一种使用一套小服务来开发单个应用的方式途径每个服务运行在自己的进程中并使用轻量级机制通信通常是HTTP API这些服务基于业务能力构建并能够通过自动化部署机制来独立部署这些服务使用不同的编程语言实现以及不同数据存储技术并保持最低限度的集中式管理
可以不错的科普文章: https://blog.csdn.net/wuxiaobingandbob/article/details/78642020?locationNum=1&fps=1
微服务最早由Martin Fowler与James Lewis于2014年共同提出微服务架构风格是一种使用一套小服务来开发单个应用的方式途径每个服务运行在自己的进程中并使用轻量级机制通信通常是HTTP API这些服务基于业务能力构建并能够通过自动化部署机制来独立部署这些服务使用不同的编程语言实现以及不同数据存储技术并保持最低限度的集中式管理
可以不错的科普文章: https://blog.csdn.net/wuxiaobingandbob/article/details/78642020?locationNum=1&fps=1
## 微服务解决的问题:
微服务架构模式Microservices Architecture Pattern的目的是将大型的、复杂的、长期运行的应用程序构建为一组相互配合的服务每个服务都可以很容易得局部改良
这里有一个图非常好的总结微服务架构需要考虑的问题,包括
1API Gateway
2服务间调用
3服务发现
4服务容错
5服务部署
6数据调用
微服务架构模式Microservices Architecture Pattern的目的是将大型的、复杂的、长期运行的应用程序构建为一组相互配合的服务每个服务都可以很容易得局部改良
这里有一个图非常好的总结微服务架构需要考虑的问题,包括
1API Gateway
2服务间调用
3服务发现
4服务容错
5服务部署
6数据调用
## Spring-cloud微服务框架
Spring Cloud Netflix provides Netflix OSS integrations for Spring Boot apps through autoconfiguration and binding to the Spring Environment and other Spring programming model idioms. With a few simple annotations you can quickly enable and configure the common patterns inside your application and build large distributed systems with battle-tested Netflix components. The patterns provided include Service Discovery (Eureka), Circuit Breaker (Hystrix), Intelligent Routing (Zuul) and Client Side Load Balancing (Ribbon)..
@ -30,6 +32,7 @@
![demo](https://github.com/lonefeifei/SpringCloudLearning/blob/master/chapter15/demo1.png)
说明:
1.每个服务均为单点,无法满足高可用
2.代码可参考https://github.com/lonefeifei/SpringCloudLearning/tree/master/chapter5
@ -39,6 +42,7 @@
![demo](https://github.com/lonefeifei/SpringCloudLearning/blob/master/chapter15/demo2.png)
说明:
0.架构中, 服务网关作为入口统一对外提供服务业务层实现业务需求通过feign与数据层交互并通过hystrix进行过载保护ribbon进行负载均衡数据层作为数据服务通过http对外提供服务
1.各服务均为集群部署模式
@ -92,7 +96,7 @@ eureka:
```
4.业务层实现业务需求通过feign与数据层交互并通过hystrix进行过载保护ribbon进行负载均衡 部署多个实例即可在配置eureka服务端时将2中两个eureka实例增多添加上即可。
5. 服务网关作为入口统一对外提供服务部署多个实例在配置eureka服务端时将2中两个eureka实例增多添加上即可。
5.服务网关作为入口统一对外提供服务部署多个实例在配置eureka服务端时将2中两个eureka实例增多添加上即可。
6.nginx作为代理可在不同网关实例中进行负载均衡(本文未实现)。
@ -156,8 +160,7 @@ java -jar service-zuul-0.0.1-SNAPSHOT.jar --server.port=8769
architectural termhttps://martinfowler.com/articles/microservices.html
微服务架构(一):什么是微服务
https://blog.csdn.net/fly_zhyu/article/details/
76408158
https://blog.csdn.net/fly_zhyu/article/details/76408158
微服务技术调研与实践
https://www.jianshu.com/p/0c29ebffced3