环境
2节点集群

[gbase@gbase_rh7_001 log]$ gcadmin
CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  NORMAL=============================================================
|           GBASE COORDINATOR CLUSTER INFORMATION           |
=============================================================
|   NodeName   | IpAddress  | gcware | gcluster | DataState |
-------------------------------------------------------------
| coordinator1 | 10.0.2.101 |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------
| coordinator2 | 10.0.2.115 |  OPEN  |   OPEN   |     0     |
-------------------------------------------------------------
=========================================================================================================
|                                    GBASE DATA CLUSTER INFORMATION                                     |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |                10.0.2.101                |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |                10.0.2.115                |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------

第一节点启动日志
本机的nodeid
该id将作为选举时的标识。

Mar 28 16:25:44.504496 NOTIC [MAIN  ] local nodeid:1694629898
Mar 28 16:25:44.504500 NOTIC [MAIN  ] bind addr:10.0.2.101

vote部分
其中如下部分,节点转化角色为候选人。

node 1694629898 switch to candidateMar 28 16:25:47.541343 NOTIC [GCWARE] begin load CCS meta
Mar 28 16:25:47.541347 NOTIC [GCWARE] finish load raft meta with term: 36019, voteFor:1694629898
Mar 28 16:25:47.541351 INFO  [GCWARE] open raft log file /opt/gbase/gcware/data/gcware/REDOLOG.111899 for load success, fd:11
Mar 28 16:25:47.541355 INFO  [GCWARE] close raft log /opt/gbase/gcware/data/gcware/REDOLOG.111899, fd:11
Mar 28 16:25:47.541359 INFO  [GCWARE] open raft log file /opt/gbase/gcware/data/gcware/REDOLOG.112041 for load success, fd:11
Mar 28 16:25:47.541363 INFO  [GCWARE] close raft log /opt/gbase/gcware/data/gcware/REDOLOG.112041, fd:11
Mar 28 16:25:47.541367 INFO  [GCWARE] open raft log file /opt/gbase/gcware/data/gcware/REDOLOG.112845 for load success, fd:11
Mar 28 16:25:47.591568 INFO  [GCWARE] close raft log /opt/gbase/gcware/data/gcware/REDOLOG.112845, fd:11
Mar 28 16:25:47.591596 INFO  [GCWARE] Showy: PN5GBCCS9TcpClientE::CreateEventWithNodeid start, ip 10.0.2.101 port 5918 nodeid 1694629898
Mar 28 16:25:47.591602 INFO  [GCWARE] Showy: PN5GBCCS9TcpClientE::CreateEventWithNodeid ok, ip 10.0.2.101 port 5918 nodeid 1694629898
Mar 28 16:25:47.591607 INFO  [GCWARE] Showy: PN5GBCCS9TcpClientE::CreateEventWithNodeid start, ip 10.0.2.115 port 5918 nodeid 1929510922
Mar 28 16:25:47.591765 INFO  [GCWARE] Showy: PN5GBCCS9TcpClientE::CreateEventWithNodeid ok, ip 10.0.2.115 port 5918 nodeid 1929510922
Mar 28 16:25:47.591771 INFO  [GCWARE] node 1694629898 switch to follower with term:36019 leader:0
Mar 28 16:25:47.591776 NOTIC [GCWARE] client server begin provide service
Mar 28 16:25:47.591889 INFO  [GCWARE] open raft log file /opt/gbase/gcware/data/gcware/REDOLOG.112845 for append success, fd:23
Mar 28 16:25:47.591899 NOTIC [GCWARE] client server event loop start
Mar 28 16:25:47.591903 NOTIC [GCWARE] client server acceptor begin
Mar 28 16:25:47.591907 WARN  [GCWARE] Imp: PN5GBCCS11TcpAcceptorE::run start accept...
Mar 28 16:25:47.591911 INFO  [GCWARE] Showy: PN5GBCCS11TcpAcceptorE::run accepted!, fd 24 ip  port 0
Mar 28 16:25:51.523786 INFO  [GCWARE] node 1694629898 switch to candidate
Mar 28 16:25:51.524076 INFO  [GCWARE] vote req from 1694629898, term:36020, candidate:1694629898, term:36019,index:117353,mine term:36019 index:117353, previous vote:0, current vote :1694629898 grant:1
Mar 28 16:25:51.533938 INFO  [GCWARE] finish save raft meta with term: 36020, voteFor:0
Mar 28 16:25:51.538713 INFO  [GCWARE] finish save raft meta with term: 36020, voteFor:1694629898
Mar 28 16:25:51.538840 INFO  [GCWARE] dealVoteRpcRes node 1694629898 grant me with term 36020

