溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

怎么解決mysql數(shù)據(jù)庫報(bào)錯(cuò)edit the grastate問題

發(fā)布時(shí)間:2021-11-18 11:30:44 來源:億速云 閱讀:319 作者:iii 欄目:MySQL數(shù)據(jù)庫

本篇內(nèi)容主要講解“怎么解決mysql數(shù)據(jù)庫報(bào)錯(cuò)edit the grastate問題”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“怎么解決mysql數(shù)據(jù)庫報(bào)錯(cuò)edit the grastate問題”吧!

1、嘗試重啟mysql數(shù)據(jù)庫時(shí)報(bào)錯(cuò)
[root@galera01 ~]# /etc/init.d/mysqld start  --wsrep-new-cluster
MySQL Daemon failed to start.
Starting mysqld:  [FAILED]

2、查看啟動(dòng)報(bào)錯(cuò)日志
2017-07-24T02:45:41.972508Z 0 [ERROR] WSREP: It may not be safe to bootstrap the cluster from this node. It was not the last one to leave the cluster and may not contain all the
 updates. To force cluster bootstrap with this node, edit the grastate.dat file manually and set safe_to_bootstrap to 1 .
2017-07-24T02:45:41.972511Z 0 [ERROR] WSREP: wsrep::connect(gcomm://192.168.56.111,192.168.56.112,192.168.56.113) failed: 7
2017-07-24T02:45:41.972513Z 0 [ERROR] Aborting

2017-07-24T02:45:41.972516Z 0 [Note] Giving 0 client threads a chance to die gracefully
2017-07-24T02:45:41.972519Z 0 [Note] WSREP: Service disconnected.
2017-07-24T02:45:42.972895Z 0 [Note] WSREP: Some threads may fail to exit.
2017-07-24T02:45:42.972937Z 0 [Note] Binlog end
2017-07-24T02:45:42.973014Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

3、嘗試先啟動(dòng)其他節(jié)點(diǎn),相同報(bào)錯(cuò)
從錯(cuò)誤日志提示報(bào)錯(cuò)提示,當(dāng)前節(jié)點(diǎn)不是集群中最后離開的節(jié)點(diǎn),也就是說當(dāng)前節(jié)點(diǎn)可能未能包含所有的更新。
如果強(qiáng)制啟動(dòng)當(dāng)前節(jié)點(diǎn),需要修改grastate.dat文件將safe_to_bootstrap的值置為1。
嘗試先啟動(dòng)其他節(jié)點(diǎn),相同報(bào)錯(cuò)。

4、修改grastate.dat文件
該文件主要描述GALERA保持的狀態(tài)信息,按指引修改safe_to_bootstrap的值置為1。
# cat grastate.dat
# GALERA saved state
version: 2.1
uuid:    df4a1da6-701a-11e7-87fe-e6c3a440d1ec
seqno:   -1
safe_to_bootstrap: 1               ---由原來的0修改為1再次啟動(dòng)

# /etc/init.d/mysqld start  --wsrep-new-cluster
Starting mysqld:  [  OK  ]
5、mysql集群啟動(dòng)成功

mysql> show global status like 'wsrep%';
+------------------------------+-------------------------------------------------------------+
| Variable_name                | Value                                                       |
+------------------------------+-------------------------------------------------------------+
| wsrep_local_state_uuid       | df4a1da6-701a-11e7-87fe-e6c3a440d1ec                        |
| wsrep_protocol_version       | 7                                                           |
| wsrep_last_committed         | 0                                                           |
| wsrep_replicated             | 0                                                           |
| wsrep_replicated_bytes       | 0                                                           |
| wsrep_repl_keys              | 0                                                           |
| wsrep_repl_keys_bytes        | 0                                                           |
| wsrep_repl_data_bytes        | 0                                                           |
| wsrep_repl_other_bytes       | 0                                                           |
| wsrep_received               | 10                                                          |
| wsrep_received_bytes         | 752                                                         |
| wsrep_local_commits          | 0                                                           |
| wsrep_local_cert_failures    | 0                                                           |
| wsrep_local_replays          | 0                                                           |
| wsrep_local_send_queue       | 0                                                           |
| wsrep_local_send_queue_max   | 1                                                           |
| wsrep_local_send_queue_min   | 0                                                           |
| wsrep_local_send_queue_avg   | 0.000000                                                    |
| wsrep_local_recv_queue       | 0                                                           |
| wsrep_local_recv_queue_max   | 1                                                           |
| wsrep_local_recv_queue_min   | 0                                                           |
| wsrep_local_recv_queue_avg   | 0.000000                                                    |
| wsrep_local_cached_downto    | 18446744073709551615                                        |
| wsrep_flow_control_paused_ns | 0                                                           |
| wsrep_flow_control_paused    | 0.000000                                                    |
| wsrep_flow_control_sent      | 0                                                           |
| wsrep_flow_control_recv      | 0                                                           |
| wsrep_cert_deps_distance     | 0.000000                                                    |
| wsrep_apply_oooe             | 0.000000                                                    |
| wsrep_apply_oool             | 0.000000                                                    |
| wsrep_apply_window           | 0.000000                                                    |
| wsrep_commit_oooe            | 0.000000                                                    |
| wsrep_commit_oool            | 0.000000                                                    |
| wsrep_commit_window          | 0.000000                                                    |
| wsrep_local_state            | 4                                                           |
| wsrep_local_state_comment    | Synced                                                      |
| wsrep_cert_index_size        | 0                                                           |
| wsrep_causal_reads           | 0                                                           |
| wsrep_cert_interval          | 0.000000                                                    |
| wsrep_incoming_addresses     | 192.168.56.111:3306,192.168.56.112:3306,192.168.56.113:3306 |
| wsrep_desync_count           | 0                                                           |
| wsrep_evs_delayed            |                                                             |
| wsrep_evs_evict_list         |                                                             |
| wsrep_evs_repl_latency       | 0/0/0/0/0                                                   |
| wsrep_evs_state              | OPERATIONAL                                                 |
| wsrep_gcomm_uuid             | df49c18f-701a-11e7-aaaa-9659aa7ef9f8                        |
| wsrep_cluster_conf_id        | 3                                                           |
| wsrep_cluster_size           | 3                                                           |
| wsrep_cluster_state_uuid     | df4a1da6-701a-11e7-87fe-e6c3a440d1ec                        |
| wsrep_cluster_status         | Primary                                                     |
| wsrep_connected              | ON                                                          |
| wsrep_local_bf_aborts        | 0                                                           |
| wsrep_local_index            | 0                                                           |
| wsrep_provider_name          | Galera                                                      |
| wsrep_provider_vendor        | Codership Oy                            |
| wsrep_provider_version       | 3.20(r7e383f7)                                              |
| wsrep_ready                  | ON                                                          |
+------------------------------+-------------------------------------------------------------+
57 rows in set (0.00 sec)

到此,相信大家對(duì)“怎么解決mysql數(shù)據(jù)庫報(bào)錯(cuò)edit the grastate問題”有了更深的了解,不妨來實(shí)際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI