基于共识的分布式数据库协同算法及其在 Neo4j 集群中的实现.pptx

上传人(卖家):无敌的果实 文档编号:2519600 上传时间:2022-04-28 格式:PPTX 页数:71 大小:4.23MB
下载 相关 举报
基于共识的分布式数据库协同算法及其在 Neo4j 集群中的实现.pptx_第1页
第1页 / 共71页
基于共识的分布式数据库协同算法及其在 Neo4j 集群中的实现.pptx_第2页
第2页 / 共71页
基于共识的分布式数据库协同算法及其在 Neo4j 集群中的实现.pptx_第3页
第3页 / 共71页
基于共识的分布式数据库协同算法及其在 Neo4j 集群中的实现.pptx_第4页
第4页 / 共71页
基于共识的分布式数据库协同算法及其在 Neo4j 集群中的实现.pptx_第5页
第5页 / 共71页
亲,该文档总共71页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

1、 4- 5.5 6 21 L 4 3 1 ?Error!503: Service Unavailable()Error!503: Service Unavailable()Error!503: Service Unavailable (Core)(Read Replica) () Raft/Core Bolt/Read Replica bookmarkRaft Raft https:/ y3 x4 zxLogLogx1 y3 x4 zxx1 y3 x4 zx (Byzantine)Raft 1. /Leader: (Leader) (Follower)2. Leader Leader3. Le

2、aderRaft : Leader : Leader : (Term) Leader: Leader : LeaderFollowerdiscoverhighertermnoheartbeat RequestVote RPCsLeaderCandidatewinelection AppendEntries RPCs: Leader/TermsTerm 1 Term 2Term 3Term 4Term 5 Leader Leader() () RPC Follower RPC? Raft - LeaderS1: 1S2: 1S3: 1LeaderFollowerCandidateRaft - L

3、eader()S1: 1S2: 1S3: 1T,2TTRaft - Leader()RequestVoteRequestS1: 1S2: 1S3: 1S1RequestVoteRequest RPCRaft - Leader() RequestVoteResposeS1: 1S2: 1S3: 1Raft - Leader()LeadercurrentTerm+, RequestVote RPCsLeaderRPCLeaderFollowerRaft S L 3 SL L2112a22b32cS1: 1 2S2: 1S3: 1Raft () S L 3 SL L2112a22b32c42d52e

4、62fS1: 2S2: 2S3: 212a22b12aRaft - () Leader Leader Leader AppendEntries RPCsFollower : Leader LeaderAppendEntries RPCsFollower Followers Followers? LeaderAppendEntries RPCs RPCRaft - 123456789101112233333s1s2s3s4s53Leaderx3 q8 j2 xq z5 y1 y3 qj x4 z61112233x3 q8 j2 xq z5 y1 y31112233333x3 q8 j2 xq z

5、5 y1 y3 qj x4 z6Follower11x3 q811122333x3 q8 j2 xq z5 y1 y3 qjRaft 1234567891011122333s1s2s3s4s5x3 q8 j2 xq z5 y1 y3 qj1112233x3 q8 j2 xq z5 y1 y31112233333 Leader x3 q8 j2 xq z5 y1 y3 qj x4Follower11x3 q8111222222x3 q8 j2 xq z5 y3 qj x8 x4Raft LeaderRaft : 123456789101112233333x3 q8 j2 xq z5 y1 y3

6、qj x4 z611122344x3 q8 j2 xq z5 y1 xz y7 Raft - AppendEntries AppendEntries RPCs Follower Leader12341234512345112311231123leader:x3 q8 xq y1x3 q8 xq y1x3 q8 xq y11121111111111follower before:follower after:x3 q8 xqx3 q8 j2 y6 axx3 q8 j2 y6 ax1111111231123x3 q8 j2 y6 y6x3 q8 xq y1x3 q8 xq y1Example #1

7、: successExample #2: mismatchExample #3: successRaft Leader LeaderLeader Leader:Term 4Leader?1 2 3 4 5 6 7 8 9 RequestVote RPCss11 1 1 2 2 3 3 3 1s2 1 1 2 2 3 3 1 1 1 s3 2 2 3 3 3 3 1 1 1s4 2 2 3 3 3 1 1 1 2 2 2 2 2 2s5Leader? () currentTerm LeaderLeader? ()( currentTermLeader? () currentTerm Leader