每隔一段时间,就会发起一次vote,直到成功,间隔大约在2-3秒。

当第二节点启动后的vote
其中如下代表收到了2个节点的投票信息,分别来自1694629898(本机)和另一个节点1929510922,然后1694629898转换成为了leader。

Mar 28 16:28:46.654368 INFO  [GCWARE] ignore message with lower term 36042 from 1929510922
Mar 28 16:28:47.567140 INFO  [GCWARE] node 1694629898 switch to candidate
Mar 28 16:28:47.567662 INFO  [GCWARE] vote req from 1694629898, term:36075, candidate:1694629898, term:36019,index:117353,mine term:36019 index:117353, previous vote:0, current vote :1694629898 grant:1
Mar 28 16:28:47.577373 INFO  [GCWARE] finish save raft meta with term: 36075, voteFor:0
Mar 28 16:28:47.582410 INFO  [GCWARE] dealVoteRpcRes node 1929510922 grant me with term 36075
Mar 28 16:28:47.585308 INFO  [GCWARE] finish save raft meta with term: 36075, voteFor:1694629898
Mar 28 16:28:47.585368 INFO  [GCWARE] dealVoteRpcRes node 1694629898 grant me with term 36075
Mar 28 16:28:47.585377 INFO  [GCWARE] node 1694629898 switch to leader with term:36075
Mar 28 16:28:47.585413 NOTIC [GCWARE] broadcast node state 1694629898 1
Mar 28 16:28:47.585538 NOTIC [GCWARE] broadcast node state 1929510922 0
Mar 28 16:28:47.585550 INFO  [GCWARE] statemachine sync with leader change from 0 to 1
Mar 28 16:28:47.585557 INFO  [GCWARE] follower state change 1929510922 from 0 to 1

第二节点启动日志
本机nodeid

Mar 28 16:28:41.005302 NOTIC [MAIN  ] local nodeid:1929510922
Mar 28 16:28:41.005307 NOTIC [MAIN  ] bind addr:10.0.2.115

vote部分
其中如下部分,节点转化角色为候选者,参与选举

Mar 28 16:28:46.648791 INFO  [GCWARE] node 1929510922 switch to candidate
Mar 28 16:28:46.649058 INFO  [GCWARE] vote req from 1929510922, term:36042, candidate:1929510922, term:36019,index:117353,mine term:36019 index:117353, previous vote:0, current vote :1929510922 grant:1
Mar 28 16:28:46.656952 INFO  [GCWARE] finish save raft meta with term: 36042, voteFor:0
Mar 28 16:28:46.661778 INFO  [GCWARE] finish save raft meta with term: 36042, voteFor:1929510922
Mar 28 16:28:46.661952 INFO  [GCWARE] dealVoteRpcRes node 1929510922 grant me with term 36042

选举结果出来了,其转成追随者。

Mar 28 16:28:47.562433 INFO  [GCWARE] node 1929510922 switch to follower with term:36075 leader:0
Mar 28 16:28:47.562463 INFO  [GCWARE] vote req from 1694629898, term:36075, candidate:1694629898, term:36019,index:117353,mine term:36019 index:117353, previous vote:0, current vote :1694629898 grant:1
Mar 28 16:28:47.571320 INFO  [GCWARE] finish save raft meta with term: 36075, voteFor:0
Mar 28 16:28:47.577133 INFO  [GCWARE] finish save raft meta with term: 36075, voteFor:1694629898

该部分日志

