LoginSignup
1
0

More than 5 years have passed since last update.

MySQL Group ReplicationでPrimaryのHOSTがどれかを確認する方法

Posted at

以下の通り

mysql> SELECT b.MEMBER_HOST, b.MEMBER_PORT FROM performance_schema.global_status as a, performance_schema.replication_group_members as b where a.VARIABLE_NAME= 'group_replication_primary_member' and a.VARIABLE_VALUE = b.MEMBER_ID;
+-------------+-------------+
| MEMBER_HOST | MEMBER_PORT |
+-------------+-------------+
| mysql-2     |        3306 |
+-------------+-------------+
1 row in set (0.00 sec)

次の2つのテーブルを結合しているだけです

mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| group_replication_applier | 3aa373dc-12bb-11e7-b4f9-00155d041428 | mysql-3     |        3306 | ONLINE       |
| group_replication_applier | 5fc11a47-055e-11e7-9b1a-00155d041426 | mysql-1     |        3306 | ONLINE       |
| group_replication_applier | cfe5952c-055f-11e7-a7f4-00155d041427 | mysql-2     |        3306 | ONLINE       |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
3 rows in set (0.00 sec)

mysql> SELECT * from performance_schema.global_status WHERE VARIABLE_NAME= 'group_replication_primary_member';
+----------------------------------+--------------------------------------+
| VARIABLE_NAME                    | VARIABLE_VALUE                       |
+----------------------------------+--------------------------------------+
| group_replication_primary_member | cfe5952c-055f-11e7-a7f4-00155d041427 |
+----------------------------------+--------------------------------------+
1 row in set (0.00 sec)
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0