概述
Eureka 简介
- 什么是eureka?
- eureka架构图
什么是eureka?
什么是eureka?
“eureka”是著名裸奔者阿基米德想到浮力定律后喊出来的。
不过现在它是Netflix著名的但已经停更的注册中心。
Eureka is a REST (Representational State Transfer) based service that is primarily used in the AWS cloud for locating services for the purpose of load balancing and failover of middle-tier servers. We call this service, the Eureka Server. Eureka also comes with a Java-based client component,the Eureka Client, which makes interactions with the service much easier. The client also has a built-in load balancer that does basic round-robin load balancing. At Netflix, a much more sophisticated load balancer wraps Eureka to provide weighted load balancing based on several factors like traffic, resource usage, error conditions etc to provide superior resiliency.
抓重点。
它是跑在亚马逊云(Amazon Web Services)上的基于REST的一个服务。
如果没有接触过亚马逊云,可以认为它和阿里云一样。
作用是 load balancing 和 failover of middle-tier servers。
即
- 负载均衡
- 给中间联系的服务器(即Eureka Server)出错的备用方案,也就是说,如果有Eureka Server挂掉了,解决方案是什么?
除了Eureka Server,还有一个组件:Eureka Client。
Eureka Client是和Eureka Server做交互的。在client端也有负载均衡。
eureka架构图
The architecture above depicts how Eureka is deployed at Netflix and this is how you would typically run it. There is one eureka cluster per region which knows only about instances in its region. There is at the least one eureka server per zone to handle zone failures.
这是在一个region上面部署的eureka cluster。这个region中的每一个eureka instance都知晓对方(仅在这个region中)。
每个zone中至少有一个eureka server。
那么,什么是region,什么是zone?
region是AWS上的地理位置。比如us-east,美国东部。
每个region中有很多高可用的相互隔离的zone,比如us-east-1c, us-east-1d, us-east-1e。但是各个zone可以通过低延迟的连接相互通信。
不同的zone之间的eureka能够replicate,即相互注册。
Eureka Client有两种:
- Application Service
- Application Client
即我们平常说的服务提供者和服务消费者。
Application Service对Eureka Server可以:
- 注册
- 更新注册信息
- 取消注册
- 拉取注册中心的注册表
Application Client对Eureka Server可以:
- 拉取注册中心的注册表,然后调用服务(remote call)
当然,Application Client也能注册、更新注册信息……
Services register with Eureka and then send heartbeats to renew their leases every 30 seconds. If the client cannot renew the lease for a few times, it is taken out of the server registry in about 90 seconds. The registration information and the renewals are replicated to all the eureka nodes in the cluster. The clients from any zone can look up the registry information (happens every 30 seconds) to locate their services (which could be in any zone) and make remote calls.
官网给了稍微具体的解释:
- Eureka Client每隔30秒要向Eureka Server发送心跳,来更新自己的租期。
- 如果Eureka Client几次都没有更新,90秒后就被Eureka Server移出注册中心。
- 在集群中,注册信息和更新信息会被同步到每一个eureka node(eureka peer)。
- 任何zone的Eureka Client每隔30秒可以去任何zone的Eureka Server查看注册表信息,登记注册,远程调用。
最后
以上就是笑点低便当为你收集整理的eureka的第一次窥探(源码解读一)的全部内容,希望文章能够帮你解决eureka的第一次窥探(源码解读一)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复