8.10 升级InnoDB ClusterSet

2024年 3月 5日 12.2k 0

  1. 通过检查 InnoDB ClusterSet 的状态开始升级后检查。此检查使用 .status({extended:1}) operation.

    在这个例子中,我们发出 .status({extended:1})

    解释 mysql-js>.status({extended:1})
    {
    "clusters": {
    "cluster1": {
    "clusterRole": "PRIMARY",
    "globalStatus": "OK",
    "primary": "127.0.0.1:3310",
    "status": "OK_NO_TOLERANCE",
    "statusText": "Cluster is NOT tolerant to any failures.",
    "topology": {
    "127.0.0.1:3310": {
    "address": "127.0.0.1:3310",
    "memberRole": "PRIMARY",
    "mode": "R/W",
    "status": "ONLINE",
    "version": "8.0.28"
    }
    },
    "transactionSet": "c0361cad-9093-11ec-94ce-0a0027000010:1-90,c0362acf-9093-11ec-94ce-0a0027000010:1"
    },
    "replicacluster1": {
    "clusterErrors": [
    "ERROR: Cluster members are reachable but they're all OFFLINE.",
    "WARNING: Replication from the Primary Cluster not in expected state"
    ],
    "clusterRole": "REPLICA",
    "clusterSetReplication": {
    "applierStatus": "OFF",
    "applierThreadState": "",
    "applierWorkerThreads": 4,
    "receiver": "127.0.0.1:3320",
    "receiverStatus": "OFF",
    "receiverThreadState": "",
    "source": "127.0.0.1:3310"
    },
    "clusterSetReplicationStatus": "STOPPED",
    "globalStatus": "NOT_OK",
    "status": "OFFLINE",
    "statusText": "All members of the group are OFFLINE",
    "topology": {
    "127.0.0.1:3320": {
    "address": "127.0.0.1:3320",
    "instanceErrors": [
    "NOTE: group_replication is stopped."
    ],
    "memberRole": "SECONDARY",
    "memberState": "OFFLINE",
    "mode": "R/O",
    "status": "(MISSING)",
    "version": "8.0.28"
    }
    },
    "transactionSet": "1ec95a0b-9094-11ec-9bc5-0a0027000010:1,c0361cad-9093-11ec-94ce
    -0a0027000010:1-90,c0362acf-9093-11ec-94ce-0a0027000010:1",
    "transactionSetConsistencyStatus": "OK",
    "transactionSetErrantGtidSet": "",
    "transactionSetMissingGtidSet": ""
    },
    "replicacluster2": {
    "clusterRole": "REPLICA",
    "clusterSetReplication": {
    "applierStatus": "APPLIED_ALL",
    "applierThreadState": "Waiting for an event from Coordinator",
    "applierWorkerThreads": 4,
    "receiver": "127.0.0.1:3330",
    "receiverStatus": "ON",
    "receiverThreadState": "Waiting for source to send event",
    "source": "127.0.0.1:3310"
    },
    "clusterSetReplicationStatus": "OK",
    "globalStatus": "OK",
    "status": "OK_NO_TOLERANCE",
    "statusText": "Cluster is NOT tolerant to any failures.",
    "topology": {
    "127.0.0.1:3330": {
    "address": "127.0.0.1:3330",
    "memberRole": "PRIMARY",
    "mode": "R/O",
    "replicationLagFromImmediateSource": "",
    "replicationLagFromOriginalSource": "",
    "status": "ONLINE",
    "version": "8.0.28"
    }
    },
    "transactionSet": "329dc243-9094-11ec-b9dd-0a0027000010:1,c0361cad-9093-11ec
    -94ce-0a0027000010:1-90,c0362acf-9093-11ec-94ce-0a0027000010:1",
    "transactionSetConsistencyStatus": "OK",
    "transactionSetErrantGtidSet": "",
    "transactionSetMissingGtidSet": ""
    }
    },
    "domainName": "clusterset1",
    "globalPrimaryInstance": "127.0.0.1:3310",
    "metadataServer": "127.0.0.1:3310",
    "primaryCluster": "cluster1",
    "status": "AVAILABLE",
    "statusText": "Primary Cluster available, there are issues with a Replica cluster."
    }

    有关该 .status()操作的更多信息,请参阅 ClusterSet.status()。

  2. 解决操作返回的任何错误 .status({extended:1})

    在此示例中,我们返回一个错误, clusterErrors通知我们 .status({extended:1}) 操作无法连接到任何在线成员,并且statusText主集群可用,但 InnoDB ClusterSet 中的副本集群存在问题。

    解释 ...
    "replicacluster1": {
    "clusterErrors": [
    "ERROR: Could not connect to any ONLINE members but there are unreachable instances
    that could still be ONLINE."
    ],
    ...
    "statusText": "Primary Cluster available, there are issues with a Replica cluster."
    }

    在此示例中,我们需要检查 InnoDB Cluster 的状态replicacluster1并确保其重新上线。

  3. 一旦我们解决了操作返回的问题 .status({extended:1}) ,我们就检查 ClusterSet 中每个 InnoDB Cluster 的状态。

    通过发出 来检查每个 InnoDB Cluster 的状态 .status()

    在以下示例中, .status({extended: true})用于提供有关 InnoDB Cluster 状态的更详细信息,返回两个问题:

    解释 mysqlsh> cluster.status({extended: true});
    {
    "clusterName": "MyCluster",
    "defaultReplicaSet": {
    "GRProtocolVersion": "8.0.16",
    "groupName": "459ec434-8926-11ec-b8c3-02001707f44a",
    "groupViewChangeUuid": "AUTOMATIC",
    "groupViewId": "16443558036060755:13",
    "name": "default",
    "ssl": "REQUIRED",
    "status": "OK",
    "statusText": "Cluster is ONLINE and can tolerate up to ONE failure.",
    "topology": {
    "example-el7-1644251369:33311": {
    "address": "example-el7-1644251369:33311",
    "applierWorkerThreads": 4,
    "fenceSysVars": [],
    "instanceErrors": [
    "NOTE: instance server_id is not registered in the metadata.
    Use cluster.rescan() to update the metadata.",
    "NOTE: The required parallel-appliers settings are not enabled on the instance.
    Use dba.configureInstance() to fix it."
    ],
    "memberId": "247131ab-8926-11ec-850b-02001707f44a",
    "memberRole": "PRIMARY",
    "memberState": "ONLINE",
    "mode": "R/W",
    "readReplicas": {},
    "replicationLag": null,
    "role": "HA",
    "status": "ONLINE",
    "version": "8.0.28"
    },
    "example-el7-1644251369:33314": {
    "address": "example-el7-1644251369:33314",
    "applierWorkerThreads": 4,
    "fenceSysVars": [],
    "instanceErrors": [
    "NOTE: instance server_id is not registered in the metadata.
    Use cluster.rescan() to update the metadata.",
    "NOTE: The required parallel-appliers settings are not enabled on the instance.
    Use dba.configureInstance() to fix it."
    ],
    "memberId": "303dcfa7-8926-11ec-a6e5-02001707f44a",
    "memberRole": "PRIMARY",
    "memberState": "ONLINE",
    "mode": "R/W",
    "readReplicas": {},
    "replicationLag": null,
    "role": "HA",
    "status": "ONLINE",
    "version": "8.0.28"
    },
    "example-el7-1644251369:33317": {
    "address": "example-el7-1644251369:33317",
    "applierWorkerThreads": 4,
    "fenceSysVars": [],
    "instanceErrors": [
    "NOTE: instance server_id is not registered in the metadata.
    Use cluster.rescan() to update the metadata.",
    "NOTE: The required parallel-appliers settings are not enabled on the instance.
    Use dba.configureInstance() to fix it."
    ],
    "memberId": "3bb2592e-8926-11ec-8b6f-02001707f44a",
    "memberRole": "PRIMARY",
    "memberState": "ONLINE",
    "mode": "R/W",
    "readReplicas": {},
    "replicationLag": null,
    "role": "HA",
    "status": "ONLINE",
    "version": "8.0.28"
    }
    },
    "topologyMode": "Multi-Primary"
    },
    "groupInformationSourceMember": "example-el7-1644251369:33311",
    "metadataVersion": "2.1.0"
    }

    .status({extended: true}) 显示有关集群的更多详细信息。在本例中,我们使用布尔值true,它相当于 .status({'extended':1})。有关更多信息,请参阅 使用 检查集群的状态 Cluster.status()

    建议instanceErrors在本次升级中,我们应该 对 InnoDB Cluster 中的每个成员 发出.rescan()和 :dba.configureInstance()

    解释...
    "NOTE: instance server_id is not registered in the
    metadata. Use cluster.rescan() to update the metadata.",
    "NOTE: The required parallel-appliers settings are not
    enabled on the instance. Use dba.configureInstance() to fix it."
    ...

    .rescan()操作使您能够重新扫描 InnoDB Cluster 以查找新的和过时的组复制实例,以及所用拓扑模式的更改。有关更多信息,请参阅 重新扫描集群。

    解释mysqlsh> cluster1.rescan();
    Rescanning the cluster...

    Result of the rescanning operation for the 'MyCluster1' cluster:
    {
    "name": "MyCluster1",
    "newTopologyMode": null,
    "newlyDiscoveredInstances": [],
    "unavailableInstances": [],
    "updatedInstances": []
    }

    笔记

    您只能.rescan()在 ClusterSet 的各个 Cluster 上运行,而不能在整个 ClusterSet 上运行。

    dba.configureInstance()函数检查使实例能够用于 InnoDB Cluster 使用所需的所有设置。有关更多信息,请参阅 配置生产实例以供 InnoDB 集群使用。

    在此示例中,我们 dba.configureInstance()对集群中的每个成员发出问题,以确保在实例上启用所需的并行应用程序设置:

    解释 mysqlsh> dba.configureInstance('cladmin:cladminpw@localhost:33311')
    The instance 'example-el7-1644251369:33311' belongs to an InnoDB Cluster.
    Configuring local MySQL instance listening at port 33311 for use in an InnoDB cluster...

    This instance reports its own address as ^[[1mexample-el7-1644251369:33311^[[0m
    Clients and other cluster members will communicate with it through this address by default.
    If this is not correct, the report_host MySQL system variable should be changed.

    applierWorkerThreads will be set to the default value of 4.

    ^[[36mNOTE: ^[[0mSome configuration options need to be fixed:
    +----------------------------------------+---------------+----------------+----------------------------+
    | Variable | Current Value | Required Value | Note |
    +----------------------------------------+---------------+----------------+----------------------------+
    | binlog_transaction_dependency_tracking | COMMIT_ORDER | WRITESET | Update the server variable |
    +----------------------------------------+---------------+----------------+----------------------------+

    Configuring instance...
    The instance 'example-el7-1644251369:33311' was configured to be used in an InnoDB cluster.

  4. .status({extended:1})解决了和 操作 返回的问题后 .status({extended:1}),您必须运行.listRouters().

    .listRouters()返回所有已注册 MySQL Router 实例的详细信息。详细信息提供有关每个注册的 MySQL Router 实例的信息,例如元数据中的名称、主机名、端口等。有关更多信息,请参阅 将 MySQL Router 与 InnoDB ClusterSet 集成。

    例如,在我们的示例 ClusterSet 上,我们发出:

    解释mysqlsh> .listRouters();

    WARNING: The following Routers were bootstrapped before the ClusterSet was created: [EXAMPLE::R1].
    Please re-bootstrap the Routers to ensure the optimal configurations are set.

    {
    "domainName": "MyClusterSet",
    "routers": {
    "EXAMPLE::R1": {
    "hostname": "EXAMPLE",
    "lastCheckIn": "2022-02-23 07:14:50",
    "roPort": 6447,
    "roXPort": 6449,
    "routerErrors": [
    "WARNING: Router needs to be re-bootstraped."
    ],
    "rwPort": 6446,
    "rwXPort": 6448,
    "targetCluster": null,
    "version": "8.0.28"
    }
    }
    }

    返回的信息显示:

    • MySQL 路由器实例的名称。
    • 最后签入时间戳,由存储在元数据中的 MySQL 路由器的定期 ping 生成。
    • 运行 MySQL Router 实例的主机名。
    • MySQL 路由器为经典 MySQL 协议连接发布的只读和读写端口。
    • MySQL 路由器为 X 协议连接发布的只读和读写端口。
    • 目标集群的名称。在此示例中,MySQL Router 将流量从客户端应用程序定向到 InnoDB ClusterSet 部署中当前为主集群的集群。
    • 此 MySQL Router 实例的版本。

    在这个例子中,还有关于 routerErrors返回的信息。

    通知routerErrors我们 MySQL Router 需要重新引导。出现此错误的原因是,如果您基于该独立 Cluster 创建 ClusterSet,则必须再次引导 MySQL Router 以通知 Router 它正在处理 ClusterSet。

    解决这些警告以完成升级后检查。如果您没有收到任何警告,则表示升级后检查已完成。

相关文章

最新发布!MySQL 9.0 的向量 (VECTOR) 类型文档更新
国产数据库中级认证HCIP-openGauss经验分享
保障数据完整性与稳定性:数据库一致性
OceanBase 里的 DDL 超时时间
OceanBase v3.1.x 将不再更新版本 | 社区月报2024.6
openGauss Developer Day 2024 | SIG组工作会议亮点回看!

发布评论