一、MySQL MGR 集群概述:理解高可用架构基础
1.1 MGR 架构特点与优势
MySQL Group Replication (MGR) 是 MySQL 官方提供的高可用解决方案,采用分布式一致性协议实现数据同步与故障自动切换。MGR 集群具有以下核心特点:
- 多主架构:所有节点可同时处理读写请求
- 自动故障检测:通过心跳机制检测节点状态
- 自动故障转移:主节点故障时自动选举新主节点
- 数据一致性:基于 Paxos 协议保证数据一致性
#publish-mermaid-0-1792402557657{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#publish-mermaid-0-1792402557657 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#publish-mermaid-0-1792402557657 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#publish-mermaid-0-1792402557657 .error-icon{fill:#552222;}#publish-mermaid-0-1792402557657 .error-text{fill:#552222;stroke:#552222;}#publish-mermaid-0-1792402557657 .edge-thickness-normal{stroke-width:1px;}#publish-mermaid-0-1792402557657 .edge-thickness-thick{stroke-width:3.5px;}#publish-mermaid-0-1792402557657 .edge-pattern-solid{stroke-dasharray:0;}#publish-mermaid-0-1792402557657 .edge-thickness-invisible{stroke-width:0;fill:none;}#publish-mermaid-0-1792402557657 .edge-pattern-dashed{stroke-dasharray:3;}#publish-mermaid-0-1792402557657 .edge-pattern-dotted{stroke-dasharray:2;}#publish-mermaid-0-1792402557657 .marker{fill:#333333;stroke:#333333;}#publish-mermaid-0-1792402557657 .marker.cross{stroke:#333333;}#publish-mermaid-0-1792402557657 svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#publish-mermaid-0-1792402557657 p{margin:0;}#publish-mermaid-0-1792402557657 .label{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;color:#333;}#publish-mermaid-0-1792402557657 .cluster-label text{fill:#333;}#publish-mermaid-0-1792402557657 .cluster-label span{color:#333;}#publish-mermaid-0-1792402557657 .cluster-label span p{background-color:transparent;}#publish-mermaid-0-1792402557657 .label text,#publish-mermaid-0-1792402557657 span{fill:#333;color:#333;}#publish-mermaid-0-1792402557657 .node rect,#publish-mermaid-0-1792402557657 .node circle,#publish-mermaid-0-1792402557657 .node ellipse,#publish-mermaid-0-1792402557657 .node polygon,#publish-mermaid-0-1792402557657 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#publish-mermaid-0-1792402557657 .rough-node .label text,#publish-mermaid-0-1792402557657 .node .label text,#publish-mermaid-0-1792402557657 .image-shape .label,#publish-mermaid-0-1792402557657 .icon-shape .label{text-anchor:middle;}#publish-mermaid-0-1792402557657 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#publish-mermaid-0-1792402557657 .rough-node .label,#publish-mermaid-0-1792402557657 .node .label,#publish-mermaid-0-1792402557657 .image-shape .label,#publish-mermaid-0-1792402557657 .icon-shape .label{text-align:center;}#publish-mermaid-0-1792402557657 .node.clickable{cursor:pointer;}#publish-mermaid-0-1792402557657 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#publish-mermaid-0-1792402557657 .arrowheadPath{fill:#333333;}#publish-mermaid-0-1792402557657 .edgePath .path{stroke:#333333;stroke-width:1px;}#publish-mermaid-0-1792402557657 .flowchart-link{stroke:#333333;fill:none;}#publish-mermaid-0-1792402557657 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-0-1792402557657 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#publish-mermaid-0-1792402557657 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-0-1792402557657 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#publish-mermaid-0-1792402557657 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#publish-mermaid-0-1792402557657 .cluster text{fill:#333;}#publish-mermaid-0-1792402557657 .cluster span{color:#333;}#publish-mermaid-0-1792402557657 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#publish-mermaid-0-1792402557657 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#publish-mermaid-0-1792402557657 rect.text{fill:none;stroke-width:0;}#publish-mermaid-0-1792402557657 .icon-shape,#publish-mermaid-0-1792402557657 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-0-1792402557657 .icon-shape p,#publish-mermaid-0-1792402557657 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#publish-mermaid-0-1792402557657 .icon-shape .label rect,#publish-mermaid-0-1792402557657 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-0-1792402557657 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#publish-mermaid-0-1792402557657 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#publish-mermaid-0-1792402557657 .node .neo-node{stroke:#9370DB;}#publish-mermaid-0-1792402557657 [data-look=\”neo\”].node rect,#publish-mermaid-0-1792402557657 [data-look=\”neo\”].cluster rect,#publish-mermaid-0-1792402557657 [data-look=\”neo\”].node polygon{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-0-1792402557657 [data-look=\”neo\”].swimlane.cluster rect{filter:none;}#publish-mermaid-0-1792402557657 [data-look=\”neo\”].node path{stroke:#9370DB;stroke-width:1px;}#publish-mermaid-0-1792402557657 [data-look=\”neo\”].node .outer-path{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-0-1792402557657 [data-look=\”neo\”].node .neo-line path{stroke:#9370DB;filter:none;}#publish-mermaid-0-1792402557657 [data-look=\”neo\”].node circle{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-0-1792402557657 [data-look=\”neo\”].node circle .state-start{fill:#000000;}#publish-mermaid-0-1792402557657 [data-look=\”neo\”].icon-shape .icon{fill:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-0-1792402557657 [data-look=\”neo\”].icon-shape .icon-neo path{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-0-1792402557657 :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}
客户端请求
MGR 集群节点
读写分离处理
数据同步复制
返回结果
一致性校验
该图展示了 MGR 集群的基本工作流程,客户端请求被分发到集群节点,节点同时处理读写请求并同步数据,确保数据一致性。
1.2 集群状态与节点角色
MGR 集群包含三种主要状态:ONLINE(在线)、OFFLINE(离线)、RECOVERING(恢复中)。节点角色分为 PRIMARY(主节点)和 SECONDARY(从节点),集群通过这些状态和角色实现高可用。
#publish-mermaid-1-1792402557711{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#publish-mermaid-1-1792402557711 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#publish-mermaid-1-1792402557711 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#publish-mermaid-1-1792402557711 .error-icon{fill:#552222;}#publish-mermaid-1-1792402557711 .error-text{fill:#552222;stroke:#552222;}#publish-mermaid-1-1792402557711 .edge-thickness-normal{stroke-width:1px;}#publish-mermaid-1-1792402557711 .edge-thickness-thick{stroke-width:3.5px;}#publish-mermaid-1-1792402557711 .edge-pattern-solid{stroke-dasharray:0;}#publish-mermaid-1-1792402557711 .edge-thickness-invisible{stroke-width:0;fill:none;}#publish-mermaid-1-1792402557711 .edge-pattern-dashed{stroke-dasharray:3;}#publish-mermaid-1-1792402557711 .edge-pattern-dotted{stroke-dasharray:2;}#publish-mermaid-1-1792402557711 .marker{fill:#333333;stroke:#333333;}#publish-mermaid-1-1792402557711 .marker.cross{stroke:#333333;}#publish-mermaid-1-1792402557711 svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#publish-mermaid-1-1792402557711 p{margin:0;}#publish-mermaid-1-1792402557711 defs [id$=\”-barbEnd\”]{fill:#333333;stroke:#333333;}#publish-mermaid-1-1792402557711 g.stateGroup text{fill:#9370DB;stroke:none;font-size:10px;}#publish-mermaid-1-1792402557711 g.stateGroup text{fill:#333;stroke:none;font-size:10px;}#publish-mermaid-1-1792402557711 g.stateGroup .state-title{font-weight:bolder;fill:#131300;}#publish-mermaid-1-1792402557711 g.stateGroup rect{fill:#ECECFF;stroke:#9370DB;}#publish-mermaid-1-1792402557711 g.stateGroup line{stroke:#333333;stroke-width:1;}#publish-mermaid-1-1792402557711 .transition{stroke:#333333;stroke-width:1;fill:none;}#publish-mermaid-1-1792402557711 .stateGroup .composit{fill:white;border-bottom:1px;}#publish-mermaid-1-1792402557711 .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px;}#publish-mermaid-1-1792402557711 .state-note{stroke:#aaaa33;fill:#fff5ad;}#publish-mermaid-1-1792402557711 .state-note text{fill:black;stroke:none;font-size:10px;}#publish-mermaid-1-1792402557711 .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5;}#publish-mermaid-1-1792402557711 .edgeLabel .label rect{fill:#ECECFF;opacity:0.5;}#publish-mermaid-1-1792402557711 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-1-1792402557711 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#publish-mermaid-1-1792402557711 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-1-1792402557711 .edgeLabel .label text{fill:#333;}#publish-mermaid-1-1792402557711 .label div .edgeLabel{color:#333;}#publish-mermaid-1-1792402557711 .stateLabel text{fill:#131300;font-size:10px;font-weight:bold;}#publish-mermaid-1-1792402557711 .node circle.state-start{fill:#333333;stroke:#333333;}#publish-mermaid-1-1792402557711 .node .fork-join{fill:#333333;stroke:#333333;}#publish-mermaid-1-1792402557711 .node circle.state-end{fill:#9370DB;stroke:white;stroke-width:1.5;}#publish-mermaid-1-1792402557711 .end-state-inner{fill:white;stroke-width:1.5;}#publish-mermaid-1-1792402557711 .node rect{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#publish-mermaid-1-1792402557711 .node polygon{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#publish-mermaid-1-1792402557711 [id$=\”-barbEnd\”]{fill:#333333;}#publish-mermaid-1-1792402557711 .statediagram-cluster rect{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#publish-mermaid-1-1792402557711 .cluster-label,#publish-mermaid-1-1792402557711 .nodeLabel{color:#131300;}#publish-mermaid-1-1792402557711 .statediagram-cluster rect.outer{rx:5px;ry:5px;}#publish-mermaid-1-1792402557711 .statediagram-state .divider{stroke:#9370DB;}#publish-mermaid-1-1792402557711 .statediagram-state .title-state{rx:5px;ry:5px;}#publish-mermaid-1-1792402557711 .statediagram-cluster.statediagram-cluster .inner{fill:white;}#publish-mermaid-1-1792402557711 .statediagram-cluster.statediagram-cluster-alt .inner{fill:#f0f0f0;}#publish-mermaid-1-1792402557711 .statediagram-cluster .inner{rx:0;ry:0;}#publish-mermaid-1-1792402557711 .statediagram-state rect.basic{rx:5px;ry:5px;}#publish-mermaid-1-1792402557711 .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#f0f0f0;}#publish-mermaid-1-1792402557711 .note-edge{stroke-dasharray:5;}#publish-mermaid-1-1792402557711 .statediagram-note rect{fill:#fff5ad;stroke:#aaaa33;stroke-width:1px;rx:0;ry:0;}#publish-mermaid-1-1792402557711 .statediagram-note rect{fill:#fff5ad;stroke:#aaaa33;stroke-width:1px;rx:0;ry:0;}#publish-mermaid-1-1792402557711 .statediagram-note text{fill:black;}#publish-mermaid-1-1792402557711 .statediagram-note .nodeLabel{color:black;}#publish-mermaid-1-1792402557711 .statediagram .edgeLabel{color:red;}#publish-mermaid-1-1792402557711 [id$=\”-dependencyStart\”],#publish-mermaid-1-1792402557711 [id$=\”-dependencyEnd\”]{fill:#333333;stroke:#333333;stroke-width:1;}#publish-mermaid-1-1792402557711 .statediagramTitleText{text-anchor:middle;font-size:18px;fill:#333;}#publish-mermaid-1-1792402557711 [data-look=\”neo\”].statediagram-cluster rect{fill:#ECECFF;stroke:#9370DB;stroke-width:1;}#publish-mermaid-1-1792402557711 [data-look=\”neo\”].statediagram-cluster rect.outer{rx:5px;ry:5px;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1-1792402557711 .node .neo-node{stroke:#9370DB;}#publish-mermaid-1-1792402557711 [data-look=\”neo\”].node rect,#publish-mermaid-1-1792402557711 [data-look=\”neo\”].cluster rect,#publish-mermaid-1-1792402557711 [data-look=\”neo\”].node polygon{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1-1792402557711 [data-look=\”neo\”].swimlane.cluster rect{filter:none;}#publish-mermaid-1-1792402557711 [data-look=\”neo\”].node path{stroke:#9370DB;stroke-width:1px;}#publish-mermaid-1-1792402557711 [data-look=\”neo\”].node .outer-path{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1-1792402557711 [data-look=\”neo\”].node .neo-line path{stroke:#9370DB;filter:none;}#publish-mermaid-1-1792402557711 [data-look=\”neo\”].node circle{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1-1792402557711 [data-look=\”neo\”].node circle .state-start{fill:#000000;}#publish-mermaid-1-1792402557711 [data-look=\”neo\”].icon-shape .icon{fill:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1-1792402557711 [data-look=\”neo\”].icon-shape .icon-neo path{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1-1792402557711 :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}
ONLINE
OFFLINE
RECOVERING
PRIMARY
SECONDARY
状态转换图显示了 MGR 节点可能的状态变化路径,从初始状态到在线状态,再到离线或恢复状态,最终回到在线状态。
二、节点加入实战:扩容与新增节点
2.1 准备工作与前置检查
在将新节点加入 MGR 集群前,需要完成以下准备工作:
#publish-mermaid-2-1792402557777{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#publish-mermaid-2-1792402557777 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#publish-mermaid-2-1792402557777 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#publish-mermaid-2-1792402557777 .error-icon{fill:#552222;}#publish-mermaid-2-1792402557777 .error-text{fill:#552222;stroke:#552222;}#publish-mermaid-2-1792402557777 .edge-thickness-normal{stroke-width:1px;}#publish-mermaid-2-1792402557777 .edge-thickness-thick{stroke-width:3.5px;}#publish-mermaid-2-1792402557777 .edge-pattern-solid{stroke-dasharray:0;}#publish-mermaid-2-1792402557777 .edge-thickness-invisible{stroke-width:0;fill:none;}#publish-mermaid-2-1792402557777 .edge-pattern-dashed{stroke-dasharray:3;}#publish-mermaid-2-1792402557777 .edge-pattern-dotted{stroke-dasharray:2;}#publish-mermaid-2-1792402557777 .marker{fill:#333333;stroke:#333333;}#publish-mermaid-2-1792402557777 .marker.cross{stroke:#333333;}#publish-mermaid-2-1792402557777 svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#publish-mermaid-2-1792402557777 p{margin:0;}#publish-mermaid-2-1792402557777 .label{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;color:#333;}#publish-mermaid-2-1792402557777 .cluster-label text{fill:#333;}#publish-mermaid-2-1792402557777 .cluster-label span{color:#333;}#publish-mermaid-2-1792402557777 .cluster-label span p{background-color:transparent;}#publish-mermaid-2-1792402557777 .label text,#publish-mermaid-2-1792402557777 span{fill:#333;color:#333;}#publish-mermaid-2-1792402557777 .node rect,#publish-mermaid-2-1792402557777 .node circle,#publish-mermaid-2-1792402557777 .node ellipse,#publish-mermaid-2-1792402557777 .node polygon,#publish-mermaid-2-1792402557777 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#publish-mermaid-2-1792402557777 .rough-node .label text,#publish-mermaid-2-1792402557777 .node .label text,#publish-mermaid-2-1792402557777 .image-shape .label,#publish-mermaid-2-1792402557777 .icon-shape .label{text-anchor:middle;}#publish-mermaid-2-1792402557777 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#publish-mermaid-2-1792402557777 .rough-node .label,#publish-mermaid-2-1792402557777 .node .label,#publish-mermaid-2-1792402557777 .image-shape .label,#publish-mermaid-2-1792402557777 .icon-shape .label{text-align:center;}#publish-mermaid-2-1792402557777 .node.clickable{cursor:pointer;}#publish-mermaid-2-1792402557777 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#publish-mermaid-2-1792402557777 .arrowheadPath{fill:#333333;}#publish-mermaid-2-1792402557777 .edgePath .path{stroke:#333333;stroke-width:1px;}#publish-mermaid-2-1792402557777 .flowchart-link{stroke:#333333;fill:none;}#publish-mermaid-2-1792402557777 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-2-1792402557777 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#publish-mermaid-2-1792402557777 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-2-1792402557777 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#publish-mermaid-2-1792402557777 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#publish-mermaid-2-1792402557777 .cluster text{fill:#333;}#publish-mermaid-2-1792402557777 .cluster span{color:#333;}#publish-mermaid-2-1792402557777 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#publish-mermaid-2-1792402557777 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#publish-mermaid-2-1792402557777 rect.text{fill:none;stroke-width:0;}#publish-mermaid-2-1792402557777 .icon-shape,#publish-mermaid-2-1792402557777 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-2-1792402557777 .icon-shape p,#publish-mermaid-2-1792402557777 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#publish-mermaid-2-1792402557777 .icon-shape .label rect,#publish-mermaid-2-1792402557777 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-2-1792402557777 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#publish-mermaid-2-1792402557777 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#publish-mermaid-2-1792402557777 .node .neo-node{stroke:#9370DB;}#publish-mermaid-2-1792402557777 [data-look=\”neo\”].node rect,#publish-mermaid-2-1792402557777 [data-look=\”neo\”].cluster rect,#publish-mermaid-2-1792402557777 [data-look=\”neo\”].node polygon{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-2-1792402557777 [data-look=\”neo\”].swimlane.cluster rect{filter:none;}#publish-mermaid-2-1792402557777 [data-look=\”neo\”].node path{stroke:#9370DB;stroke-width:1px;}#publish-mermaid-2-1792402557777 [data-look=\”neo\”].node .outer-path{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-2-1792402557777 [data-look=\”neo\”].node .neo-line path{stroke:#9370DB;filter:none;}#publish-mermaid-2-1792402557777 [data-look=\”neo\”].node circle{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-2-1792402557777 [data-look=\”neo\”].node circle .state-start{fill:#000000;}#publish-mermaid-2-1792402557777 [data-look=\”neo\”].icon-shape .icon{fill:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-2-1792402557777 [data-look=\”neo\”].icon-shape .icon-neo path{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-2-1792402557777 :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}
准备工作
网络连通性检查
版本一致性验证
数据目录初始化
参数配置检查
配置完成
流程图展示了节点加入前的必要准备工作,确保所有前置条件满足后才能进行下一步操作。
2.2 执行节点加入操作
执行节点加入操作需要使用 group_replication_join_group() 函数,新节点将尝试连接到现有集群并同步数据。
集群现有节点2现有节点1新节点集群现有节点2现有节点1新节点#publish-mermaid-3-1792402557839{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#publish-mermaid-3-1792402557839 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#publish-mermaid-3-1792402557839 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#publish-mermaid-3-1792402557839 .error-icon{fill:#552222;}#publish-mermaid-3-1792402557839 .error-text{fill:#552222;stroke:#552222;}#publish-mermaid-3-1792402557839 .edge-thickness-normal{stroke-width:1px;}#publish-mermaid-3-1792402557839 .edge-thickness-thick{stroke-width:3.5px;}#publish-mermaid-3-1792402557839 .edge-pattern-solid{stroke-dasharray:0;}#publish-mermaid-3-1792402557839 .edge-thickness-invisible{stroke-width:0;fill:none;}#publish-mermaid-3-1792402557839 .edge-pattern-dashed{stroke-dasharray:3;}#publish-mermaid-3-1792402557839 .edge-pattern-dotted{stroke-dasharray:2;}#publish-mermaid-3-1792402557839 .marker{fill:#333333;stroke:#333333;}#publish-mermaid-3-1792402557839 .marker.cross{stroke:#333333;}#publish-mermaid-3-1792402557839 svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#publish-mermaid-3-1792402557839 p{margin:0;}#publish-mermaid-3-1792402557839 .actor{stroke:#9370DB;fill:#ECECFF;stroke-width:1;}#publish-mermaid-3-1792402557839 rect.actor.outer-path[data-look=\”neo\”]{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-3-1792402557839 rect.note[data-look=\”neo\”]{stroke:#aaaa33;fill:#fff5ad;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-3-1792402557839 text.actor>tspan{fill:black;stroke:none;}#publish-mermaid-3-1792402557839 .actor-line{stroke:#9370DB;}#publish-mermaid-3-1792402557839 .innerArc{stroke-width:1.5;stroke-dasharray:none;}#publish-mermaid-3-1792402557839 .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333;}#publish-mermaid-3-1792402557839 .messageLine1{stroke-width:1.5;stroke-dasharray:2,2;stroke:#333;}#publish-mermaid-3-1792402557839 [id$=\”-arrowhead\”] path{fill:#333;stroke:#333;}#publish-mermaid-3-1792402557839 .sequenceNumber{fill:white;}#publish-mermaid-3-1792402557839 [id$=\”-sequencenumber\”]{fill:#333;}#publish-mermaid-3-1792402557839 [id$=\”-crosshead\”] path{fill:#333;stroke:#333;}#publish-mermaid-3-1792402557839 .messageText{fill:#333;stroke:none;}#publish-mermaid-3-1792402557839 .labelBox{stroke:#9370DB;fill:#ECECFF;filter:none;}#publish-mermaid-3-1792402557839 .labelText,#publish-mermaid-3-1792402557839 .labelText>tspan{fill:black;stroke:none;}#publish-mermaid-3-1792402557839 .loopText,#publish-mermaid-3-1792402557839 .loopText>tspan{fill:black;stroke:none;}#publish-mermaid-3-1792402557839 .sectionTitle,#publish-mermaid-3-1792402557839 .sectionTitle>tspan{fill:black;stroke:none;}#publish-mermaid-3-1792402557839 .loopLine{stroke-width:2px;stroke-dasharray:2,2;stroke:#9370DB;fill:#9370DB;}#publish-mermaid-3-1792402557839 .note{stroke:#aaaa33;fill:#fff5ad;}#publish-mermaid-3-1792402557839 .noteText,#publish-mermaid-3-1792402557839 .noteText>tspan{fill:black;stroke:none;font-weight:normal;}#publish-mermaid-3-1792402557839 .activation0{fill:#f4f4f4;stroke:#666;}#publish-mermaid-3-1792402557839 .activation1{fill:#f4f4f4;stroke:#666;}#publish-mermaid-3-1792402557839 .activation2{fill:#f4f4f4;stroke:#666;}#publish-mermaid-3-1792402557839 .actorPopupMenu{position:absolute;}#publish-mermaid-3-1792402557839 .actorPopupMenuPanel{position:absolute;fill:#ECECFF;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);filter:drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));}#publish-mermaid-3-1792402557839 .actor-man circle,#publish-mermaid-3-1792402557839 line{fill:#ECECFF;stroke-width:2px;}#publish-mermaid-3-1792402557839 g rect.rect{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));stroke:#9370DB;}#publish-mermaid-3-1792402557839 .node .neo-node{stroke:#9370DB;}#publish-mermaid-3-1792402557839 [data-look=\”neo\”].node rect,#publish-mermaid-3-1792402557839 [data-look=\”neo\”].cluster rect,#publish-mermaid-3-1792402557839 [data-look=\”neo\”].node polygon{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-3-1792402557839 [data-look=\”neo\”].swimlane.cluster rect{filter:none;}#publish-mermaid-3-1792402557839 [data-look=\”neo\”].node path{stroke:#9370DB;stroke-width:1px;}#publish-mermaid-3-1792402557839 [data-look=\”neo\”].node .outer-path{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-3-1792402557839 [data-look=\”neo\”].node .neo-line path{stroke:#9370DB;filter:none;}#publish-mermaid-3-1792402557839 [data-look=\”neo\”].node circle{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-3-1792402557839 [data-look=\”neo\”].node circle .state-start{fill:#000000;}#publish-mermaid-3-1792402557839 [data-look=\”neo\”].icon-shape .icon{fill:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-3-1792402557839 [data-look=\”neo\”].icon-shape .icon-neo path{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-3-1792402557839 :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}发送加入请求返回集群信息同步数据数据同步完成加入成功
时序图展示了新节点加入集群的通信过程,包括请求发送、信息获取、数据同步等关键步骤。
2.3 验证节点状态
加入操作完成后,需要验证新节点状态是否正常,可通过以下命令检查:
SELECT * FROM performance_schema.replication_group_members;
#publish-mermaid-4-1792402557872{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#publish-mermaid-4-1792402557872 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#publish-mermaid-4-1792402557872 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#publish-mermaid-4-1792402557872 .error-icon{fill:#552222;}#publish-mermaid-4-1792402557872 .error-text{fill:#552222;stroke:#552222;}#publish-mermaid-4-1792402557872 .edge-thickness-normal{stroke-width:1px;}#publish-mermaid-4-1792402557872 .edge-thickness-thick{stroke-width:3.5px;}#publish-mermaid-4-1792402557872 .edge-pattern-solid{stroke-dasharray:0;}#publish-mermaid-4-1792402557872 .edge-thickness-invisible{stroke-width:0;fill:none;}#publish-mermaid-4-1792402557872 .edge-pattern-dashed{stroke-dasharray:3;}#publish-mermaid-4-1792402557872 .edge-pattern-dotted{stroke-dasharray:2;}#publish-mermaid-4-1792402557872 .marker{fill:#333333;stroke:#333333;}#publish-mermaid-4-1792402557872 .marker.cross{stroke:#333333;}#publish-mermaid-4-1792402557872 svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#publish-mermaid-4-1792402557872 p{margin:0;}#publish-mermaid-4-1792402557872 .pieCircle{stroke:black;stroke-width:2px;opacity:0.7;}#publish-mermaid-4-1792402557872 .pieCircle.highlighted{scale:1.05;opacity:1;}#publish-mermaid-4-1792402557872 .pieCircle.highlightedOnHover:hover{transition-duration:250ms;scale:1.05;opacity:1;}#publish-mermaid-4-1792402557872 .pieOuterCircle{stroke:black;stroke-width:2px;fill:none;}#publish-mermaid-4-1792402557872 .pieTitleText{text-anchor:middle;font-size:25px;fill:black;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}#publish-mermaid-4-1792402557872 .slice{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;fill:#333;font-size:17px;}#publish-mermaid-4-1792402557872 .legend text{fill:black;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:17px;}#publish-mermaid-4-1792402557872 .node .neo-node{stroke:#9370DB;}#publish-mermaid-4-1792402557872 [data-look=\”neo\”].node rect,#publish-mermaid-4-1792402557872 [data-look=\”neo\”].cluster rect,#publish-mermaid-4-1792402557872 [data-look=\”neo\”].node polygon{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-4-1792402557872 [data-look=\”neo\”].swimlane.cluster rect{filter:none;}#publish-mermaid-4-1792402557872 [data-look=\”neo\”].node path{stroke:#9370DB;stroke-width:1px;}#publish-mermaid-4-1792402557872 [data-look=\”neo\”].node .outer-path{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-4-1792402557872 [data-look=\”neo\”].node .neo-line path{stroke:#9370DB;filter:none;}#publish-mermaid-4-1792402557872 [data-look=\”neo\”].node circle{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-4-1792402557872 [data-look=\”neo\”].node circle .state-start{fill:#000000;}#publish-mermaid-4-1792402557872 [data-look=\”neo\”].icon-shape .icon{fill:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-4-1792402557872 [data-look=\”neo\”].icon-shape .icon-neo path{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-4-1792402557872 :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}75%25%MGR 集群节点状态分布ONLINERECOVERINGOFFLINE
饼图显示了当前集群的节点状态分布,可以帮助快速了解集群健康状况。
三、节点踢出实战:故障节点移除
3.1 踢出场景与判断标准
当节点出现以下情况时,需要将其踢出集群:
- 网络分区导致无法通信
- 节点故障无法恢复
- 需要维护或升级
#publish-mermaid-5-1792402557884{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#publish-mermaid-5-1792402557884 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#publish-mermaid-5-1792402557884 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#publish-mermaid-5-1792402557884 .error-icon{fill:#552222;}#publish-mermaid-5-1792402557884 .error-text{fill:#552222;stroke:#552222;}#publish-mermaid-5-1792402557884 .edge-thickness-normal{stroke-width:1px;}#publish-mermaid-5-1792402557884 .edge-thickness-thick{stroke-width:3.5px;}#publish-mermaid-5-1792402557884 .edge-pattern-solid{stroke-dasharray:0;}#publish-mermaid-5-1792402557884 .edge-thickness-invisible{stroke-width:0;fill:none;}#publish-mermaid-5-1792402557884 .edge-pattern-dashed{stroke-dasharray:3;}#publish-mermaid-5-1792402557884 .edge-pattern-dotted{stroke-dasharray:2;}#publish-mermaid-5-1792402557884 .marker{fill:#333333;stroke:#333333;}#publish-mermaid-5-1792402557884 .marker.cross{stroke:#333333;}#publish-mermaid-5-1792402557884 svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#publish-mermaid-5-1792402557884 p{margin:0;}#publish-mermaid-5-1792402557884 .label{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;color:#333;}#publish-mermaid-5-1792402557884 .cluster-label text{fill:#333;}#publish-mermaid-5-1792402557884 .cluster-label span{color:#333;}#publish-mermaid-5-1792402557884 .cluster-label span p{background-color:transparent;}#publish-mermaid-5-1792402557884 .label text,#publish-mermaid-5-1792402557884 span{fill:#333;color:#333;}#publish-mermaid-5-1792402557884 .node rect,#publish-mermaid-5-1792402557884 .node circle,#publish-mermaid-5-1792402557884 .node ellipse,#publish-mermaid-5-1792402557884 .node polygon,#publish-mermaid-5-1792402557884 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#publish-mermaid-5-1792402557884 .rough-node .label text,#publish-mermaid-5-1792402557884 .node .label text,#publish-mermaid-5-1792402557884 .image-shape .label,#publish-mermaid-5-1792402557884 .icon-shape .label{text-anchor:middle;}#publish-mermaid-5-1792402557884 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#publish-mermaid-5-1792402557884 .rough-node .label,#publish-mermaid-5-1792402557884 .node .label,#publish-mermaid-5-1792402557884 .image-shape .label,#publish-mermaid-5-1792402557884 .icon-shape .label{text-align:center;}#publish-mermaid-5-1792402557884 .node.clickable{cursor:pointer;}#publish-mermaid-5-1792402557884 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#publish-mermaid-5-1792402557884 .arrowheadPath{fill:#333333;}#publish-mermaid-5-1792402557884 .edgePath .path{stroke:#333333;stroke-width:1px;}#publish-mermaid-5-1792402557884 .flowchart-link{stroke:#333333;fill:none;}#publish-mermaid-5-1792402557884 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-5-1792402557884 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#publish-mermaid-5-1792402557884 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-5-1792402557884 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#publish-mermaid-5-1792402557884 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#publish-mermaid-5-1792402557884 .cluster text{fill:#333;}#publish-mermaid-5-1792402557884 .cluster span{color:#333;}#publish-mermaid-5-1792402557884 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#publish-mermaid-5-1792402557884 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#publish-mermaid-5-1792402557884 rect.text{fill:none;stroke-width:0;}#publish-mermaid-5-1792402557884 .icon-shape,#publish-mermaid-5-1792402557884 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-5-1792402557884 .icon-shape p,#publish-mermaid-5-1792402557884 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#publish-mermaid-5-1792402557884 .icon-shape .label rect,#publish-mermaid-5-1792402557884 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-5-1792402557884 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#publish-mermaid-5-1792402557884 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#publish-mermaid-5-1792402557884 .node .neo-node{stroke:#9370DB;}#publish-mermaid-5-1792402557884 [data-look=\”neo\”].node rect,#publish-mermaid-5-1792402557884 [data-look=\”neo\”].cluster rect,#publish-mermaid-5-1792402557884 [data-look=\”neo\”].node polygon{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-5-1792402557884 [data-look=\”neo\”].swimlane.cluster rect{filter:none;}#publish-mermaid-5-1792402557884 [data-look=\”neo\”].node path{stroke:#9370DB;stroke-width:1px;}#publish-mermaid-5-1792402557884 [data-look=\”neo\”].node .outer-path{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-5-1792402557884 [data-look=\”neo\”].node .neo-line path{stroke:#9370DB;filter:none;}#publish-mermaid-5-1792402557884 [data-look=\”neo\”].node circle{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-5-1792402557884 [data-look=\”neo\”].node circle .state-start{fill:#000000;}#publish-mermaid-5-1792402557884 [data-look=\”neo\”].icon-shape .icon{fill:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-5-1792402557884 [data-look=\”neo\”].icon-shape .icon-neo path{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-5-1792402557884 :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}是否
判断节点状态
节点是否异常?
执行踢出操作
继续监控
验证踢出结果
集群状态检查
流程图展示了节点踢出的决策流程,从状态判断到执行操作再到结果验证。
3.2 执行节点踢出操作
使用 group_replication_expel_member() 函数执行踢出操作,指定要踢出的节点 UUID。
故障节点主节点管理员故障节点主节点管理员#publish-mermaid-6-1792402557935{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#publish-mermaid-6-1792402557935 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#publish-mermaid-6-1792402557935 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#publish-mermaid-6-1792402557935 .error-icon{fill:#552222;}#publish-mermaid-6-1792402557935 .error-text{fill:#552222;stroke:#552222;}#publish-mermaid-6-1792402557935 .edge-thickness-normal{stroke-width:1px;}#publish-mermaid-6-1792402557935 .edge-thickness-thick{stroke-width:3.5px;}#publish-mermaid-6-1792402557935 .edge-pattern-solid{stroke-dasharray:0;}#publish-mermaid-6-1792402557935 .edge-thickness-invisible{stroke-width:0;fill:none;}#publish-mermaid-6-1792402557935 .edge-pattern-dashed{stroke-dasharray:3;}#publish-mermaid-6-1792402557935 .edge-pattern-dotted{stroke-dasharray:2;}#publish-mermaid-6-1792402557935 .marker{fill:#333333;stroke:#333333;}#publish-mermaid-6-1792402557935 .marker.cross{stroke:#333333;}#publish-mermaid-6-1792402557935 svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#publish-mermaid-6-1792402557935 p{margin:0;}#publish-mermaid-6-1792402557935 .actor{stroke:#9370DB;fill:#ECECFF;stroke-width:1;}#publish-mermaid-6-1792402557935 rect.actor.outer-path[data-look=\”neo\”]{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-6-1792402557935 rect.note[data-look=\”neo\”]{stroke:#aaaa33;fill:#fff5ad;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-6-1792402557935 text.actor>tspan{fill:black;stroke:none;}#publish-mermaid-6-1792402557935 .actor-line{stroke:#9370DB;}#publish-mermaid-6-1792402557935 .innerArc{stroke-width:1.5;stroke-dasharray:none;}#publish-mermaid-6-1792402557935 .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333;}#publish-mermaid-6-1792402557935 .messageLine1{stroke-width:1.5;stroke-dasharray:2,2;stroke:#333;}#publish-mermaid-6-1792402557935 [id$=\”-arrowhead\”] path{fill:#333;stroke:#333;}#publish-mermaid-6-1792402557935 .sequenceNumber{fill:white;}#publish-mermaid-6-1792402557935 [id$=\”-sequencenumber\”]{fill:#333;}#publish-mermaid-6-1792402557935 [id$=\”-crosshead\”] path{fill:#333;stroke:#333;}#publish-mermaid-6-1792402557935 .messageText{fill:#333;stroke:none;}#publish-mermaid-6-1792402557935 .labelBox{stroke:#9370DB;fill:#ECECFF;filter:none;}#publish-mermaid-6-1792402557935 .labelText,#publish-mermaid-6-1792402557935 .labelText>tspan{fill:black;stroke:none;}#publish-mermaid-6-1792402557935 .loopText,#publish-mermaid-6-1792402557935 .loopText>tspan{fill:black;stroke:none;}#publish-mermaid-6-1792402557935 .sectionTitle,#publish-mermaid-6-1792402557935 .sectionTitle>tspan{fill:black;stroke:none;}#publish-mermaid-6-1792402557935 .loopLine{stroke-width:2px;stroke-dasharray:2,2;stroke:#9370DB;fill:#9370DB;}#publish-mermaid-6-1792402557935 .note{stroke:#aaaa33;fill:#fff5ad;}#publish-mermaid-6-1792402557935 .noteText,#publish-mermaid-6-1792402557935 .noteText>tspan{fill:black;stroke:none;font-weight:normal;}#publish-mermaid-6-1792402557935 .activation0{fill:#f4f4f4;stroke:#666;}#publish-mermaid-6-1792402557935 .activation1{fill:#f4f4f4;stroke:#666;}#publish-mermaid-6-1792402557935 .activation2{fill:#f4f4f4;stroke:#666;}#publish-mermaid-6-1792402557935 .actorPopupMenu{position:absolute;}#publish-mermaid-6-1792402557935 .actorPopupMenuPanel{position:absolute;fill:#ECECFF;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);filter:drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));}#publish-mermaid-6-1792402557935 .actor-man circle,#publish-mermaid-6-1792402557935 line{fill:#ECECFF;stroke-width:2px;}#publish-mermaid-6-1792402557935 g rect.rect{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));stroke:#9370DB;}#publish-mermaid-6-1792402557935 .node .neo-node{stroke:#9370DB;}#publish-mermaid-6-1792402557935 [data-look=\”neo\”].node rect,#publish-mermaid-6-1792402557935 [data-look=\”neo\”].cluster rect,#publish-mermaid-6-1792402557935 [data-look=\”neo\”].node polygon{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-6-1792402557935 [data-look=\”neo\”].swimlane.cluster rect{filter:none;}#publish-mermaid-6-1792402557935 [data-look=\”neo\”].node path{stroke:#9370DB;stroke-width:1px;}#publish-mermaid-6-1792402557935 [data-look=\”neo\”].node .outer-path{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-6-1792402557935 [data-look=\”neo\”].node .neo-line path{stroke:#9370DB;filter:none;}#publish-mermaid-6-1792402557935 [data-look=\”neo\”].node circle{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-6-1792402557935 [data-look=\”neo\”].node circle .state-start{fill:#000000;}#publish-mermaid-6-1792402557935 [data-look=\”neo\”].icon-shape .icon{fill:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-6-1792402557935 [data-look=\”neo\”].icon-shape .icon-neo path{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-6-1792402557935 :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}发送踢出请求发送踢出指令确认踢出踢出完成
时序图展示了节点踢出的通信过程,管理员通过主节点向故障节点发送踢出指令。
3.3 验证集群稳定性
踢出操作完成后,需要验证集群是否正常运行,包括:
#publish-mermaid-7-1792402557962{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#publish-mermaid-7-1792402557962 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#publish-mermaid-7-1792402557962 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#publish-mermaid-7-1792402557962 .error-icon{fill:#552222;}#publish-mermaid-7-1792402557962 .error-text{fill:#552222;stroke:#552222;}#publish-mermaid-7-1792402557962 .edge-thickness-normal{stroke-width:1px;}#publish-mermaid-7-1792402557962 .edge-thickness-thick{stroke-width:3.5px;}#publish-mermaid-7-1792402557962 .edge-pattern-solid{stroke-dasharray:0;}#publish-mermaid-7-1792402557962 .edge-thickness-invisible{stroke-width:0;fill:none;}#publish-mermaid-7-1792402557962 .edge-pattern-dashed{stroke-dasharray:3;}#publish-mermaid-7-1792402557962 .edge-pattern-dotted{stroke-dasharray:2;}#publish-mermaid-7-1792402557962 .marker{fill:#333333;stroke:#333333;}#publish-mermaid-7-1792402557962 .marker.cross{stroke:#333333;}#publish-mermaid-7-1792402557962 svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#publish-mermaid-7-1792402557962 p{margin:0;}#publish-mermaid-7-1792402557962 .label{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;color:#333;}#publish-mermaid-7-1792402557962 .cluster-label text{fill:#333;}#publish-mermaid-7-1792402557962 .cluster-label span{color:#333;}#publish-mermaid-7-1792402557962 .cluster-label span p{background-color:transparent;}#publish-mermaid-7-1792402557962 .label text,#publish-mermaid-7-1792402557962 span{fill:#333;color:#333;}#publish-mermaid-7-1792402557962 .node rect,#publish-mermaid-7-1792402557962 .node circle,#publish-mermaid-7-1792402557962 .node ellipse,#publish-mermaid-7-1792402557962 .node polygon,#publish-mermaid-7-1792402557962 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#publish-mermaid-7-1792402557962 .rough-node .label text,#publish-mermaid-7-1792402557962 .node .label text,#publish-mermaid-7-1792402557962 .image-shape .label,#publish-mermaid-7-1792402557962 .icon-shape .label{text-anchor:middle;}#publish-mermaid-7-1792402557962 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#publish-mermaid-7-1792402557962 .rough-node .label,#publish-mermaid-7-1792402557962 .node .label,#publish-mermaid-7-1792402557962 .image-shape .label,#publish-mermaid-7-1792402557962 .icon-shape .label{text-align:center;}#publish-mermaid-7-1792402557962 .node.clickable{cursor:pointer;}#publish-mermaid-7-1792402557962 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#publish-mermaid-7-1792402557962 .arrowheadPath{fill:#333333;}#publish-mermaid-7-1792402557962 .edgePath .path{stroke:#333333;stroke-width:1px;}#publish-mermaid-7-1792402557962 .flowchart-link{stroke:#333333;fill:none;}#publish-mermaid-7-1792402557962 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-7-1792402557962 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#publish-mermaid-7-1792402557962 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-7-1792402557962 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#publish-mermaid-7-1792402557962 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#publish-mermaid-7-1792402557962 .cluster text{fill:#333;}#publish-mermaid-7-1792402557962 .cluster span{color:#333;}#publish-mermaid-7-1792402557962 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#publish-mermaid-7-1792402557962 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#publish-mermaid-7-1792402557962 rect.text{fill:none;stroke-width:0;}#publish-mermaid-7-1792402557962 .icon-shape,#publish-mermaid-7-1792402557962 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-7-1792402557962 .icon-shape p,#publish-mermaid-7-1792402557962 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#publish-mermaid-7-1792402557962 .icon-shape .label rect,#publish-mermaid-7-1792402557962 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-7-1792402557962 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#publish-mermaid-7-1792402557962 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#publish-mermaid-7-1792402557962 .node .neo-node{stroke:#9370DB;}#publish-mermaid-7-1792402557962 [data-look=\”neo\”].node rect,#publish-mermaid-7-1792402557962 [data-look=\”neo\”].cluster rect,#publish-mermaid-7-1792402557962 [data-look=\”neo\”].node polygon{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-7-1792402557962 [data-look=\”neo\”].swimlane.cluster rect{filter:none;}#publish-mermaid-7-1792402557962 [data-look=\”neo\”].node path{stroke:#9370DB;stroke-width:1px;}#publish-mermaid-7-1792402557962 [data-look=\”neo\”].node .outer-path{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-7-1792402557962 [data-look=\”neo\”].node .neo-line path{stroke:#9370DB;filter:none;}#publish-mermaid-7-1792402557962 [data-look=\”neo\”].node circle{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-7-1792402557962 [data-look=\”neo\”].node circle .state-start{fill:#000000;}#publish-mermaid-7-1792402557962 [data-look=\”neo\”].icon-shape .icon{fill:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-7-1792402557962 [data-look=\”neo\”].icon-shape .icon-neo path{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-7-1792402557962 :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}是否
验证集群稳定性
检查节点状态
验证数据一致性
测试读写功能
状态正常?
集群稳定
故障排查
流程图展示了验证集群稳定性的完整流程,确保踢出操作不影响集群正常运行。
四、节点恢复实战:故障节点重新加入
4.1 恢复场景分析
节点恢复场景包括:
- 临时故障后恢复
- 维护后重新加入
- 数据修复后重新同步
#publish-mermaid-8-1792402558131{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#publish-mermaid-8-1792402558131 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#publish-mermaid-8-1792402558131 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#publish-mermaid-8-1792402558131 .error-icon{fill:#552222;}#publish-mermaid-8-1792402558131 .error-text{fill:#552222;stroke:#552222;}#publish-mermaid-8-1792402558131 .edge-thickness-normal{stroke-width:1px;}#publish-mermaid-8-1792402558131 .edge-thickness-thick{stroke-width:3.5px;}#publish-mermaid-8-1792402558131 .edge-pattern-solid{stroke-dasharray:0;}#publish-mermaid-8-1792402558131 .edge-thickness-invisible{stroke-width:0;fill:none;}#publish-mermaid-8-1792402558131 .edge-pattern-dashed{stroke-dasharray:3;}#publish-mermaid-8-1792402558131 .edge-pattern-dotted{stroke-dasharray:2;}#publish-mermaid-8-1792402558131 .marker{fill:#333333;stroke:#333333;}#publish-mermaid-8-1792402558131 .marker.cross{stroke:#333333;}#publish-mermaid-8-1792402558131 svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#publish-mermaid-8-1792402558131 p{margin:0;}#publish-mermaid-8-1792402558131 defs [id$=\”-barbEnd\”]{fill:#333333;stroke:#333333;}#publish-mermaid-8-1792402558131 g.stateGroup text{fill:#9370DB;stroke:none;font-size:10px;}#publish-mermaid-8-1792402558131 g.stateGroup text{fill:#333;stroke:none;font-size:10px;}#publish-mermaid-8-1792402558131 g.stateGroup .state-title{font-weight:bolder;fill:#131300;}#publish-mermaid-8-1792402558131 g.stateGroup rect{fill:#ECECFF;stroke:#9370DB;}#publish-mermaid-8-1792402558131 g.stateGroup line{stroke:#333333;stroke-width:1;}#publish-mermaid-8-1792402558131 .transition{stroke:#333333;stroke-width:1;fill:none;}#publish-mermaid-8-1792402558131 .stateGroup .composit{fill:white;border-bottom:1px;}#publish-mermaid-8-1792402558131 .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px;}#publish-mermaid-8-1792402558131 .state-note{stroke:#aaaa33;fill:#fff5ad;}#publish-mermaid-8-1792402558131 .state-note text{fill:black;stroke:none;font-size:10px;}#publish-mermaid-8-1792402558131 .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5;}#publish-mermaid-8-1792402558131 .edgeLabel .label rect{fill:#ECECFF;opacity:0.5;}#publish-mermaid-8-1792402558131 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-8-1792402558131 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#publish-mermaid-8-1792402558131 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-8-1792402558131 .edgeLabel .label text{fill:#333;}#publish-mermaid-8-1792402558131 .label div .edgeLabel{color:#333;}#publish-mermaid-8-1792402558131 .stateLabel text{fill:#131300;font-size:10px;font-weight:bold;}#publish-mermaid-8-1792402558131 .node circle.state-start{fill:#333333;stroke:#333333;}#publish-mermaid-8-1792402558131 .node .fork-join{fill:#333333;stroke:#333333;}#publish-mermaid-8-1792402558131 .node circle.state-end{fill:#9370DB;stroke:white;stroke-width:1.5;}#publish-mermaid-8-1792402558131 .end-state-inner{fill:white;stroke-width:1.5;}#publish-mermaid-8-1792402558131 .node rect{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#publish-mermaid-8-1792402558131 .node polygon{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#publish-mermaid-8-1792402558131 [id$=\”-barbEnd\”]{fill:#333333;}#publish-mermaid-8-1792402558131 .statediagram-cluster rect{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#publish-mermaid-8-1792402558131 .cluster-label,#publish-mermaid-8-1792402558131 .nodeLabel{color:#131300;}#publish-mermaid-8-1792402558131 .statediagram-cluster rect.outer{rx:5px;ry:5px;}#publish-mermaid-8-1792402558131 .statediagram-state .divider{stroke:#9370DB;}#publish-mermaid-8-1792402558131 .statediagram-state .title-state{rx:5px;ry:5px;}#publish-mermaid-8-1792402558131 .statediagram-cluster.statediagram-cluster .inner{fill:white;}#publish-mermaid-8-1792402558131 .statediagram-cluster.statediagram-cluster-alt .inner{fill:#f0f0f0;}#publish-mermaid-8-1792402558131 .statediagram-cluster .inner{rx:0;ry:0;}#publish-mermaid-8-1792402558131 .statediagram-state rect.basic{rx:5px;ry:5px;}#publish-mermaid-8-1792402558131 .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#f0f0f0;}#publish-mermaid-8-1792402558131 .note-edge{stroke-dasharray:5;}#publish-mermaid-8-1792402558131 .statediagram-note rect{fill:#fff5ad;stroke:#aaaa33;stroke-width:1px;rx:0;ry:0;}#publish-mermaid-8-1792402558131 .statediagram-note rect{fill:#fff5ad;stroke:#aaaa33;stroke-width:1px;rx:0;ry:0;}#publish-mermaid-8-1792402558131 .statediagram-note text{fill:black;}#publish-mermaid-8-1792402558131 .statediagram-note .nodeLabel{color:black;}#publish-mermaid-8-1792402558131 .statediagram .edgeLabel{color:red;}#publish-mermaid-8-1792402558131 [id$=\”-dependencyStart\”],#publish-mermaid-8-1792402558131 [id$=\”-dependencyEnd\”]{fill:#333333;stroke:#333333;stroke-width:1;}#publish-mermaid-8-1792402558131 .statediagramTitleText{text-anchor:middle;font-size:18px;fill:#333;}#publish-mermaid-8-1792402558131 [data-look=\”neo\”].statediagram-cluster rect{fill:#ECECFF;stroke:#9370DB;stroke-width:1;}#publish-mermaid-8-1792402558131 [data-look=\”neo\”].statediagram-cluster rect.outer{rx:5px;ry:5px;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-8-1792402558131 .node .neo-node{stroke:#9370DB;}#publish-mermaid-8-1792402558131 [data-look=\”neo\”].node rect,#publish-mermaid-8-1792402558131 [data-look=\”neo\”].cluster rect,#publish-mermaid-8-1792402558131 [data-look=\”neo\”].node polygon{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-8-1792402558131 [data-look=\”neo\”].swimlane.cluster rect{filter:none;}#publish-mermaid-8-1792402558131 [data-look=\”neo\”].node path{stroke:#9370DB;stroke-width:1px;}#publish-mermaid-8-1792402558131 [data-look=\”neo\”].node .outer-path{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-8-1792402558131 [data-look=\”neo\”].node .neo-line path{stroke:#9370DB;filter:none;}#publish-mermaid-8-1792402558131 [data-look=\”neo\”].node circle{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-8-1792402558131 [data-look=\”neo\”].node circle .state-start{fill:#000000;}#publish-mermaid-8-1792402558131 [data-look=\”neo\”].icon-shape .icon{fill:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-8-1792402558131 [data-look=\”neo\”].icon-shape .icon-neo path{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-8-1792402558131 :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}
故障状态
恢复准备
数据修复
重新加入
在线状态
状态图展示了节点从故障到恢复的完整状态转换过程。
4.2 执行节点恢复操作
恢复操作包括数据修复和重新加入集群两个主要步骤:
#publish-mermaid-9-1792402558178{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#publish-mermaid-9-1792402558178 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#publish-mermaid-9-1792402558178 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#publish-mermaid-9-1792402558178 .error-icon{fill:#552222;}#publish-mermaid-9-1792402558178 .error-text{fill:#552222;stroke:#552222;}#publish-mermaid-9-1792402558178 .edge-thickness-normal{stroke-width:1px;}#publish-mermaid-9-1792402558178 .edge-thickness-thick{stroke-width:3.5px;}#publish-mermaid-9-1792402558178 .edge-pattern-solid{stroke-dasharray:0;}#publish-mermaid-9-1792402558178 .edge-thickness-invisible{stroke-width:0;fill:none;}#publish-mermaid-9-1792402558178 .edge-pattern-dashed{stroke-dasharray:3;}#publish-mermaid-9-1792402558178 .edge-pattern-dotted{stroke-dasharray:2;}#publish-mermaid-9-1792402558178 .marker{fill:#333333;stroke:#333333;}#publish-mermaid-9-1792402558178 .marker.cross{stroke:#333333;}#publish-mermaid-9-1792402558178 svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#publish-mermaid-9-1792402558178 p{margin:0;}#publish-mermaid-9-1792402558178 .label{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;color:#333;}#publish-mermaid-9-1792402558178 .cluster-label text{fill:#333;}#publish-mermaid-9-1792402558178 .cluster-label span{color:#333;}#publish-mermaid-9-1792402558178 .cluster-label span p{background-color:transparent;}#publish-mermaid-9-1792402558178 .label text,#publish-mermaid-9-1792402558178 span{fill:#333;color:#333;}#publish-mermaid-9-1792402558178 .node rect,#publish-mermaid-9-1792402558178 .node circle,#publish-mermaid-9-1792402558178 .node ellipse,#publish-mermaid-9-1792402558178 .node polygon,#publish-mermaid-9-1792402558178 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#publish-mermaid-9-1792402558178 .rough-node .label text,#publish-mermaid-9-1792402558178 .node .label text,#publish-mermaid-9-1792402558178 .image-shape .label,#publish-mermaid-9-1792402558178 .icon-shape .label{text-anchor:middle;}#publish-mermaid-9-1792402558178 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#publish-mermaid-9-1792402558178 .rough-node .label,#publish-mermaid-9-1792402558178 .node .label,#publish-mermaid-9-1792402558178 .image-shape .label,#publish-mermaid-9-1792402558178 .icon-shape .label{text-align:center;}#publish-mermaid-9-1792402558178 .node.clickable{cursor:pointer;}#publish-mermaid-9-1792402558178 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#publish-mermaid-9-1792402558178 .arrowheadPath{fill:#333333;}#publish-mermaid-9-1792402558178 .edgePath .path{stroke:#333333;stroke-width:1px;}#publish-mermaid-9-1792402558178 .flowchart-link{stroke:#333333;fill:none;}#publish-mermaid-9-1792402558178 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-9-1792402558178 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#publish-mermaid-9-1792402558178 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-9-1792402558178 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#publish-mermaid-9-1792402558178 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#publish-mermaid-9-1792402558178 .cluster text{fill:#333;}#publish-mermaid-9-1792402558178 .cluster span{color:#333;}#publish-mermaid-9-1792402558178 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#publish-mermaid-9-1792402558178 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#publish-mermaid-9-1792402558178 rect.text{fill:none;stroke-width:0;}#publish-mermaid-9-1792402558178 .icon-shape,#publish-mermaid-9-1792402558178 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-9-1792402558178 .icon-shape p,#publish-mermaid-9-1792402558178 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#publish-mermaid-9-1792402558178 .icon-shape .label rect,#publish-mermaid-9-1792402558178 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-9-1792402558178 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#publish-mermaid-9-1792402558178 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#publish-mermaid-9-1792402558178 .node .neo-node{stroke:#9370DB;}#publish-mermaid-9-1792402558178 [data-look=\”neo\”].node rect,#publish-mermaid-9-1792402558178 [data-look=\”neo\”].cluster rect,#publish-mermaid-9-1792402558178 [data-look=\”neo\”].node polygon{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-9-1792402558178 [data-look=\”neo\”].swimlane.cluster rect{filter:none;}#publish-mermaid-9-1792402558178 [data-look=\”neo\”].node path{stroke:#9370DB;stroke-width:1px;}#publish-mermaid-9-1792402558178 [data-look=\”neo\”].node .outer-path{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-9-1792402558178 [data-look=\”neo\”].node .neo-line path{stroke:#9370DB;filter:none;}#publish-mermaid-9-1792402558178 [data-look=\”neo\”].node circle{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-9-1792402558178 [data-look=\”neo\”].node circle .state-start{fill:#000000;}#publish-mermaid-9-1792402558178 [data-look=\”neo\”].icon-shape .icon{fill:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-9-1792402558178 [data-look=\”neo\”].icon-shape .icon-neo path{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-9-1792402558178 :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}
数据修复
应用备份
修复数据差异
重新加入集群
同步数据
状态验证
流程图展示了节点恢复的关键步骤,从数据修复到重新加入集群。
4.3 验证恢复结果
恢复完成后,需要验证节点是否正常工作:
SELECT * FROM performance_schema.replication_group_members WHERE MEMBER_STATE = 'ONLINE';
#publish-mermaid-10-1792402558213{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#publish-mermaid-10-1792402558213 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#publish-mermaid-10-1792402558213 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#publish-mermaid-10-1792402558213 .error-icon{fill:#552222;}#publish-mermaid-10-1792402558213 .error-text{fill:#552222;stroke:#552222;}#publish-mermaid-10-1792402558213 .edge-thickness-normal{stroke-width:1px;}#publish-mermaid-10-1792402558213 .edge-thickness-thick{stroke-width:3.5px;}#publish-mermaid-10-1792402558213 .edge-pattern-solid{stroke-dasharray:0;}#publish-mermaid-10-1792402558213 .edge-thickness-invisible{stroke-width:0;fill:none;}#publish-mermaid-10-1792402558213 .edge-pattern-dashed{stroke-dasharray:3;}#publish-mermaid-10-1792402558213 .edge-pattern-dotted{stroke-dasharray:2;}#publish-mermaid-10-1792402558213 .marker{fill:#333333;stroke:#333333;}#publish-mermaid-10-1792402558213 .marker.cross{stroke:#333333;}#publish-mermaid-10-1792402558213 svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#publish-mermaid-10-1792402558213 p{margin:0;}#publish-mermaid-10-1792402558213 .pieCircle{stroke:black;stroke-width:2px;opacity:0.7;}#publish-mermaid-10-1792402558213 .pieCircle.highlighted{scale:1.05;opacity:1;}#publish-mermaid-10-1792402558213 .pieCircle.highlightedOnHover:hover{transition-duration:250ms;scale:1.05;opacity:1;}#publish-mermaid-10-1792402558213 .pieOuterCircle{stroke:black;stroke-width:2px;fill:none;}#publish-mermaid-10-1792402558213 .pieTitleText{text-anchor:middle;font-size:25px;fill:black;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}#publish-mermaid-10-1792402558213 .slice{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;fill:#333;font-size:17px;}#publish-mermaid-10-1792402558213 .legend text{fill:black;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:17px;}#publish-mermaid-10-1792402558213 .node .neo-node{stroke:#9370DB;}#publish-mermaid-10-1792402558213 [data-look=\”neo\”].node rect,#publish-mermaid-10-1792402558213 [data-look=\”neo\”].cluster rect,#publish-mermaid-10-1792402558213 [data-look=\”neo\”].node polygon{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-10-1792402558213 [data-look=\”neo\”].swimlane.cluster rect{filter:none;}#publish-mermaid-10-1792402558213 [data-look=\”neo\”].node path{stroke:#9370DB;stroke-width:1px;}#publish-mermaid-10-1792402558213 [data-look=\”neo\”].node .outer-path{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-10-1792402558213 [data-look=\”neo\”].node .neo-line path{stroke:#9370DB;filter:none;}#publish-mermaid-10-1792402558213 [data-look=\”neo\”].node circle{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-10-1792402558213 [data-look=\”neo\”].node circle .state-start{fill:#000000;}#publish-mermaid-10-1792402558213 [data-look=\”neo\”].icon-shape .icon{fill:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-10-1792402558213 [data-look=\”neo\”].icon-shape .icon-neo path{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-10-1792402558213 :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}100%恢复后节点状态ONLINERECOVERINGOFFLINE
饼图显示了恢复后集群的节点状态,验证恢复操作是否成功。
五、实战总结:最佳实践与注意事项
5.1 常见问题与解决方案
MGR 节点操作中常见问题及解决方案:
| 加入失败 | 网络不通 | 检查防火墙和端口 |
| 踢出超时 | 节点响应慢 | 增加超时时间 |
| 数据不一致 | 同步问题 | 重新同步数据 |
5.2 运维建议与优化
为确保 MGR 集群稳定运行,建议:
#publish-mermaid-11-1792402558220{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#publish-mermaid-11-1792402558220 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#publish-mermaid-11-1792402558220 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#publish-mermaid-11-1792402558220 .error-icon{fill:#552222;}#publish-mermaid-11-1792402558220 .error-text{fill:#552222;stroke:#552222;}#publish-mermaid-11-1792402558220 .edge-thickness-normal{stroke-width:1px;}#publish-mermaid-11-1792402558220 .edge-thickness-thick{stroke-width:3.5px;}#publish-mermaid-11-1792402558220 .edge-pattern-solid{stroke-dasharray:0;}#publish-mermaid-11-1792402558220 .edge-thickness-invisible{stroke-width:0;fill:none;}#publish-mermaid-11-1792402558220 .edge-pattern-dashed{stroke-dasharray:3;}#publish-mermaid-11-1792402558220 .edge-pattern-dotted{stroke-dasharray:2;}#publish-mermaid-11-1792402558220 .marker{fill:#333333;stroke:#333333;}#publish-mermaid-11-1792402558220 .marker.cross{stroke:#333333;}#publish-mermaid-11-1792402558220 svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#publish-mermaid-11-1792402558220 p{margin:0;}#publish-mermaid-11-1792402558220 .label{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;color:#333;}#publish-mermaid-11-1792402558220 .cluster-label text{fill:#333;}#publish-mermaid-11-1792402558220 .cluster-label span{color:#333;}#publish-mermaid-11-1792402558220 .cluster-label span p{background-color:transparent;}#publish-mermaid-11-1792402558220 .label text,#publish-mermaid-11-1792402558220 span{fill:#333;color:#333;}#publish-mermaid-11-1792402558220 .node rect,#publish-mermaid-11-1792402558220 .node circle,#publish-mermaid-11-1792402558220 .node ellipse,#publish-mermaid-11-1792402558220 .node polygon,#publish-mermaid-11-1792402558220 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#publish-mermaid-11-1792402558220 .rough-node .label text,#publish-mermaid-11-1792402558220 .node .label text,#publish-mermaid-11-1792402558220 .image-shape .label,#publish-mermaid-11-1792402558220 .icon-shape .label{text-anchor:middle;}#publish-mermaid-11-1792402558220 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#publish-mermaid-11-1792402558220 .rough-node .label,#publish-mermaid-11-1792402558220 .node .label,#publish-mermaid-11-1792402558220 .image-shape .label,#publish-mermaid-11-1792402558220 .icon-shape .label{text-align:center;}#publish-mermaid-11-1792402558220 .node.clickable{cursor:pointer;}#publish-mermaid-11-1792402558220 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#publish-mermaid-11-1792402558220 .arrowheadPath{fill:#333333;}#publish-mermaid-11-1792402558220 .edgePath .path{stroke:#333333;stroke-width:1px;}#publish-mermaid-11-1792402558220 .flowchart-link{stroke:#333333;fill:none;}#publish-mermaid-11-1792402558220 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-11-1792402558220 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#publish-mermaid-11-1792402558220 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-11-1792402558220 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#publish-mermaid-11-1792402558220 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#publish-mermaid-11-1792402558220 .cluster text{fill:#333;}#publish-mermaid-11-1792402558220 .cluster span{color:#333;}#publish-mermaid-11-1792402558220 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#publish-mermaid-11-1792402558220 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#publish-mermaid-11-1792402558220 rect.text{fill:none;stroke-width:0;}#publish-mermaid-11-1792402558220 .icon-shape,#publish-mermaid-11-1792402558220 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-11-1792402558220 .icon-shape p,#publish-mermaid-11-1792402558220 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#publish-mermaid-11-1792402558220 .icon-shape .label rect,#publish-mermaid-11-1792402558220 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-11-1792402558220 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#publish-mermaid-11-1792402558220 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#publish-mermaid-11-1792402558220 .node .neo-node{stroke:#9370DB;}#publish-mermaid-11-1792402558220 [data-look=\”neo\”].node rect,#publish-mermaid-11-1792402558220 [data-look=\”neo\”].cluster rect,#publish-mermaid-11-1792402558220 [data-look=\”neo\”].node polygon{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-11-1792402558220 [data-look=\”neo\”].swimlane.cluster rect{filter:none;}#publish-mermaid-11-1792402558220 [data-look=\”neo\”].node path{stroke:#9370DB;stroke-width:1px;}#publish-mermaid-11-1792402558220 [data-look=\”neo\”].node .outer-path{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-11-1792402558220 [data-look=\”neo\”].node .neo-line path{stroke:#9370DB;filter:none;}#publish-mermaid-11-1792402558220 [data-look=\”neo\”].node circle{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-11-1792402558220 [data-look=\”neo\”].node circle .state-start{fill:#000000;}#publish-mermaid-11-1792402558220 [data-look=\”neo\”].icon-shape .icon{fill:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-11-1792402558220 [data-look=\”neo\”].icon-shape .icon-neo path{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-11-1792402558220 :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}
运维建议
定期状态检查
网络监控
备份恢复
逐步操作
稳定运行
流程图总结了 MGR 集群运维的关键建议,帮助保持集群高可用状态。




