我在CentOS7上搭建了mariadb galera集群,下面是galera节点信息:
10.200.67.27 MariaDB-Node1
10.200.67.29 MariaDB-Node2
10.200.67.26 MariaDB-Node3
然而,MariaDB-Node2
和MariaDB-Node3
却意外地停止了。我尝试在两台服务器上重新启动mysql服务,但它们没有启动。然后我删除了wsrep_on=1设置并重新启动mysql MariaDB-Node2
,显示如下错误:
[xiaofang@sd-vm-0003929 ~]$ sudo systemctl start mysql
[xiaofang@sd-vm-0003929 ~]$
[xiaofang@sd-vm-0003929 ~]$
[xiaofang@sd-vm-0003929 ~]$ sudo systemctl status mysql
● mariadb.service - MariaDB 10.6.2 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: activating (start) since Fri 2022-05-27 16:34:16 CST; 402ms ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Process: 13569 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 13580 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
Process: 13578 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Main PID: 13606 (mariadbd)
CGroup: /system.slice/mariadb.service
└─13606 /usr/sbin/mariadbd
May 27 16:34:16 sd-vm-0003929.novalocal systemd[1]: Starting MariaDB 10.6.2 database server...
May 27 16:34:16 sd-vm-0003929.novalocal mariadbd[13606]: 2022-05-27 16:34:16 0 [Note] /usr/sbin/mariadbd (mysqld 10.6.2-MariaDB) starting as process 13606 ...
May 27 16:34:16 sd-vm-0003929.novalocal mariadbd[13606]: 2022-05-27 16:34:16 0 [Warning] You need to use --log-bin to make --binlog-format work.
May 27 16:34:16 sd-vm-0003929.novalocal mariadbd[13606]: 2022-05-27 16:34:16 0 [Note] InnoDB: Compressed tables use zlib 1.2.7
May 27 16:34:16 sd-vm-0003929.novalocal mariadbd[13606]: 2022-05-27 16:34:16 0 [Note] InnoDB: Number of pools: 1
May 27 16:34:16 sd-vm-0003929.novalocal mariadbd[13606]: 2022-05-27 16:34:16 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
May 27 16:34:16 sd-vm-0003929.novalocal mariadbd[13606]: 2022-05-27 16:34:16 0 [Note] InnoDB: Using Linux native AIO
May 27 16:34:16 sd-vm-0003929.novalocal mariadbd[13606]: 2022-05-27 16:34:16 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
May 27 16:34:16 sd-vm-0003929.novalocal mariadbd[13606]: 2022-05-27 16:34:16 0 [Note] InnoDB: Completed initialization of buffer pool
May 27 16:34:16 sd-vm-0003929.novalocal mariadbd[13606]: 2022-05-27 16:34:16 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=34426674408,34426674408
那么我该如何重新启动mysql服务呢?
答案1
如果 Node2 和 Node3 停止运行,除非你更改了仲裁权重,否则 Node1 将无法正常运行。我建议你执行以下操作(假设 Node3 仍处于关闭状态):
- 停止 Node2
- 停止节点1
- 在 Node1 上以 root 身份运行:“galera_new_cluster”
此时您应该验证 Node1 是否正常并且自行形成了一个集群。
如果没问题,您可以尝试启动 Node3 并查看它是否加入集群。
Node2,为了安全起见,我将擦除并让它在将 wsrep_on 重新设置为 1 后从空数据库开始重新加入集群。