【MySQL】数据库中间件--ProxySQL+MGR
发表于:2025-02-03 作者:千家信息网编辑
千家信息网最后更新 2025年02月03日,[root@wallet01 ~]# mysql -uroot -p < addition_to_sys.sql Enter password:[root@wallet01 ~]# mysql -ur
千家信息网最后更新 2025年02月03日【MySQL】数据库中间件--ProxySQL+MGR
[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 <'Admin>insert into mysql_servers(hostgroup_id,hostname,port) values(10,'192.168.40.34',3306), (10,'192.168.40.35',3306), (10,'192.168.40.36',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 || 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(10,20,30,40,1,1,0,0);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\G*************************** 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(1,1,'^SELECT.*FOR UPDATE$',10,1),(2,1,'^SELECT',30,1);Query OK, 2 rows affected (0.00 sec)Admin>load mysql query rules to runtime;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_id`=?) || 30 | SELECT * FROM `store` LIMIT ?, ? || 10 | SHOW COLUMNS FROM `sakila`.`customer` || 10 | SHOW COLUMNS FROM `sakila`.`actor` || 30 | SELECT * FROM `country` WHERE (`country_id`=?) LIMIT ? || 10 | UPDATE `country` SET `last_update`=? WHERE (`country_id`=?) || 30 | SELECT * FROM `country` LIMIT ?, ? |
中间件
数据
数据库
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
湖北服务器虚拟化定制虚拟主机
斐讯k2 服务器
做服务器安全
上海香航网络技术有限公司
网络安全制度及应急制度
同一个服务器不同网段怎么开共享
民航网络安全管理制度
通达信手机版数据库源码
影集模板软件开发
恒远科技工业互联网
mysql数据库表没了
软件开发人员加班制度
吉林省翰霖网络技术公司
网络安全险
云厂商为何要自研服务器
东莞市信息与网络安全
游戏赌场软件开发
db2数据库数据迁移
我的世界手机版制作服务器
数据库计算出错
最新的网络技术有哪些及影响
网络技术人才在哪找
计算机网络技术从哪学习
金额 数据库
软件开发密码产品
嘉祥租房软件开发
杭州软件开发有什么途径
世界级网络安全学院
软件开发任职能力要求
北京三七零网络技术有限公司