下文給大家?guī)碛嘘P(guān)MySQL 8.0 InnoDB Cluster出現(xiàn)故障如何解決內(nèi)容,相信大家一定看過類似的文章。我們給大家?guī)淼挠泻尾煌??一起來看看正文部分吧,相信看完MySQL 8.0 InnoDB Cluster出現(xiàn)故障如何解決你一定會有所收獲。
專注于為中小企業(yè)提供成都網(wǎng)站設(shè)計、成都網(wǎng)站建設(shè)服務(wù),電腦端+手機端+微信端的三站合一,更高效的管理,為中小企業(yè)金川免費做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了1000多家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實現(xiàn)規(guī)模擴充和轉(zhuǎn)變。
InnoDB Cluster 一節(jié)點丟失
初始化故障節(jié)點
systemctl stop mysqld rm -rf /var/lib/mysql/* systemctl start mysqld
導(dǎo)出正常節(jié)點的數(shù)據(jù)庫,并傳到故障節(jié)點
mysqldump --all-databases --triggers --routines --events --quick --single-transaction --flush-logs --master-data=2 > dbs.dump scp dbs.dump 192.168.1.224:~/
故障節(jié)點導(dǎo)入數(shù)據(jù)庫
mysql> set sql_log_bin=0; mysql> ALTER USER root@'localhost' IDENTIFIED BY 'MySQL8.0'; mysql> source dbs.dump mysql> set sql_log_bin=1;
重啟故障節(jié)點 MySQL
systemctl restart mysqld
將故障節(jié)點重新加入集群
MySQL 192.168.1.226:33060+ ssl JS > var cluster=dba.getCluster('appCluster') MySQL 192.168.1.226:33060+ ssl JS > cluster.removeInstance('root@192.168.1.224:3306') MySQL 192.168.1.226:33060+ ssl JS > cluster.addInstance('root@192.168.1.224:3306')
集群恢復(fù)正常
MySQL 192.168.1.226:33060+ ssl JS > cluster.status() { "clusterName": "appCluster", "defaultReplicaSet": { "name": "default", "primary": "192.168.1.226:3306", "ssl": "REQUIRED", "status": "OK", "statusText": "Cluster is ONLINE and can tolerate up to ONE failure.", "topology": { "192.168.1.224:3306": { "address": "192.168.1.224:3306", "mode": "R/O", "readReplicas": {}, "role": "HA", "status": "ONLINE" }, "192.168.1.225:3306": { "address": "192.168.1.225:3306", "mode": "R/O", "readReplicas": {}, "role": "HA", "status": "ONLINE" }, "192.168.1.226:3306": { "address": "192.168.1.226:3306", "mode": "R/W", "readReplicas": {}, "role": "HA", "status": "ONLINE" } } }, "groupInformationSourceMember": "mysql://root@192.168.1.226:3306"}
對于上文關(guān)于MySQL 8.0 InnoDB Cluster出現(xiàn)故障如何解決,大家覺得是自己想要的嗎?如果想要了解更多相關(guān),可以繼續(xù)關(guān)注我們的行業(yè)資訊板塊。