Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spring-cloud-learn
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
spring-cloud-learn
Commits
6763b5ac
Commit
6763b5ac
authored
Sep 03, 2019
by
duanledexianxianxian
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add zuul api gateway
parent
0643fdba
Pipeline
#113
failed
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
93 additions
and
0 deletions
+93
-0
README.md
README.md
+36
-0
spring-cloud-hello-world/pom.xml
spring-cloud-hello-world/pom.xml
+1
-0
spring-cloud-hello-world/zuul-api-gateway/pom.xml
spring-cloud-hello-world/zuul-api-gateway/pom.xml
+24
-0
spring-cloud-hello-world/zuul-api-gateway/src/main/java/com/duanledexian/spring/cloud/zuul/SpringZuulApiGatewayServiceApplication.java
...ng/cloud/zuul/SpringZuulApiGatewayServiceApplication.java
+19
-0
spring-cloud-hello-world/zuul-api-gateway/src/main/resources/application.yml
...world/zuul-api-gateway/src/main/resources/application.yml
+13
-0
No files found.
README.md
View file @
6763b5ac
...
@@ -26,6 +26,41 @@ springboot与spring cloud兼容版本
...
@@ -26,6 +26,41 @@ springboot与spring cloud兼容版本
9300-9399:统一配置中心
9300-9399:统一配置中心
9400-9499:服务网关
### 服务网关
服务网关的作用:
**网关作为对外的门户,实现动态路由、监控、授权、安全、调度等功能。**
Spring Cloud Gateway VS Zuul
1.
**开源组织**
Spring Cloud Gateway 是 Spring Cloud 微服务平台的一个子项目,属于 Spring 开源社区,依赖名叫:spring-cloud-starter-gateway。
Zuul 是 Netflix 公司的开源项目,Spring Cloud 在 Netflix 项目中也已经集成了 Zuul,依赖名叫:spring-cloud-starter-netflix-zuul。
2.
**底层实现**
Zuul构建于 Servlet 2.5,兼容 3.x,使用的是阻塞式的 API,不支持长连接,比如 websockets。另外
Spring Cloud Gateway构建于 Spring 5+,基于 Spring Boot 2.x 响应式的、非阻塞式的 API。同时,它支持 websockets,和 Spring 框架紧密集成,开发体验相对来说十分不错。
3.
**性能表现**
这个没什么好比的,要比就和 Zuul 2.x 比,Zuul 2.x 在底层上有了很大的改变,使用了异步无阻塞式的 API,性能改善明显,不过现在 Spring Cloud 也没集成 Zuul 2.x,所以就没什么好比的。
Spring Cloud Gateway 是 Spring Cloud Finchley 版推出来的新组件,用来代替服务网关:Zuul。
(Zuul 指 Zuul 1.xSpring cloud未集成Zuul 2.x且 Spring Cloud 貌似没有整合计划,看了下目前最新的包,整合的还是 Zuul 1.x
**Spring Cloud Gateway,使用起来比 Zuul 更简单,配置更方便,所以说选 Spring Cloud Gateway 没错,毕竟是 Spring Cloud 亲儿子,不会始乱终弃。**
### 分布式服务跟踪
### 分布式服务跟踪
分布式服务跟踪标准
**Open Tracing**
,与实现平台无关、厂商无关的分布式服务跟踪;
分布式服务跟踪标准
**Open Tracing**
,与实现平台无关、厂商无关的分布式服务跟踪;
...
@@ -72,4 +107,5 @@ springboot与spring cloud兼容版本
...
@@ -72,4 +107,5 @@ springboot与spring cloud兼容版本
3.
https://www.jianshu.com/p/e148afe66367
3.
https://www.jianshu.com/p/e148afe66367
4.
https://natapp.cn/article/natapp_newbie
4.
https://natapp.cn/article/natapp_newbie
5.
https://my.oschina.net/u/3266761/blog/2245498
5.
https://my.oschina.net/u/3266761/blog/2245498
6.
https://segmentfault.com/a/1190000019137876?utm_source=tag-newest
spring-cloud-hello-world/pom.xml
View file @
6763b5ac
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
<module>
config-server
</module>
<module>
config-server
</module>
<module>
user-service
</module>
<module>
user-service
</module>
<module>
order-service
</module>
<module>
order-service
</module>
<module>
zuul-api-gateway
</module>
</modules>
</modules>
<dependencies>
<dependencies>
...
...
spring-cloud-hello-world/zuul-api-gateway/pom.xml
0 → 100644
View file @
6763b5ac
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
spring-cloud-hello-world
</artifactId>
<groupId>
com.duanledexian.spring.cloud
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
zuul-api-gateway
</artifactId>
<dependencies>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-client
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-zuul
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
spring-cloud-hello-world/zuul-api-gateway/src/main/java/com/duanledexian/spring/cloud/zuul/SpringZuulApiGatewayServiceApplication.java
0 → 100644
View file @
6763b5ac
package
com.duanledexian.spring.cloud.zuul
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.netflix.zuul.EnableZuulProxy
;
/**
* zuul api zuul
*
* @author Administrator
*/
@EnableZuulProxy
@SpringBootApplication
public
class
SpringZuulApiGatewayServiceApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
SpringZuulApiGatewayServiceApplication
.
class
,
args
);
}
}
spring-cloud-hello-world/zuul-api-gateway/src/main/resources/application.yml
0 → 100644
View file @
6763b5ac
server
:
# 服务器端口
port
:
9400
eureka
:
client
:
serviceUrl
:
defaultZone
:
http://localhost:9000/eureka/
spring
:
application
:
name
:
zuul-api-zuul
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment