In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.