Mar 28 16:28:44.062948 NOTIC [GCWARE] client server begin provide service
Mar 28 16:28:44.063293 INFO  [GCWARE] open raft log file /opt/gbase/gcware/data/gcware/REDOLOG.112845 for append success, fd:24
Mar 28 16:28:44.063314 NOTIC [GCWARE] client server event loop start
Mar 28 16:28:44.063322 NOTIC [GCWARE] client server acceptor begin
Mar 28 16:28:46.648791 INFO  [GCWARE] node 1929510922 switch to candidate
Mar 28 16:28:46.649058 INFO  [GCWARE] vote req from 1929510922, term:36042, candidate:1929510922, term:36019,index:117353,mine term:36019 index:117353, previous vote:0, current vote :1929510922 grant:1
Mar 28 16:28:46.656952 INFO  [GCWARE] finish save raft meta with term: 36042, voteFor:0
Mar 28 16:28:46.661778 INFO  [GCWARE] finish save raft meta with term: 36042, voteFor:1929510922
Mar 28 16:28:46.661952 INFO  [GCWARE] dealVoteRpcRes node 1929510922 grant me with term 36042
Mar 28 16:28:47.562433 INFO  [GCWARE] node 1929510922 switch to follower with term:36075 leader:0
Mar 28 16:28:47.562463 INFO  [GCWARE] vote req from 1694629898, term:36075, candidate:1694629898, term:36019,index:117353,mine term:36019 index:117353, previous vote:0, current vote :1694629898 grant:1
Mar 28 16:28:47.571320 INFO  [GCWARE] finish save raft meta with term: 36075, voteFor:0
Mar 28 16:28:47.577133 INFO  [GCWARE] finish save raft meta with term: 36075, voteFor:1694629898
Mar 28 16:28:47.970905 INFO  [GCWARE] Showy: PN5GBCCS11TcpAcceptorE::run accepted!, fd 34 ip  port 0
Mar 28 16:28:48.134417 ERROR [GCWARE] previous log not exist index:117356, term:36075
Mar 28 16:28:48.134551 ERROR [GCWARE] previous log not exist index:117356, term:36075
Mar 28 16:28:48.135124 WARN  [GCWARE] log already exist index:117354, term:36075
Mar 28 16:28:48.149216 INFO  [GCWARE] node 1694629898 state plan change to 0
Mar 28 16:28:48.149247 INFO  [GCWARE] node 1694629898 state change to 0
Mar 28 16:28:48.149253 INFO  [GCWARE] node 1929510922 state plan change to 1
Mar 28 16:28:48.149258 INFO  [GCWARE] node 1929510922 state change to 1
Mar 28 16:28:48.149262 INFO  [GCWARE] CCS create session 31899,1,1,112850,21

当前leader节点服务停止启动
第一个节点服务停止

[gbase@gbase_rh7_001 log]$ gcluster_services gcware stop
Stopping gcware :

第一节点日志

Mar 28 16:40:19.910979 NOTIC [CRM   ] [DEBUG]: crm_exec_exit_fn [ENTER]
Mar 28 16:40:19.910983 INFO  [CRM   ] crm switch snapshot begin!
Mar 28 16:40:19.910988 NOTIC [LCK   ] [INFO]: lck_sync_data_abort
Mar 28 16:40:19.910992 NOTIC [LCK   ] [INFO]: lck_sync_data_abort end
Mar 28 16:40:19.910995 INFO  [CRM   ] crm switch snapshot end!
Mar 28 16:40:19.910999 NOTIC [CRM   ] [DEBUG]: crm_exec_exit_fn [LEAVE]
Mar 28 16:40:19.911267 NOTIC [MAIN  ] Cluster Consist Service Engine exiting with status 0 at main.c:2381.

从第二个节点看,leader从1变成了0, 节点变化角色为选举者,并发起了投票。

