mysql MGR架构mysqlrouter启动missing in the metadata

【架构说明】

MySQL8.0.31+mysqlsh8.0.31+MySQL Router  8.0.31

【报错信息】

2023-03-13 10:01:07 metadata_cache WARNING [7ffae4130700] GR member productionbackup:3306 (00013306-2222-2222-2222-222222222222) Online, missing in the metadata
2023-03-13 10:01:07 metadata_cache INFO [7ffae4130700] Potential changes detected in cluster 'ytt_mgr' after metadata refresh
2023-03-13 10:01:07 metadata_cache INFO [7ffae4130700] Metadata for cluster 'ytt_mgr' has 2 member(s), single-primary: (view_id=0)
2023-03-13 10:01:07 metadata_cache INFO [7ffae4130700] localshow:3306 / 33060 - mode=RW
2023-03-13 10:01:07 metadata_cache INFO [7ffae4130700] pg-development:3306 / 33060 - mode=RO

【分析】

分析:查看报错信息,一个节点跟MGR存储的元数据有问题,查看全部节点的状态信息

 ssl JS > \sql select * from performance_schema.replication_group_members;
Fetching global names for auto-completion... Press ^C to stop.
+---------------------------+--------------------------------------+------------------+-------------+--------------+-------------+----------------+----------------------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION | MEMBER_COMMUNICATION_STACK |
+---------------------------+--------------------------------------+------------------+-------------+--------------+-------------+----------------+----------------------------+
| group_replication_applier | 00013306-1111-1111-1111-111111111111 | localshow | 3306 | ONLINE | PRIMARY | 8.0.31 | XCom |
| group_replication_applier | 00013306-2222-2222-2222-222222222222 | productionbackup | 3306 | ONLINE | SECONDARY | 8.0.31 | XCom |
| group_replication_applier | 00013306-3333-3333-3333-333333333333 | pg-development | 3306 | ONLINE | SECONDARY | 8.0.31 | XCom |
+---------------------------+--------------------------------------+------------------+-------------+--------------+-------------+----------------+----------------------------+

查看节点状态信息是正常的,从这里查看不出问题,使用status查看更详细的信息

"productionbackup:3306": {
"address": "productionbackup:3306",
"instanceErrors": [
"WARNING: Instance is not managed by InnoDB cluster. Use cluster.rescan() to repair."
],
"memberRole": "SECONDARY",
"mode": "R/O",
"readReplicas": {},
"replicationLag": "applier_queue_applied",
"role": "HA",
"status": "ONLINE",
"version": "8.0.31"
}

这里提示使用cluster.rescan() 方式修复这个节点信息,查看官网说明,这里说明在集群异常情况下,可以使用cluster.rescan()更新集群的元数据信息:

https://dev.mysql.com/doc/mysql-shell/8.0/en/rescan-cluster.html

ssl JS > cluster.rescan();
Rescanning the cluster...

Result of the rescanning operation for the 'ytt_mgr' cluster:
{
"name": "ytt_mgr",
"newTopologyMode": null,
"newlyDiscoveredInstances": [
{
"host": "productionbackup:3306",
"member_id": "00013306-2222-2222-2222-222222222222",
"name": null,
"version": "8.0.31"
}
],
"unavailableInstances": [],
"updatedInstances": []
}

A new instance 'productionbackup:3306' was discovered in the cluster.
Would you like to add it to the cluster metadata? [Y/n]: y
Adding instance to the cluster metadata...
The instance 'productionbackup:3306' was successfully added to the cluster metadata.

WARNING: The Cluster is not configured to use 'group_replication_view_change_uuid', which is required for InnoDB ClusterSet. Configuring it requires a full Cluster reboot.
Would you like 'group_replication_view_change_uuid' to be configured automatically? [Y/n]: y
NOTE: The Cluster's group_replication_view_change_uuid is not set
Generating and setting a value for group_replication_view_change_uuid...
WARNING: The Cluster must be completely taken OFFLINE and restarted (dba.rebootClusterFromCompleteOutage()) for the settings to be effective
ssl JS > dba.rebootClusterFromCompleteOutage()
Restoring the Cluster 'ytt_mgr' from complete outage...

Cluster instances: 'localshow:3306' (ONLINE), 'pg-development:3306' (ONLINE), 'productionbackup:3306' (ONLINE)
Dba.rebootClusterFromCompleteOutage: The Cluster is ONLINE (RuntimeError)

使用扫描后再次查看status信息,节点信息正常,重启mysqlrouter后识别到异常节点信息,注意以上操作在业务低峰期操作。

2023-03-13 10:26:32 metadata_cache INFO [7f9a9c5ff700] Connected with metadata server running on localshow:3306
2023-03-13 10:26:32 metadata_cache INFO [7f9a9c5ff700] Potential changes detected in cluster 'ytt_mgr' after metadata refresh
2023-03-13 10:26:32 metadata_cache INFO [7f9a9c5ff700] Metadata for cluster 'ytt_mgr' has 3 member(s), single-primary: (view_id=0)
2023-03-13 10:26:32 metadata_cache INFO [7f9a9c5ff700] localshow:3306 / 33060 - mode=RW
2023-03-13 10:26:32 metadata_cache INFO [7f9a9c5ff700] pg-development:3306 / 33060 - mode=RO
2023-03-13 10:26:32 metadata_cache INFO [7f9a9c5ff700] productionbackup:3306 / 33060 - mode=RO

测试mysqlrouter连接读写节点正常。

posted @ 2023-03-13 10:54  zetan·chen  阅读(177)  评论(0编辑  收藏  举报