Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is Spring Cloud Eureka?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article shows you what Spring Cloud Eureka is. It is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Spring Cloud Eureka is a part of the Spring Cloud Netflix micro-service suite, which is re-encapsulated based on Netflix Eureka and is mainly responsible for implementing the service governance function in the micro-service architecture.

Spring Cloud Eureka is a REST-based service and provides Java-based client components, which can easily register the service with Spring Cloud Eureka for unified management.

Service governance is an essential part of micro-service architecture, and Ali's open source Dubbo framework is aimed at service governance. Service governance must have a registry. In addition to using Eureka as the registry, we can also use Consul, Etcd, Zookeeper, etc., as the registry for the service.

Readers who have used Dubbo should be aware that there are several registries in Dubbo, such as Zookeeper-based, Redis-based, etc., but the most frequently used is Zookeeper.

As for the use of either way, the registry is nothing more than managing the information and status of all services. If we use examples in our lives to illustrate, the author thinks that the 12306 website is more appropriate.

First of all, the 12306 website is like a registration center, and customers are like clients who call. When they need to take a train, they log on to 12306 website to inquire about the remaining tickets. If they have tickets, they can buy them, and then get the train number, time, etc., and finally leave.

The same is true of the program, when you need to call a service, you will first go to Eureka to pull the list of services to see if the service you call is in it, and then get the service address, port and other information, and then call.

The advantage of registries is that you don't need to know how many providers there are, you just need to pay attention to the registry, just as customers don't have to care about how many trains are running, just go to the 12306 website to see if there are tickets.

Why is Eureka more suitable as a registry than Zookeeper? This is mainly because Eureka is built on AP principles, while ZooKeeper is built on CP principles.

There is a famous CAP theorem in the field of distributed systems, that is, C is data consistency, An is service availability, and P is fault tolerance of services to network partition failures. These three features can not be satisfied at the same time in any distributed system, at most two at the same time.

Zookeeper has a Leader, and when this Leader is not available, a new Leader is elected by the Paxos (ZAB) algorithm. The task of this Leader is to ensure that only this Leader is written when the data is written, and the Leader will synchronize the information to other nodes. The consistency of the data can be ensured through this operation.

All in all, if you want to guarantee AP, you need to use Eureka, and if you want to guarantee CP, you need to use Zookeeper.

Most of the Dubbo is based on Zookeeper as the registry. Of course, Eureka is the first choice in Spring Cloud.

The above content is what Spring Cloud Eureka is. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report