Mar 28 16:40:20.839295 INFO  [GCWARE] statemachine sync with leader change from 1 to 0
Mar 28 16:40:20.839381 INFO  [GCWARE] node 1929510922 switch to candidate
Mar 28 16:40:20.839391 INFO  [GCWARE] vote req from 1929510922, term:36076, candidate:1929510922, term:36075,index:117545,mine term:36075 index:117545, previous vote:0, current vote :1929510922 grant:1
Mar 28 16:40:20.844925 INFO  [GCWARE] finish save raft meta with term: 36076, voteFor:0
Mar 28 16:40:20.849696 INFO  [GCWARE] finish save raft meta with term: 36076, voteFor:1929510922
Mar 28 16:40:20.849851 INFO  [GCWARE] dealVoteRpcRes node 1929510922 grant me with term 36076
Mar 28 16:40:23.417719 INFO  [GCWARE] node 1929510922 switch to candidate
Mar 28 16:40:23.417939 INFO  [GCWARE] vote req from 1929510922, term:36077, candidate:1929510922, term:36075,index:117545,mine term:36075 index:117545, previous vote:0, current vote :1929510922 grant:1
Mar 28 16:40:23.422567 INFO  [GCWARE] finish save raft meta with term: 36077, voteFor:0
Mar 28 16:40:23.427721 INFO  [GCWARE] finish save raft meta with term: 36077, voteFor:1929510922
Mar 28 16:40:23.427853 INFO  [GCWARE] dealVoteRpcRes node 1929510922 grant me with term 36077
第一个节点服务被monit自动拉起后,该节点成为了follower。Mar 28 16:40:26.956760 INFO  [GCWARE] node 1694629898 switch to follower with term:36078 leader:0
Mar 28 16:40:26.956883 INFO  [GCWARE] vote req from 1929510922, term:36078, candidate:1929510922, term:36075,index:117545,mine term:36075 index:117545, previous vote:0, current vote :1929510922 grant:1
Mar 28 16:40:26.964026 INFO  [GCWARE] finish save raft meta with term: 36078, voteFor:0
Mar 28 16:40:26.971457 INFO  [GCWARE] finish save raft meta with term: 36078, voteFor:1929510922
Mar 28 16:40:26.973217 INFO  [GCWARE] Showy: PN5GBCCS11TcpAcceptorE::run accepted!, fd 32 ip  port 0
Mar 28 16:40:27.151832 INFO  [GCWARE] statemachine sync with leader change from 0 to 1

第二个节点成为了leader

Mar 28 16:40:26.957790 INFO  [GCWARE] node 1929510922 switch to candidate
Mar 28 16:40:26.958029 INFO  [GCWARE] vote req from 1929510922, term:36078, candidate:1929510922, term:36075,index:117545,mine term:36075 index:117545, previous vote:0, current vote :1929510922 grant:1
Mar 28 16:40:26.966603 INFO  [GCWARE] finish save raft meta with term: 36078, voteFor:0
Mar 28 16:40:26.974389 INFO  [GCWARE] finish save raft meta with term: 36078, voteFor:1929510922
Mar 28 16:40:26.974740 INFO  [GCWARE] dealVoteRpcRes node 1929510922 grant me with term 36078
Mar 28 16:40:26.975362 INFO  [GCWARE] dealVoteRpcRes node 1694629898 grant me with term 36078
Mar 28 16:40:26.975385 INFO  [GCWARE] node 1929510922 switch to leader with term:36078
Mar 28 16:40:26.975391 NOTIC [GCWARE] broadcast node state 1694629898 0
Mar 28 16:40:26.975395 NOTIC [GCWARE] broadcast node state 1929510922 1
Mar 28 16:40:26.975400 INFO  [GCWARE] statemachine sync with leader change from 0 to 1
Mar 28 16:40:27.172031 INFO  [GCWARE] node 1694629898 state plan change to 0
Mar 28 16:40:27.172067 INFO  [GCWARE] node 1694629898 state change to 0
Mar 28 16:40:27.172074 INFO  [GCWARE] node 1929510922 state plan change to 1

总结
当集群没有leader时,包括leader离线等,会发起选举

statemachine sync with leader change from 1 to 0
选举成功,leader会从0变成1

statemachine sync with leader change from 0 to 1

