当前位置:网站首页>Nacos conformance protocol cp/ap/jraft/distro protocol
Nacos conformance protocol cp/ap/jraft/distro protocol
2022-07-07 15:22:00 【Grab】
Nacos Because we need to support the registration of multiple service types , And it can have the disaster recovery function of the computer room 、 Essential capabilities such as cluster expansion , Run simultaneously in a single cluster CP The protocol and AP Agreement two kinds of agreements . In the decision to use CP still AP⼀ Sexual time , Use ⼀ A broker , Forwarding through controllable rules .
current ⼀ Conformance protocol implementation ,⼀ It's based on Raft Of CP⼀ Sexual nature ,⼀ One is based on self-developed agreement Distro Of AP Uniformity .
Raft agreement
Nacosv1.x It's using Raft agreement ,v2.x Change it to JRaft agreement .Raft The agreement needs no more words , yes CP agreement , be based on Leader To write .
Distro agreement
Distro Agreement is Nacos Community self-developed ⼀ Kind of AP Distributed protocol , It is designed for temporary instances ⼀ Distributed protocol , It ensures that in some Nacos After node downtime , The whole temporary instance processing system can still work normally . Its data is stored in the cache , And full data synchronization will be carried out at startup , And conduct data verification regularly . Every Distro All nodes can receive read and write requests .
Distro The main design idea of the protocol is as follows :
- Nacos Each node is equal and can handle write requests , Synchronize new data to other nodes at the same time .
- Each node is only responsible for part of the data , Regularly send the verification value of your own data to other nodes to keep the data ⼀ Sexual nature .
- Each node handles read requests independently , Respond locally in a timely manner .
Distro How the protocol works :
- Data initialization , Newly added Distro The node will pull the full amount of data . The specific operation is to poll all Distro node , Pull the full amount of data by sending a request to other machines . After the full pull operation is completed ,Nacos All currently registered non persistent instance data are maintained on each machine .
- data verification , stay Distro After cluster startup , The heartbeat will be sent between the machines regularly for data verification . If the data of one machine is inconsistent with that of other machines , Then it will pull all the data to request to complete .
- Write operations , When a write request to register a non persistent instance hits a certain computer Nacos Server time , First by Filter Intercept , On request IP The port information is forwarded to the corresponding Distro Processing requests on the responsibility node .Distro The agreement will also be implemented regularly Sync Mission , Synchronize all the instance information of the local machine to other nodes .
- Read operations , Due to the full amount of data stored on each machine , So in every ⼀ In the first read operation ,Distro The machine will pull data directly from the local , Respond quickly .
Service registration found using AP agreement
To ensure availability , Try to ensure the service registration and discovery ability as much as possible, and can provide external services ,Nacos The service registration discovery of adopts the mechanism that heartbeat can automatically complete the service data compensation . If the data is lost , This mechanism can quickly compensate for data loss , And ensure final consistency .
Configuration management adopts CP agreement
The configuration data , Is directly in Nacos The server side creates and manages , You must ensure that most nodes have saved this configuration data before you can think that the configuration has been saved successfully . In order to avoid serious failure caused by missing configuration changes , Strong ⼀ Consensus algorithm , Ensure that most nodes in the cluster are strong ⼀ To .
Configuration center consistency protocol
Server Between the ⼀ Agreement on sex , Yes DB Pattern ( Read write separation architecture ),⼀ The core of consistence is Server And DB Keep the data ⼀ Sexual nature , To ensure that Server data ⼀ Cause .Server They are all equal , Write any data ⼀ individual Server, Priority persistence , After successful persistence, asynchronously notify other nodes to pull the latest configuration value from the database , And notify that the writing is successful .
Server Between the ⼀ Agreement on sex , nothing DB Pattern Server Inter use Raft Agreement guarantee data ⼀ Sexual nature .
SDK And Server Of ⼀ Agreement on sex , adopt MD5 Whether the value is ⼀ To realize , If you don't ⼀ To pull the latest value .
边栏推荐
- Ctfshow, information collection: web10
- Niuke real problem programming - day20
- 如何在opensea批量发布NFT(Rinkeby测试网)
- Do you know the relationship between the most important indicators of two strong wind control and the quality of the customer base
- Qu'est - ce qu'une violation de données
- What are the safest securities trading apps
- Comparable and comparator of sorting
- 【数字IC验证快速入门】26、SystemVerilog项目实践之AHB-SRAMC(6)(APB协议基本要点)
- CTFshow,信息搜集:web5
- 从 1.5 开始搭建一个微服务框架链路追踪 traceId
猜你喜欢
Wechat applet 01
【深度学习】图像超分实验:SRCNN/FSRCNN
【OBS】RTMPSockBuf_Fill, remote host closed connection.
数学建模——什么是数学建模
[understanding of opportunity -40]: direction, rules, choice, effort, fairness, cognition, ability, action, read the five layers of perception of 3GPP 6G white paper
Window环境下配置Mongodb数据库
Used by Jetson AgX Orin canfd
Unity之ASE实现全屏风沙效果
MySQL installation configuration 2021 in Windows Environment
Ctfshow, information collection: web6
随机推荐
Introduction of mongod management database method
Ctfshow, information collection: web2
微信小程序 01
2.Golang基础知识
知否|两大风控最重要指标与客群好坏的关系分析
Briefly describe the working principle of kept
[deep learning] semantic segmentation experiment: UNET network /msrc2 dataset
【深度学习】图像超分实验:SRCNN/FSRCNN
【数字IC验证快速入门】22、SystemVerilog项目实践之AHB-SRAMC(2)(AMBA总线介绍)
There is a cow, which gives birth to a heifer at the beginning of each year. Each heifer has a heifer at the beginning of each year since the fourth year. Please program how many cows are there in the
MySQL installation configuration 2021 in Windows Environment
What are the safest securities trading apps
【數據挖掘】視覺模式挖掘:Hog特征+餘弦相似度/k-means聚類
Summer safety is very important! Emergency safety education enters kindergarten
2022全开源企业发卡网修复短网址等BUG_2022企业级多商户发卡平台源码
Ctfshow, information collection: web13
[understanding of opportunity -40]: direction, rules, choice, effort, fairness, cognition, ability, action, read the five layers of perception of 3GPP 6G white paper
Nacos一致性协议 CP/AP/JRaft/Distro协议
Do you know the relationship between the most important indicators of two strong wind control and the quality of the customer base
buffer overflow protection