In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
MySQL 5.7
This can be determined by global status group_replication_primary_member
root@db20:59: [mgr]> SELECT VARIABLE_VALUE -> FROM performance_schema.global_status -> WHERE VARIABLE_NAME = 'group_replication_primary_member';+--------------------------------------+| VARIABLE_VALUE |+--------------------------------------+| f8da6826-328a-11e9-8e54-000c29d7ca48 |+--------------------------------------+1 row in set (0.00 sec)
The hostname and port information can be obtained in conjunction with the performance_schema.replication_group_members table:
root@db21:05: [mgr]> SELECT -> MEMBER_HOST, MEMBER_PORT -> FROM -> performance_schema.replication_group_members -> WHERE -> MEMBER_ID = (SELECT -> VARIABLE_VALUE -> FROM -> performance_schema.global_status -> WHERE -> VARIABLE_NAME = 'group_replication_primary_member');+-------------+-------------+| MEMBER_HOST | MEMBER_PORT |+-------------+-------------+| mgr1 | 3306 |+-------------+-------------+1 row in set (0.00 sec)
Or get all member information:
root@db21:05: [mgr]> SELECT -> MEMBER_ID, -> MEMBER_HOST, -> MEMBER_PORT, -> MEMBER_STATE, -> IF(global_status.VARIABLE_NAME IS NOT NULL, -> 'PRIMARY', -> 'SECONDARY') AS MEMBER_ROLE -> FROM -> performance_schema.replication_group_members -> LEFT JOIN -> performance_schema.global_status ON global_status.VARIABLE_NAME = 'group_replication_primary_member' -> AND global_status.VARIABLE_VALUE = replication_group_members.MEMBER_ID;+--------------------------------------+-------------+-------------+--------------+-------------+| MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE |+--------------------------------------+-------------+-------------+--------------+-------------+| f8da6826-328a-11e9-8e54-000c29d7ca48 | mgr1 | 3306 | ONLINE | PRIMARY || 030930d7-32b2-11e9-8298-000c292aafc5 | mgr2 | 3306 | ONLINE | SECONDARY || 202bdcd5-32b3-11e9-9f4f-000c29322d33 | mgr3 | 3306 | ONLINE | SECONDARY |+--------------------------------------+-------------+-------------+--------------+-------------+3 rows in set (0.01 sec)MySQL 8.0.2 and Later
MySQL 8.0.2 started, Performance Schema extended
SELECT MEMBER_HOST, MEMBER_PORT FROM performance_schema.replication_group_members WHERE MEMBER_ROLE = 'PRIMARY';
Or get all member information:
mysql> SELECT MEMBER_ID, MEMBER_HOST, MEMBER_PORT, MEMBER_STATE, MEMBER_ROLE, MEMBER_VERSION FROM performance_schema.replication_group_members;
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.