Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

[MySQL] Database Middleware-- ProxySQL+MGR

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

[root@wallet01] # mysql-uroot-p

< addition_to_sys.sql Enter password:[root@wallet01 ~]# mysql -uroot -pEnter password:mysql>

Select * from sys.gr_member_routing_candidate_status +-- + | viable_candidate | read_only | transactions_behind | transactions_to_cert | +- -+-+ | YES | NO | 0 | 0 | + -+-+ 1 row in set (0.00 sec) mysql > create user monitor@'192.168.40.%' identified by 'monitor@2019' Query OK, 0 rows affected (0.11 sec) mysql > grant select on sys.* to monitor@'192.168.40.%'; Query OK, 0 rows affected (0.04 sec) [root@wallet02] # mysql-uroot-pEnter password:mysql > select * from sys.gr_member_routing_candidate_status +-- + | viable_candidate | read_only | transactions_behind | transactions_to_cert | +- -+-+ | YES | YES | 0 | 0 | + -+-- + 1 row in set (0.00 sec) [root@wallet03 ~] # mysql-uroot-pEnter password:mysql > select * from sys.gr_member_routing_candidate_status +-- + | viable_candidate | read_only | transactions_behind | transactions_to_cert | +- -+-+ | YES | YES | 0 | 0 | + -+-- + 1 row in set (0.00 sec) [root@wallet04 ~] # cat insert into mysql_servers (hostgroup_id Hostname,port) values (10meme 192.168.40.34pr 3306), (10rect 192.168.40.35pr 3306), (10meme 192.168.40.36pr 3306) Query OK, 3 rows affected (0.00 sec) Admin > load mysql servers to runtime;Query OK, 0 rows affected (0.01 sec) Admin > save mysql servers to disk;Query OK, 0 rows affected (0.42 sec) Admin > select hostgroup_id,hostname,port,status,weight from mysql_servers +-+ | hostgroup_id | hostname | port | status | weight | +- -+ | 10 | 192.168.40.34 | 3306 | ONLINE | 1 | | 10 | 192.168.40.35 | 3306 | ONLINE | 1 | 1 | 10 | 192.168.40.36 | 3306 | ONLINE | 1 | +- -- +-+ 3 rows in set (0.00 sec) Admin > set mysql-monitor_username='monitor' Query OK, 1 row affected (0.00 sec) Admin > set mysql-monitor_password='monitor@2019';Query OK, 1 row affected (0.00 sec) Admin > load mysql variables to runtime;Query OK, 0 rows affected (0.00 sec) Admin > save mysql variables to disk;Query OK, 136 rows affected (0.06 sec) Admin > insert into mysql_group_replication_hostgroups (writer_hostgroup,backup_writer_hostgroup,reader_hostgroup,offline_hostgroup,active,max_writers,writer_is_also_reader,max_transactions_behind) values Query OK, 1 row affected (0.00 sec) Admin > load mysql servers to runtime;Query OK, 0 rows affected (0.01 sec) Admin > save mysql servers to disk Query OK 0 rows affected (0.49 sec) Admin > select * from mysql_group_replication_hostgroups\ gateway * 1. Row * * writer_hostgroup: 10backup_writer_hostgroup: 20 reader_hostgroup: 30 offline_hostgroup: 40 active: 1 Max_writers: 1 writer_is_also_reader: 0max_transactions_behind: 0 comment: NULL1 row in set (0.00 sec) Admin > select hostgroup_id Hostname, port,status from runtime_mysql_servers +-+ | hostgroup_id | hostname | port | status | +-+ | 10 | 192.168.40. 34 | 3306 | ONLINE | | 30 | 192.168.40.35 | 3306 | ONLINE | | 30 | 192.168.40.36 | 3306 | ONLINE | +-+ 3 rows in set (0.00 sec) Admin > insert into mysql_users (username) Password,default_hostgroup,transaction_persistent) values ('sakila','sakila@2019',10,1) Query OK, 1 row affected (0.00 sec) Admin > load mysql users to runtime;Query OK, 0 rows affected (0.00 sec) Admin > save mysql users to disk;Query OK, 0 rows affected (0.14 sec) Admin > insert into mysql_query_rules (rule_id,active,match_digest,destination_hostgroup,apply) values Query OK, 0 rows affected (0.00 sec) Admin > save mysql query rules to disk;Query OK, 0 rows affected (0.20 sec) Admin > select hostgroup,digest_text from stats_mysql_query_digest +-+-+ | hostgroup | digest_text | | +-+-- + | 10 | | DELETE FROM `rental` WHERE (`rental` =?) | | 30 | SELECT * FROM `store` LIMIT? | | 10 | SHOW COLUMNS FROM `sakila`.`customer` | | 10 | SHOW COLUMNS FROM `sakila`.`actor` | | 30 | SELECT * FROM `customy`WHERE (`sakila`customer` =?) LIMIT? | | 10 | UPDATE `roomy` SET `last_ update` =? WHERE (`country_ id` =?) | | 30 | SELECT * FROM `roomy` LIMIT?,? |

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report