当前位置: 代码迷 >> 综合 >> mysql/mariadb 集群一个启动,另外一个启动不起来
  详细解决方案

mysql/mariadb 集群一个启动,另外一个启动不起来

热度:40   发布时间:2023-12-05 21:26:00.0

mysql/mariadb 集群一个启动,另外一个启动不起来

问题截图

[root@ds2 my.cnf.d]# service mariadb start
Redirecting to /bin/systemctl start mariadb.service
Job for mariadb.service failed because a fatal signal was delivered to the control process. See "systemctl status mariadb.service" and "journalctl -xe" for details.
[root@ds2 my.cnf.d]# journalctl -xe
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 0 [Note] WSREP: Shifting CLOSED -> OPEN (TO: 0)
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 0 [Note] WSREP: Opened channel 'vias_mariadb_cluster'
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 0 [Note] WSREP: Waiting for SST to complete.
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 0 [Note] WSREP: New COMPONENT: primary = yes, bootstrap = no, my_idx = 1, memb_num = 2
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 0 [Note] WSREP: STATE EXCHANGE: Waiting for state UUID.
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 0 [Note] WSREP: STATE EXCHANGE: sent state msg: 064aeae1-338a-11eb-bf2e-7286aeddce9c
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 0 [Note] WSREP: STATE EXCHANGE: got state msg: 064aeae1-338a-11eb-bf2e-7286aeddce9c fr
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 0 [Note] WSREP: STATE EXCHANGE: got state msg: 064aeae1-338a-11eb-bf2e-7286aeddce9c fr
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 0 [Note] WSREP: Quorum results:
Dec 01 11:47:02 ds2 mysqld[28932]: version    = 4,
Dec 01 11:47:02 ds2 mysqld[28932]: component  = PRIMARY,
Dec 01 11:47:02 ds2 mysqld[28932]: conf_id    = 17,
Dec 01 11:47:02 ds2 mysqld[28932]: members    = 1/2 (joined/total),
Dec 01 11:47:02 ds2 mysqld[28932]: act_id     = 3011,
Dec 01 11:47:02 ds2 mysqld[28932]: last_appl. = -1,
Dec 01 11:47:02 ds2 mysqld[28932]: protocols  = 0/9/3 (gcs/repl/appl),
Dec 01 11:47:02 ds2 mysqld[28932]: group UUID = 719d98c7-32f9-11eb-adde-5ef24b61b76d
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 0 [Note] WSREP: Flow-control interval: [23, 23]
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 0 [Note] WSREP: Trying to continue unpaused monitor
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 0 [Note] WSREP: Shifting OPEN -> PRIMARY (TO: 3011)
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 2 [Note] WSREP: State transfer required:
Dec 01 11:47:02 ds2 mysqld[28932]: Group state: 719d98c7-32f9-11eb-adde-5ef24b61b76d:3011
Dec 01 11:47:02 ds2 mysqld[28932]: Local state: 00000000-0000-0000-0000-000000000000:-1
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 2 [Note] WSREP: New cluster view: global state: 719d98c7-32f9-11eb-adde-5ef24b61b76d:3
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 2 [Warning] WSREP: Gap in state sequence. Need state transfer.
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 0 [Note] WSREP: Running: 'wsrep_sst_rsync --role 'joiner' --address '172.16.22.18' --d
Dec 01 11:47:02 ds2 rsyncd[28990]: rsyncd version 3.1.2 starting, listening on port 4444
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 2 [Note] WSREP: Prepared SST request: rsync|172.16.22.18:4444/rsync_sst
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 2 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 2 [Note] WSREP: REPL Protocols: 9 (4, 2)
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 2 [Note] WSREP: Assign initial position for certification: 3011, protocol version: 4
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 0 [Note] WSREP: Service thread queue flushed.
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 2 [Warning] WSREP: Failed to prepare for incremental state transfer: Local state UUID
Dec 01 11:47:02 ds2 mysqld[28932]: at galera/src/replicator_str.cpp:prepare_for_IST():482. IST will be unavailable.
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 0 [Note] WSREP: Member 1.0 (ds2) requested state transfer from '*any*'. Selected 0.0 (
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 0 [Note] WSREP: Shifting PRIMARY -> JOINER (TO: 3011)
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 2 [Note] WSREP: Requesting state transfer: success, donor: 0
Dec 01 11:47:02 ds2 mysqld[28932]: 2020-12-01 11:47:02 2 [Note] WSREP: GCache history reset: 00000000-0000-0000-0000-000000000000:0 -> 719d98
Dec 01 11:47:02 ds2 rsyncd[29010]: name lookup failed for 172.16.22.17: Name or service not known
Dec 01 11:47:02 ds2 rsyncd[29010]: connect from UNKNOWN (172.16.22.17)
Dec 01 11:47:02 ds2 rsyncd[29010]: rsync to rsync_sst/ from UNKNOWN (172.16.22.17)
Dec 01 11:47:02 ds2 rsyncd[29010]: receiving file list
Dec 01 11:47:02 ds2 rsyncd[29010]: sent 25 bytes  received 315 bytes  total size 0
Dec 01 11:47:02 ds2 rsyncd[29012]: name lookup failed for 172.16.22.17: Name or service not known
Dec 01 11:47:02 ds2 rsyncd[29012]: connect from UNKNOWN (172.16.22.17)
Dec 01 11:47:02 ds2 rsyncd[29012]: rsync to rsync_sst-data_dir/ from UNKNOWN (172.16.22.17)
Dec 01 11:47:02 ds2 rsyncd[29012]: receiving file list
Dec 01 11:47:04 ds2 mysqld[28932]: 2020-12-01 11:47:04 0 [Note] WSREP: (de8bcb68, 'tcp://0.0.0.0:4567') connection to peer de8bcb68 with addr
Dec 01 11:47:04 ds2 mysqld[28932]: 2020-12-01 11:47:04 0 [Note] WSREP: (de8bcb68, 'tcp://0.0.0.0:4567') turning message relay requesting offESCOC

项目部署了mariadb 主从数据库,很长时间没有查看服务器,今天上服务器一看发现只有一个数据库服务器在启动,另外一个未启用。
启动后发现启动不起来,苦苦搜索百度,发现是启动时需要和另外一个服务器做备份数据同步,导致启动超时。

解决办法如下:

vim /usr/lib/systemd/system/mariadb.service

添加如下设置:

[Service]
TimeoutSec=2h

保存后退出,执行下面的 systemctl daemon-reload

 systemctl daemon-reload

然后再重启就好了
以下是参考:
[1]: https://blog.csdn.net/weixin_34116110/article/details/93777606

  相关解决方案