technology-note/java/springcloud实战/4.springCloud之Zuul服务路由.md
2019-01-07 10:31:40 +08:00

21 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id="2019-01-03-19-19"
title="springCloud学习4Zuul服务路由"
headWord="像微服务这样的分布式架构中,需要确保跨多个服务调用的关键行为(如安全、日志记录、用户跟踪等)能够正常运行,这就需要一个服务网关来统一处理。"
tags=["spring-boot", "spring-cloud","netflix-zuul","service-gateway"]
category="java"
serie="springCloud实战"
---
<span id="personBlogId" value="2019-01-03-19-19"/>
# 一、背景
&emsp;&emsp;微服务架构将一个应用拆分为很多个微小应用,这样会导致之前不是问题的问题出现,比如:
1. 安全问题如何实现?
2. 日志记录如何实现?
3. 用户跟踪如何实现?
上面的问题在传统的单机应用很容易解决,只需要当作一个功能实现即可。但是在微服务中就行不通了,让每个服务都实现一份上述功能,那是相当不现实的,费时,费力还容易出问题。为了解决这个问题,需要将这些横切关注点(分布式系统级别的横切关注点和 spring 中的基本一个意思)抽象成一个独立的且作为应用程序中所有微服务调用的过滤器和路由器的服务。这样的服务被称为————**服务网管(service gateway)**服务客户端不再直接调用服务。取而代之的是服务网关作为单个策略执行点Policy Enforcement Point,PEP) , 所有调用都通过服务网管进行路由,然后被送到目的地, asd发生的 ,,,阿斯蒂芬😊