Registry Center , In order to solve the problem of , Problems found by the service , in other words , service A Want to call service B, Need to know service B What's the address of , And the registry , This function is provided .
So service A And the service B, You need to send your own information to the Registration Center for registration .
Registry Center , If there is only one service , There will be a single point of failure , Cause the whole system to break down , Therefore, cluster deployment is used in production .
So there's a problem , How does the service register in the registry ? Register with any registry or all registries ?
Nacos&Eureka
Nacos&Eureka All are peer 2 peer The pattern of , So the general process of registration is the same .
service A Randomly find one Server, And then register , If registration fails , Just change to the next one Server To register .( service B Empathy )
stay peer 2 peer In mode , Every Server They are all equal , But when you register, you only go to one Server register , So each Server Data synchronization is required between .
Data synchronization includes 2 Kind of , One is incremental synchronization , One is full synchronization .
Incremental synchronization is usually performed during service registration or service information change , Synchronize services to other Server. Because synchronization is a time-consuming network request , It is usually put into the queue or cache , Synchronize with other threads .
Full synchronization usually occurs when the service initializes data or the current service finds itself in error , Get full data from other services .
peer 2 peer There's another problem , It's data consistency , That is to say AP Model or CP Model .
AP Higher performance , Data is weakly consistent .CP Poor performance , Data is strongly consistent .
Nacos Through temporary nodes and permanent nodes , Realization AP Models and CP Model .
Eureka yes CP Model .
Rocketmq
Rocketmq Of NameServer It's also a registry ,Broker When it starts , A scheduled task will be opened , To all of the cluster NameServer To register .
Due to network fluctuations or other problems , Data is also weakly consistent , At some point the data may not be the same .
Spark
Spark yes Master Slave Mode ( be based on ZooKeeper Persistence engine to illustrate ). That is, he has 2 individual Master, But one is ALIVE, One is STANDBY. Which is ALIVE node , By acquiring Zookeeper The temporary node of the .
When Worker Go to Master When registering ,Master In addition to Worker The information is stored in memory , Will the Worker Information on Zookeeper Is persistent in , This also ensures the consistency of the system .
When ALIVE After node downtime ,STANDBY It will start from Zookeeper In order to get Worker Data continues to provide services .
Hadoop
Hadoop High availability , It's also Master Slave Mode , And there is the federal model .
therefore DataNode When registering , You need to see how many federations there are , And to every federal Master Node registration .
that NameServer Where is your registration information stored ? When failover , How to restore the registration information ?