Nacos对Raft算法的实现
必须懂raft算法, nacos使用这套算法是由客户端 请求参数决定,nacos自带内存短暂存储AP和raft算法的CP
package com.alibaba.nacos.naming.controllers;
1 | public static final String NACOS_SERVER_VERSION = "/v1"; |
投票
1 |
|
receivedVote
1 | /** |
心跳
1 |
|
receivedBeat
1 | /** |
makeLeader
1 | public RaftPeer makeLeader(RaftPeer candidate) { |
集群更新
1 |
|
RaftCore
1 |
|
init()
1 |
|
Notifier
1 | public class Notifier implements Runnable { |
MasterElection
1 | public class MasterElection implements Runnable { |
HeartBeat
1 | public class HeartBeat implements Runnable { |
日志备份
publish
1 |
|
signalPublish
1 | public void signalPublish(String key, Record value) throws Exception { |
commit
1 | "/datum/commit") ( |
- 本文作者: 忘忧症
- 本文链接: https://NepenthesZGW.github.io/2020/09/08/framework/SpringCloud/Nacos/Nacos源码/
- 版权声明: 本博客所有文章除特别声明外,均采用 MIT 许可协议。转载请注明出处!