forked from mizhiming521/kubernetes-handbook
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# 微服务中的服务发现 | ||
|
||
在单体架构时,因为服务不会经常和动态迁移,所有服务地址可以直接在配置文件中配置,所以也不会有服务发现的问题。但是对于微服务来说,应用的拆分,服务之间的解耦,和服务动态扩展带来的服务迁移,服务发现就成了微服务中的一个关键问题。 | ||
|
||
服务发现分为**客户端服务发现**和**服务端服务发现**两种,架构如下图所示。 | ||
|
||
 | ||
|
||
这两种架构都各有利弊,我们拿客户端服务发现软件Eureka和服务端服务发现架构Kubernetes/SkyDNS+Ingress LB+Traefik+PowerDNS为例说明。 | ||
|
||
| 服务发现方案 | Pros | Cons | | ||
| :--------- | ----------------------------------- | ---------------------------------------- | | ||
| Eureka | 使用简单,适用于java语言开发的项目,比服务端服务发现少一次网络跳转 | 对非Java语言的支持不够好,Consumer需要内置特定的服务发现客户端和发现逻辑 | | ||
| Kubernetes | Consumer无需关注服务发现具体细节,只需知道服务的DNS域名即可 | 需要基础设施支撑,多了一次网络跳转,可能有性能损失 | | ||
|
||
## 参考 | ||
|
||
[谈服务发现的背景、架构以及落地方案](http://www.infoq.com/cn/articles/background-architecture-and-solutions-of-service-discovery) |