var cluster = dba.createCluster('Cluster01')
var cluster = dba.getCluster('Cluster01')
cluster.describe()
cluster.status()
MySQL 192.168.150.232:33060+ ssl JS > cluster.status(){"clusterName": "Cluster01","defaultReplicaSet": {......"topology": {"node1:3306": {"address": "node1:3306","memberRole": "PRIMARY","mode": "R/W","readReplicas": {},"replicationLag": null,"role": "HA","status": "ONLINE","version": "8.0.25"},"node2:3306": {......},"node3:3306": {......}},"topologyMode": "Single-Primary"},"groupInformationSourceMember": "node1:3306"}
ONLINE:实例在线并加入集群。 OFFLINE:该实例已失去与其他实例的连接。 RECOVERING:该实例正在检索它需要的事务来与集群同步 。 UNREACHABLE:实例已失去与集群的通信。 ERROR:实例在恢复阶段或应用事务时遇到错误。
dba.checkInstanceConfiguration('mgr_user@node4:3306')
cluster.checkInstanceState('mgr_user@node4:3306')
MySQL 192.168.150.232:33060+ ssl JS > cluster.checkInstanceState('mgr_user@node4:3306')Analyzing the instance 'bg-db-mysql-voicemonitor_pre:3306' replication state...The instance 'bg-db-mysql-voicemonitor_pre:3306' is valid for the cluster.The instance is new to Group Replication.{"reason": "new","state": "ok"}
OK new:实例没有执行任何 GTID 事务,因此不会与集群执行的 GTID 冲突。 OK 可恢复:实例执行的 GTID 与集群种子实例执行的 GTID 不冲突。 ERROR diverged: 实例执行的 GTID 与集群种子实例执行的 GTID 不一致。 ERROR lost_transactions:实例执行的 GTID 比集群种子实例的执行 GTID 多。
cluster.addInstance('mgr_user@192.168.150.123:3306');
cluster.removeInstance('mgr_user@192.168.150.123:3306');
cluster.options()
cluster.setOption(option, value)
cluster.setInstanceOption(instance, option, value)
cluster.rejoinInstance(instance)
cluster.forceQuorumUsingPartitionOf('mgr_user@node1:3306');
ERROR: Cannot perform operation on an healthy cluster because it can only be used to restore a cluster from quorum loss.Cluster.forceQuorumUsingPartitionOf: The cluster has quorum according to instance 'node1:3306' (RuntimeError)
cluster.switchToMultiPrimaryMode()
cluster.switchToSinglePrimaryMode('node3:3306')
cluster.rescan()
MGR 常用的一些操作就介绍到这里,欢迎在留言区补充更多的命令。
我们创建了一个 MySQL 交流社群,围绕开发、运维、DBA、架构师和其他需要用到 MySQL 的群体,群内会分享一些读书笔记、面试技巧等,同时也用于大家交流使用 MySQL 过程中遇到的问题!
入群请加下方群秘二维码,回复 MySQL,等待群秘邀你入群。

文章转载自MySQL数据库联盟,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