8、888driversbolt+routing:/database() ()()()Mission Impossible!http:/ need tologin in tocontinueyourpurchase!LoginRegisterYou need tologin in tocontinueyourUsername:Password:purchase!LoginRegisterCreate AccountYou need tologin in tocontinueyourUsername:yufanghuaPassword:purchase!*LoginRegisterCreate Ac

9、countYou need tologin in tocontinueyourUsername:Password:purchase!LoginRegisterLoginUsername:yufanghuaPassword:*LoginNo accountfound!Username:yufanghua!Password:*LoginTry again.Username:yufanghuaPassword:*Login.LoginSuccessfuUsername:yufanghuaPassword:*LoginPurchaseQ?A(Eventual Consistency)App Serve

10、rA0000011111222223333344444555556666677777888889999910DriverCreate Account10App ServerADriverCreate AccountCREATE (:User)000001111122222333334444455555666667777788888999991010App ServerADriverCreate AccountCREATE (:User)0000011111222223333344444555556666677777888889999910 1110App ServerADriverCreate

11、 AccountCREATE (:User)0000011111222223333344444555556666677777888889999910 1110 11App ServerADriverCreate AccountCREATE (:User)0000011111222223333344444555556666677777888889999910 1110 11App ServerADriverCreate AccountCREATE (:User)0000011111222223333344444555556666677777888889999910 1110 11App Serv

12、erADriverCreate AccountCREATE (:User)0000011111222223333344444555556666677777888889999910 111010 1110App Server ADriverCreate AccountCREATE (:User)0000011111222223333344444555556666677777888889999910 111010 1110AppServer B DriverLoginMATCH (:User)App ServerADriverCreate AccountCREATE (:User)00000111

13、11222223333344444555556666677777888889999910 111010 1110AppServer B DriverLoginMATCH (:User)(Bookmark) String() App ServerADriverCreate AccountCREATE (:User)0000011111222223333344444555556666677777888889999910 1110 11App ServerACreateDriverAccountCREATE (:User)000001111122222333334444455555666667777

14、7888889999910 1110 11App ServerADriverCreate AccountCREATE (:User)0000011111222223333344444555556666677777888889999910 111010 1110App ServerADriverCreate AccountCREATE (:User)0000011111222223333344444555556666677777888889999910 111010 1110App ServerBDriverLoginMATCH (:User)App ServerADriverCreate Ac

15、countCREATE (:User)0000011111222223333344444555556666677777888889999910 111010 1110AppServer B DriverLoginMATCH (:User)10AppServer A DriverCreate AccountCREATE (:User)0000011111222223333344444555556666677777888889999910 111010 1110AppServer B DriverLoginMATCH (:User)10 11App ServerADriverCreate Acco

16、untCREATE (:User)0000011111222223333344444555556666677777888889999910 111010 1110App ServerBDriverLoginMATCH (:User)10 11try ( Session session = driver.session( AccessMode.WRITE ) )try ( Transaction tx = session.beginTransaction() )tx.run( CREATE (user:User userId: userId, passwordHash: passwordH as

17、h),parameters( userId , userId , passwordHash , passwordH ash ) ) ;tx.success() ;String bookmark = session.lastBookmark () ;try ( Session session = driver.session( AccessMode.READ ) )try ( Transaction tx = session.beginTransaction( bookmark ) )tx.run( MATCH (user:User userId: userId) RETURN * ,parameters( userId , userId ) ) ;tx.success() ;3.23.13.0

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 办公、行业 > 常用办公文档
版权提示 | 免责声明

1,本文(基于共识的分布式数据库协同算法及其在 Neo4j 集群中的实现.pptx)为本站会员(无敌的果实)主动上传,163文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。
2,用户下载本文档,所消耗的文币(积分)将全额增加到上传者的账号。
3, 若此文所含内容侵犯了您的版权或隐私,请立即通知163文库(发送邮件至3464097650@qq.com或直接QQ联系客服),我们立即给予删除!


侵权处理QQ:3464097650--上传资料QQ:3464097650

【声明】本站为“文档C2C交易模式”,即用户上传的文档直接卖给(下载)用户,本站只是网络空间服务平台,本站所有原创文档下载所得归上传人所有,如您发现上传作品侵犯了您的版权,请立刻联系我们并提供证据,我们将在3个工作日内予以改正。


163文库-Www.163Wenku.Com |网站地图|