【MySQL】数据库中间件--ProxySQL+MGR
发表于:2024-11-16 作者:千家信息网编辑
千家信息网最后更新 2024年11月16日,[root@wallet01 ~]# mysql -uroot -p < addition_to_sys.sql Enter password:[root@wallet01 ~]# mysql -ur
千家信息网最后更新 2024年11月16日【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安全错误
数据库的锁怎样保障安全
化学物质欧洲数据库号码
工业控制网络安全论文
软件开发外包公司工资
计算机网络安全的看法
api的原油库存数据库
医疗行业网络安全建设方案下载
如东选择网络技术创新服务
从网页输入数据库查询
数据库公司排名2021
服务器上的向日葵怎么开
网络安全手抄报台词
云丁网络技术 招聘
网络安全及保密知识干货篇
网络安全全教育
云服务器哦
jdbc 多个数据库
幻塔哪个服务器福利多
企业云服务器异地登录
房山区网络技术开发售后服务
浪潮整机柜服务器sr
网络安全级别分为几个等级
我的世界服务器日志怎么找密码
服务器虚拟化唯独3金苹果
域名可以设置两个不同的服务器吗
王牌战争服务器维护是什么意思
严重违反国家网络安全守则
数据库连接池并发事务
数据库数据怎么保存才安全
计算机是大数据好还是网络安全好
数据库查询结果