performance_schema.replication_group_members 表用于监控作为组成员的不同服务器实例的状态。表中的信息会在视图发生变化时更新,例如当新的成员加入时动态更改组配置。在此时,服务器会交换部分元数据以同步自身并继续协同工作。信息在所有属于复制组的服务器实例之间共享,因此可以从任何成员查询所有组成员的信息。此表可用于获取复制组状态的高级概览,例如通过执行:The
performance_schema.replication_group_members
table is used for monitoring the status of the different server
instances that are members of the group. The information in the
table is updated whenever there is a view change, for example when
the configuration of the group is dynamically changed when a new
member joins. At that point, servers exchange some of their
metadata to synchronize themselves and continue to cooperate
together. The information is shared between all the server
instances that are members of the replication group, so
information on all the group members can be queried from any
member. This table can be used to get a high level view of the
state of a replication group, for example by issuing:
SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+----------------------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION | MEMBER_COMMUNICATION_STACK |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+----------------------------+
| group_replication_applier | d391e9ee-2691-11ec-bf61-00059a3c7a00 | example1 | 4410 | ONLINE | PRIMARY | 8.4.9 | XCom |
| group_replication_applier | e059ce5c-2691-11ec-8632-00059a3c7a00 | example2 | 4420 | ONLINE | SECONDARY | 8.4.9 | XCom |
| group_replication_applier | ecd9ad06-2691-11ec-91c7-00059a3c7a00 | example3 | 4430 | ONLINE | SECONDARY | 8.4.9 | XCom |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+----------------------------+
3 rows in set (0.0007 sec)
根据这个结果,我们可以看到该组由三个成员组成。表中显示了每个成员的server_uuid,以及成员的主机名和端口号,客户端可以通过这些信息连接到成员。MEMBER_STATE 列显示了第 20.4.2 节,“组复制服务器状态”中的一种状态,在本例中,它显示该组的三个成员都是 ONLINE 状态,而 MEMBER_ROLE 列显示该组有两个从节点和一个主节点。因此,该组必须以单主模式运行。MEMBER_VERSION 列在升级组并组合运行不同 MySQL 版本的成员时可能非常有用。MEMBER_COMMUNICATION_STACK 列显示该组使用的通信栈。Based on this result we can see that the group consists of three
members. Shown in the table is each member's
server_uuid, as well as the
member's host name and port number, which clients use to connect
to it. The MEMBER_STATE column shows one of the
Section 20.4.2, “Group Replication Server States”, in this case it
shows that all three members in this group are
ONLINE, and the MEMBER_ROLE
column shows that there are two secondaries, and a single primary.
Therefore this group must be running in single-primary mode. The
MEMBER_VERSION column can be useful when you
are upgrading a group and are combining members running different
MySQL versions. The MEMBER_COMMUNICATION_STACK
column shows the communication stack used for the group.
有关 MEMBER_HOST 值及其对分布式恢复过程影响的更多信息,请参见 第 20.2.1.3 节,“分布式恢复的用户凭据”。For more information about the MEMBER_HOST
value and its impact on the distributed recovery process, see
Section 20.2.1.3, “User Credentials For Distributed Recovery”.