GBase 8a管理集群gcware的日志-vote leader、flower、candidate部分相关推荐

  1. GBase 8a 虚拟集群

    虚拟集群是在一个物理集群中又划分出来一个两个或多个虚拟集群 比如在一个物理集群中包含六个节点 192.168.61.1-6[安装时 demo.options里面配置6个节点] 其中192.168.61 ...

  2. 【基于容器的部署、扩展和管理】3.6 集群监控和日志收集

    往期回顾: 第一章:[云原生概念和技术] 第二章:[容器化应用程序设计和开发] 第三章:[3.1 容器编排系统和Kubernetes集群的构建] 第三章:[3.2 基于容器的应用程序部署和升级] 第三 ...

  3. GBase 8c V5 集群版安装示例

    GBase 8c V5 集群版安装示例 一.前言 二.环境准备 三.集群安装 四.数据库启停 五.卸载 六.连接和 SQL 测试 一.前言 GBase 8c 是 GBASE公司(天津南大通用数据技术股 ...

  4. NoSQL(二):创建、管理集群

    创建集群 集群环境 拓扑结构 IP规划 工作原理 工作原理 无论有多少台redis服务器,一共都会有0-16383共16384个槽 slot的作用:用来确定存储变量时,变量存储在哪一台redis服务器 ...

  5. 管理集群中的 crs 管理员

     管理集群中的 crs 管理员 oracle Managing CRS Administrators in the Cluster Use the following commands to ma ...

  6. ORACLE集群日志收集,【RAC】Oracle RAC集群环境下日志文件结构

    在Oracle RAC环境中,对集群中的日志的定期检查是必不可少的.通过查看集群日志,可以早期定位集群环境中出现的问题,以便将问题消灭在萌芽状态.简单介绍一下有关Oracle集群环境中日志的结构,方便 ...

  7. K8s-kubectl远程管理集群

    在实际工作中,我们有一个需求,需要远程登陆管理集群.其实不用非要登录k8s-master去敲命令,可以使用任意一台内网互通的机器安装kubectl命令,去远程管理集群,非常方便 1.安装kubectl ...

  8. 64: 创建集群 、 管理集群 、 总结和答疑

    Top NSD NOSQL DAY02 案例1:部署redis集群 案例2:添加服务器 案例3:移除服务器 1 案例1:部署redis集群 1.1 问题 具体要求如下: 部署管理主机 创建集群 查看集 ...

  9. mac下ElasticSearch 集群搭建,使用Kibana配置和管理集群

    Elasticsearch如果做集群的话Master节点至少三台服务器或者三个Master实例加入相同集群,三个Master节点最多只能故障一台Master节点,如果故障两个Master节点,Elas ...

最新文章

  1. 入门到放弃node系列之网络模块(二)
  2. flash流媒体资料
  3. Git叉子实际上是Git克隆吗?
  4. zblog php 当前位置,zblogphp导航当前页突出显示的方法
  5. Linux / Server 端收到 SIGPIPE 信号的原因
  6. 作者:胡清华(1976-),男,博士,天津大学计算机科学与技术学院教授。
  7. 大数据Java基础第十二天作业
  8. 二维矩阵边界包围JAVA_Quart 2D 绘制图形简单总结
  9. CentOS部署OpenStack过程-网络服务
  10. keras pytorch_使用PyTorch重新创建Keras功能API
  11. # 研究杂感 × VOSviewer(第四辑)
  12. iptv错误代码2003什么意思_IPTV部分错误代码和原因解释
  13. “1+7+N”改革工作体系介绍
  14. LoadLibraryA加载dll失败
  15. everedit 格式化json_Bracket 使用指南
  16. LeetCode刷题之旅正式开始
  17. 我是如何让公司后台管理系统焕然一新的(上) -性能优化
  18. 青浦区科技小巨人企业和区科技小巨人培育企业给予45万元和30万元的资助
  19. html保存时出现nul,c# – 有时保存的文件只包含NUL字符
  20. label标签 的使用与作用

热门文章

  1. go down to用法
  2. 任建新照常去办公室领取工资
  3. 小程序实现图片双滑放大缩小
  4. 数据库和网页之间的数据交互
  5. python时间序列分解STL
  6. 2038:最大数位置(题目来源于信息奥赛一本通官网)
  7. 凛冬至送温暖,无价资源免费送
  8. mysql数据库加锁语句_sql语句对数据库表进行加锁和解锁
  9. 1、模拟蚂蚁借呗—利息计算
  10. python数据分析与挖掘(二十七)--- Pandas量化--股票基础知识