gcahce事物不够,借助binlog追上

gcahce事物不够,借助binlog追上

宕机节点以单机集群启动,既自己作为一个集群启动,不过UUID要和旧的集群保持一致:

修复grastate.dat 文件的方式这里略,直接通过wsrep_recovery即可
修复grastate.dat文件后,取其中的seqno(假设为737),然后借助seqno找到其他节点binlong的start-position:
[root@pxc_node0_172.16.11.127 ~]# mysqlbinlog -vv /data/database/pxc3306/pxc-3306-bin.0000015 | grep -A5 "Xid = 737"
# 180420 20:17:16 server id 127  end_log_pos 2221492     Xid = 737     # 就是这个
COMMIT/*!*/;
# at 105205941                                                                                         # 从这里开始导
# 180424 14:41:01 server id 127  end_log_pos 105206002   GTID    last_committed=44702    sequence_number=44710   rbr_only=yes
导出binlog:
[root@pxc_node0_172.16.11.127 ~]# mysqlbinlog  -vv  --skip-gtids=true --start-position=105205941 /data/database/pxc3306/pxc-3306-bin.0000015  > binlog.sql 

这里需要借助--skip-gtids=true参数使解析出来的文件中就不包含“SET @@SESSION.GTID_NEXT=”,否则可能会binlog导入失效。

注释掉配置文件中去掉下面的配置:
wsrep_cluster_address=gcomm://30.0.0.227,30.0.0.226,30.0.0.225
grastate.dat文件做如下修改:
safe_to_bootstrap: 1
启动:
[root@pxc_node2_172.16.11.137 ~]#/usr/bin/mysqld_safe --defaults-file=/etc/pxc3306.cnf   --wsrep-cluster-address="gcomm://"  & 

这时候是非主模式:

ERROR 1047 (08S01): WSREP has not yet prepared node for application use
解决非主模式:
(root@localhost) [(none)]> SET GLOBAL wsrep_provider_options='pc.bootstrap=true';
导入binlog:
(root@localhost) [(none)]> source /data/backup/binlog.sql  ;

这里除了要导入binlog.sql ,还需要导入mysql-bin.0000015之后的binlog,让故障节点尽可能追近集群

关闭该实例
重新配置grastate.dat
[root@pxc_node2_172.16.11.137 ~]# vim /data/database/pxc3306/grastate.dat 
# GALERA saved state
version: 2.1
uuid:    bf26341f-43cb-11e8-a863-62c0eb4d9e79
seqno:   737
safe_to_bootstrap: 0
重新配置配置文件:
wsrep_cluster_address=gcomm://30.0.0.227,30.0.0.226,30.0.0.225
重启加入集群即可

或者指定一个donor
--wsrep_sst_donor=xxx

posted @   wshenJin  阅读(229)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
阅读排行:
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· DeepSeek在M芯片Mac上本地化部署
· 葡萄城 AI 搜索升级:DeepSeek 加持,客户体验更智能
点击右上角即可分享
微信分享提示