ProxySQL读写分离测试(续)
[root@zlm1 :: /var/lib]
#service proxysql start
Starting ProxySQL: ProxySQL is already running. [root@zlm1 :: /var/lib]
#ps aux|grep proxysql
root 0.0 0.5 ? S : : proxysql -c /etc/proxysql.cnf -D /var/lib/proxysql
root 0.0 2.0 ? Sl : : proxysql -c /etc/proxysql.cnf -D /var/lib/proxysql
root 0.0 0.0 pts/ R+ : : grep --color=auto proxysql
[root@zlm1 :: ~]
#mysql -uadmin -padmin -h127.0.0. -P6032
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.5. (ProxySQL Admin Module) Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. admin@127.0.0.1: [(none)]>select * from mysql_replication_hostgroups;
Empty set (0.00 sec) admin@127.0.0.1: [(none)]>insert into mysql_replication_hostgroups(writer_hostgroup,reader_hostgroup) values(,);
Query OK, row affected (0.00 sec) admin@127.0.0.1: [(none)]>select * from mysql_replication_hostgroups;
+------------------+------------------+---------+
| writer_hostgroup | reader_hostgroup | comment |
+------------------+------------------+---------+
| | | |
+------------------+------------------+---------+
row in set (0.00 sec) admin@127.0.0.1: [(none)]>select * from runtime_mysql_replication_hostgroups;
Empty set (0.00 sec) admin@127.0.0.1: [(none)]>select * from disk.mysql_replication_hostgroups;
Empty set (0.00 sec) admin@127.0.0.1: [(none)]>load mysql servers to runtime;save mysql servers to disk;
Query OK, rows affected (0.00 sec) admin@127.0.0.1: [(none)]>select * from runtime_mysql_replication_hostgroups;
+------------------+------------------+---------+
| writer_hostgroup | reader_hostgroup | comment |
+------------------+------------------+---------+
| | | |
+------------------+------------------+---------+
row in set (0.00 sec) admin@127.0.0.1: [(none)]>select * from disk.mysql_replication_hostgroups;
+------------------+------------------+---------+
| writer_hostgroup | reader_hostgroup | comment |
+------------------+------------------+---------+
| | | |
+------------------+------------------+---------+
row in set (0.00 sec)
admin@127.0.0.1: [(none)]>select * from mysql_servers;
Empty set (0.00 sec) admin@127.0.0.1: [(none)]>insert into mysql_servers(hostgroup_id,hostname,max_connections,max_replication_lag) values(,'192.168.56.100',,);
Query OK, row affected (0.00 sec) admin@127.0.0.1: [(none)]>insert into mysql_servers(hostgroup_id,hostname,max_connections,max_replication_lag) values(,'192.168.56.101',,);
Query OK, row affected (0.00 sec) admin@127.0.0.1: [(none)]>select * from mysql_servers;
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname | port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| | 192.168.56.100 | | ONLINE | | | | | | | |
| | 192.168.56.101 | | ONLINE | | | | | | | |
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
rows in set (0.00 sec) admin@127.0.0.1: [(none)]>select * from runtime_mysql_servers;
Empty set (0.00 sec) admin@127.0.0.1: [(none)]>select * from disk.mysql_servers;
Empty set (0.00 sec) admin@127.0.0.1: [(none)]>load mysql servers to runtime;save mysql servers to disk;
Query OK, rows affected (0.00 sec) Query OK, rows affected (0.05 sec) admin@127.0.0.1: [(none)]>select * from runtime_mysql_servers;
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname | port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| | 192.168.56.101 | | ONLINE | | | | | | | |
| | 192.168.56.100 | | ONLINE | | | | | | | |
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
rows in set (0.00 sec) //Why does the hostgroup_id in table "runtime_mysql_servers" still "20"? admin@127.0.0.1: [(none)]>select * from disk.mysql_servers;
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname | port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| | 192.168.56.100 | | ONLINE | | | | | | | |
| | 192.168.56.101 | | ONLINE | | | | | | | |
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
rows in set (0.00 sec) //The hostgroup_id in table "disk.mysql_servers" has taken effect. //Check the variables of "read_only" and "super_read_only".
zlm@192.168.56.100: [(none)]>show variables like '%read_only%';
+-----------------------+-------+
| Variable_name | Value |
+-----------------------+-------+
| innodb_read_only | OFF |
| read_only | OFF |
| super_read_only | OFF |
| transaction_read_only | OFF |
| tx_read_only | OFF |
+-----------------------+-------+
rows in set (0.00 sec) admin@127.0.0.1: [(none)]>load mysql servers to runtime;
Query OK, rows affected (0.00 sec) admin@127.0.0.1: [(none)]>select * from runtime_mysql_servers;
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname | port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| | 192.168.56.101 | | ONLINE | | | | | | | |
| | 192.168.56.100 | | ONLINE | | | | | | | |
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
rows in set (0.00 sec) //It's still "20". admin@127.0.0.1: [(none)]>select * from mysql_servers;
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname | port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| | 192.168.56.100 | | ONLINE | | | | | | | |
| | 192.168.56.101 | | ONLINE | | | | | | | |
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
rows in set (0.00 sec) //The "hostgroup_id" in mysql_serves also turned to be "20".Why does it happen?It's the reason why my query rule did not take effect yesterday. admin@127.0.0.1: [(none)]>SELECT * FROM monitor.mysql_server_connect_log ORDER BY time_start_us DESC LIMIT ;
+----------------+------+------------------+-------------------------+---------------------------------------------------------------+
| hostname | port | time_start_us | connect_success_time_us | connect_error |
+----------------+------+------------------+-------------------------+---------------------------------------------------------------+
| 192.168.56.100 | | | | Access denied for user 'monitor'@'zlm1' (using password: YES) |
| 192.168.56.101 | | | | Access denied for user 'monitor'@'zlm1' (using password: YES) |
| 192.168.56.101 | | | | Access denied for user 'monitor'@'zlm1' (using password: YES) |
| 192.168.56.100 | | | | Access denied for user 'monitor'@'zlm1' (using password: YES) |
| 192.168.56.101 | | | | Access denied for user 'monitor'@'zlm1' (using password: YES) |
| 192.168.56.100 | | | | Access denied for user 'monitor'@'zlm1' (using password: YES) |
| 192.168.56.100 | | | | Access denied for user 'monitor'@'zlm1' (using password: YES) |
| 192.168.56.101 | | | | Access denied for user 'monitor'@'zlm1' (using password: YES) |
| 192.168.56.100 | | | | Access denied for user 'monitor'@'zlm1' (using password: YES) |
| 192.168.56.101 | | | | Access denied for user 'monitor'@'zlm1' (using password: YES) |
+----------------+------+------------------+-------------------------+---------------------------------------------------------------+
rows in set (0.00 sec) //It seems the privileges was configurated abnormally. zlm@192.168.56.100: [(none)]>select user,host from mysql.user;
+---------------+--------------+
| user | host |
+---------------+--------------+
| repl | 192.168..% |
| zlm | 192.168..% |
| bkuser | localhost |
| monitor | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+---------------+--------------+
rows in set (0.00 sec) zlm@192.168.56.100: [(none)]>drop user monitor@localhost;
Query OK, rows affected (0.00 sec) zlm@192.168.56.100: [(none)]>grant all privileges on *.* to monitor@'%' identified by 'monitor';
ERROR (): Access denied for user 'zlm'@'192.168.56.%' (using password: YES)
zlm@192.168.56.100: [(none)]>exit
Bye [root@zlm1 :: /data/backup]
#mysql -uroot -pPassw0rd -hlocalhost -S /tmp/mysql3306.sock
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.7.-log MySQL Community Server (GPL) Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. root@localhost:mysql3306.sock [(none)]>grant all privileges on *.* to monitor@'%' identified by 'monitor';
Query OK, rows affected, warning (0.00 sec) root@localhost:mysql3306.sock [(none)]>select user,host from mysql.user;
+---------------+--------------+
| user | host |
+---------------+--------------+
| monitor | % |
| repl | 192.168..% |
| zlm | 192.168..% |
| bkuser | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+---------------+--------------+
rows in set (0.00 sec) admin@127.0.0.1: [(none)]>SELECT * FROM monitor.mysql_server_connect_log ORDER BY time_start_us DESC LIMIT ;
+----------------+------+------------------+-------------------------+---------------------------------------------------------------+
| hostname | port | time_start_us | connect_success_time_us | connect_error |
+----------------+------+------------------+-------------------------+---------------------------------------------------------------+
| 192.168.56.101 | | | | NULL |
| 192.168.56.100 | | | | NULL |
| 192.168.56.100 | | | | NULL |
| 192.168.56.101 | | | | NULL |
| 192.168.56.100 | | | | Access denied for user 'monitor'@'zlm1' (using password: YES) |
| 192.168.56.101 | | | | Access denied for user 'monitor'@'zlm1' (using password: YES) |
| 192.168.56.101 | | | | Access denied for user 'monitor'@'zlm1' (using password: YES) |
| 192.168.56.100 | | | | Access denied for user 'monitor'@'zlm1' (using password: YES) |
| 192.168.56.101 | | | | Access denied for user 'monitor'@'zlm1' (using password: YES) |
| 192.168.56.100 | | | | Access denied for user 'monitor'@'zlm1' (using password: YES) |
+----------------+------+------------------+-------------------------+---------------------------------------------------------------+
rows in set (0.00 sec) //The monitor became normal. admin@127.0.0.1: [(none)]>select * from mysql_servers;
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname | port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| | 192.168.56.100 | | ONLINE | | | | | | | |
| | 192.168.56.100 | | ONLINE | | | | | | | |
| | 192.168.56.101 | | ONLINE | | | | | | | |
| | 192.168.56.101 | | ONLINE | | | | | | | |
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
rows in set (0.00 sec) admin@127.0.0.1: [(none)]>delete from mysql_servers;
Query OK, rows affected (0.00 sec) admin@127.0.0.1: [(none)]>insert into mysql_servers(hostgroup_id,hostname,max_connections,max_replication_lag) values(,'192.168.56.100',,),(,'192.168.56.101',,);
Query OK, rows affected (0.00 sec) admin@127.0.0.1: [(none)]>select * from mysql_servers;
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname | port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| | 192.168.56.100 | | ONLINE | | | | | | | |
| | 192.168.56.101 | | ONLINE | | | | | | | |
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
rows in set (0.00 sec) admin@127.0.0.1: [(none)]>load mysql servers to runtime;save mysql servers to disk;
Query OK, rows affected (0.00 sec) Query OK, rows affected (0.02 sec) admin@127.0.0.1: [(none)]>select * from mysql_servers;
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname | port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| | 192.168.56.100 | | ONLINE | | | | | | | |
| | 192.168.56.101 | | ONLINE | | | | | | | |
| | 192.168.56.101 | | ONLINE | | | | | | | |
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
rows in set (0.00 sec) //Why there're three records in table "mysql_servers"? admin@127.0.0.1: [(none)]>select * from runtime_mysql_servers;
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname | port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| | 192.168.56.100 | | ONLINE | | | | | | | |
| | 192.168.56.101 | | ONLINE | | | | | | | |
| | 192.168.56.101 | | ONLINE | | | | | | | |
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
rows in set (0.00 sec) admin@127.0.0.1: [(none)]>select * from disk.mysql_servers;
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname | port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| | 192.168.56.100 | | ONLINE | | | | | | | |
| | 192.168.56.101 | | ONLINE | | | | | | | |
+--------------+----------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
rows in set (0.00 sec) admin@127.0.0.1: [(none)]>show variables like '%also%';
+-------------------------------------+-------+
| Variable_name | Value |
+-------------------------------------+-------+
| mysql-monitor_writer_is_also_reader | true |
+-------------------------------------+-------+
row in set (0.00 sec) admin@127.0.0.1: [(none)]>SELECT * FROM monitor.mysql_server_connect_log ORDER BY time_start_us DESC LIMIT ;
+----------------+------+------------------+-------------------------+---------------+
| hostname | port | time_start_us | connect_success_time_us | connect_error |
+----------------+------+------------------+-------------------------+---------------+
| 192.168.56.100 | | | | NULL |
| 192.168.56.101 | | | | NULL |
| 192.168.56.101 | | | | NULL |
| 192.168.56.100 | | | | NULL |
| 192.168.56.101 | | | | NULL |
| 192.168.56.100 | | | | NULL |
| 192.168.56.100 | | | | NULL |
| 192.168.56.101 | | | | NULL |
| 192.168.56.101 | | | | NULL |
| 192.168.56.100 | | | | NULL |
+----------------+------+------------------+-------------------------+---------------+
rows in set (0.00 sec)
admin@127.0.0.1: [(none)]>select * from mysql_users;
Empty set (0.00 sec) admin@127.0.0.1: [(none)]>insert into mysql_users(username,password,active,default_hostgroup,default_schema) values('zlm','zlmzlm',,,'zlm');
Query OK, row affected (0.00 sec) admin@127.0.0.1: [(none)]>select * from mysql_users;
+----------+----------+--------+---------+-------------------+----------------+---------------+------------------------+--------------+---------+----------+-----------------+
| username | password | active | use_ssl | default_hostgroup | default_schema | schema_locked | transaction_persistent | fast_forward | backend | frontend | max_connections |
+----------+----------+--------+---------+-------------------+----------------+---------------+------------------------+--------------+---------+----------+-----------------+
| zlm | zlmzlm | | | | zlm | | | | | | |
+----------+----------+--------+---------+-------------------+----------------+---------------+------------------------+--------------+---------+----------+-----------------+
row in set (0.00 sec) admin@127.0.0.1: [(none)]>select * from runtime_mysql_users;
Empty set (0.00 sec) admin@127.0.0.1: [(none)]>select * from disk.mysql_users;
Empty set (0.00 sec) admin@127.0.0.1: [(none)]>load mysql users to runtime;save mysql users to disk;
Query OK, rows affected (0.00 sec) Query OK, rows affected (0.01 sec) admin@127.0.0.1: [(none)]>select * from runtime_mysql_users;
+----------+-------------------------------------------+--------+---------+-------------------+----------------+---------------+------------------------+--------------+---------+----------+-----------------+
| username | password | active | use_ssl | default_hostgroup | default_schema | schema_locked | transaction_persistent | fast_forward | backend | frontend | max_connections |
+----------+-------------------------------------------+--------+---------+-------------------+----------------+---------------+------------------------+--------------+---------+----------+-----------------+
| zlm | *512FB3FAA6F522E351929CAC70AD8EBB0F5901B6 | | | | zlm | | | | | | |
| zlm | *512FB3FAA6F522E351929CAC70AD8EBB0F5901B6 | | | | zlm | | | | | | |
+----------+-------------------------------------------+--------+---------+-------------------+----------------+---------------+------------------------+--------------+---------+----------+-----------------+
rows in set (0.00 sec) admin@127.0.0.1: [(none)]>select * from disk.mysql_users;
+----------+----------+--------+---------+-------------------+----------------+---------------+------------------------+--------------+---------+----------+-----------------+
| username | password | active | use_ssl | default_hostgroup | default_schema | schema_locked | transaction_persistent | fast_forward | backend | frontend | max_connections |
+----------+----------+--------+---------+-------------------+----------------+---------------+------------------------+--------------+---------+----------+-----------------+
| zlm | zlmzlm | | | | zlm | | | | | | |
+----------+----------+--------+---------+-------------------+----------------+---------------+------------------------+--------------+---------+----------+-----------------+
row in set (0.00 sec)
admin@127.0.0.1: [(none)]>select * from mysql_query_rules;
Empty set (0.00 sec) admin@127.0.0.1: [(none)]>insert into mysql_query_rules(active,username,match_pattern,schemaname,destination_hostgroup,apply) values(,'zlm','^select','zlm',,);
Query OK, row affected (0.00 sec) admin@127.0.0.1: [(none)]>select active,username,match_pattern,schemaname,destination_hostgroup,apply from mysql_query_rules;
+--------+----------+---------------+------------+-----------------------+-------+
| active | username | match_pattern | schemaname | destination_hostgroup | apply |
+--------+----------+---------------+------------+-----------------------+-------+
| | zlm | ^select | zlm | | |
+--------+----------+---------------+------------+-----------------------+-------+
row in set (0.00 sec) admin@127.0.0.1: [(none)]>select * from runtime_mysql_query_rules;
Empty set (0.00 sec) admin@127.0.0.1: [(none)]>select * from disk.mysql_query_rules;
Empty set (0.00 sec) admin@127.0.0.1: [(none)]>load mysql query rules to runtime;save mysql query rules to disk;
Query OK, rows affected (0.00 sec) admin@127.0.0.1: [(none)]>select active,username,match_pattern,schemaname,destination_hostgroup,apply from runtime_mysql_query_rules;
+--------+----------+---------------+------------+-----------------------+-------+
| active | username | match_pattern | schemaname | destination_hostgroup | apply |
+--------+----------+---------------+------------+-----------------------+-------+
| | zlm | ^select | zlm | | |
+--------+----------+---------------+------------+-----------------------+-------+
row in set (0.00 sec) admin@127.0.0.1: [(none)]>select active,username,match_pattern,schemaname,destination_hostgroup,apply from disk.mysql_query_rules;
+--------+----------+---------------+------------+-----------------------+-------+
| active | username | match_pattern | schemaname | destination_hostgroup | apply |
+--------+----------+---------------+------------+-----------------------+-------+
| | zlm | ^select | zlm | | |
+--------+----------+---------------+------------+-----------------------+-------+
row in set (0.00 sec)
admin@127.0.0.1: [(none)]>show create table stats.stats_mysql_query_digest\G
*************************** . row ***************************
table: stats_mysql_query_digest
Create Table: CREATE TABLE stats_mysql_query_digest (
hostgroup INT,
schemaname VARCHAR NOT NULL,
username VARCHAR NOT NULL,
digest VARCHAR NOT NULL,
digest_text VARCHAR NOT NULL,
count_star INTEGER NOT NULL,
first_seen INTEGER NOT NULL,
last_seen INTEGER NOT NULL,
sum_time INTEGER NOT NULL,
min_time INTEGER NOT NULL,
max_time INTEGER NOT NULL,
PRIMARY KEY(hostgroup, schemaname, username, digest))
row in set (0.00 sec) admin@127.0.0.1: [(none)]>select hostgroup,schemaname,username,substr(digest_text,,-),count_star from stats_mysql_query_digest_reset;
Empty set (0.00 sec) [root@zlm1 :: /data/backup]
#mysql -uzlm -pzlmzlm -h192.168.56. -P6033
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.5. (ProxySQL) Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. zlm@192.168.56.100: [(none)]>show tables;
+---------------+
| Tables_in_zlm |
+---------------+
| test |
+---------------+
row in set (0.00 sec) zlm@192.168.56.100: [(none)]>select * from test;
+------+------+
| id | name |
+------+------+
| | aaa |
| | bbb |
| | ccc |
+------+------+
rows in set (0.00 sec) zlm@192.168.56.100: [(none)]>insert into test values(,'eee');
Query OK, row affected (0.00 sec) zlm@192.168.56.100: [(none)]>update test set name='ddd' where id=;
Query OK, row affected (0.00 sec)
Rows matched: Changed: Warnings: zlm@192.168.56.100: [(none)]>select * from test;
+------+------+
| id | name |
+------+------+
| | aaa |
| | bbb |
| | ccc |
| | ddd |
+------+------+
rows in set (0.00 sec) admin@127.0.0.1: [(none)]>select hostgroup,schemaname,username,substr(digest_text,,-),count_star from stats_mysql_query_digest;
+-----------+------------+----------+-----------------------------------+------------+
| hostgroup | schemaname | username | substr(digest_text,,-) | count_star |
+-----------+------------+----------+-----------------------------------+------------+
| | zlm | zlm | update test set name=? where id=? | |
| | zlm | zlm | select * from test | |
| | zlm | zlm | show tables | |
| | zlm | zlm | select USER() | |
| | zlm | zlm | insert into test values(?,?) | |
| | zlm | zlm | select @@version_comment limit ? | |
+-----------+------------+----------+-----------------------------------+------------+
rows in set (0.00 sec) //What baffled me is that why the "select USER()" and "select @@version_comment limit ?" were not in the hostgroup "20"? zlm@192.168.56.100: [(none)]>select @@hostname;
+------------+
| @@hostname |
+------------+
| zlm2 |
+------------+
row in set (0.00 sec) //The select operation has been executed on slave zlm2. admin@127.0.0.1: [(none)]>select hostgroup,schemaname,username,substr(digest_text,,-),count_star from stats_mysql_query_digest;
+-----------+------------+----------+-----------------------------------+------------+
| hostgroup | schemaname | username | substr(digest_text,,-) | count_star |
+-----------+------------+----------+-----------------------------------+------------+
| | zlm | zlm | update test set name=? where id=? | |
| | zlm | zlm | select * from test | |
| | zlm | zlm | show tables | |
| | zlm | zlm | select USER() | |
| | zlm | zlm | select @@hostname | |
| | zlm | zlm | insert into test values(?,?) | |
| | zlm | zlm | select @@version_comment limit ? | |
+-----------+------------+----------+-----------------------------------+------------+
rows in set (0.00 sec) //The new statement of "select @@hostname" was put into hostgroup "20" correctly.
ProxySQL读写分离测试(续)的更多相关文章
- MySQL ProxySQL读写分离实践
目的 在上一篇文章MySQL ProxySQL读写分离使用初探里初步介绍了ProxySQL的使用,本文继续介绍它的一些特点和DBProxy的性能差异.深入一些去了解ProxySQL,通过测试来说明Pr ...
- ProxySQL读写分离
我们首先看一下自己的环境: MHA已经搭建: master: slave: slave: MHA manager在172.16.16.34,配置文件如下: [root@localhost bin]# ...
- mysqlfailover高可用与proxysql读写分离配置
proxysql官方推荐两种高可用方案: 1.MHA+proxysql 2.mysqlrpladmin+proxysql MySQLfailover工具包含在mysqlrpladmin工具中,所以两者 ...
- MHA+ProxySQL 读写分离高可用
文档结构如下: 1.ProxySQL说明 ProxySQL是mysql的一款中间件的产品,是灵活的mysql代理层,可以实现读写分离,支持query路由器的功能,支持动态指定sql进行缓存,支持动态加 ...
- MySQL ProxySQL读写分离使用初探
目的 在美团点评DBProxy读写分离使用说明文章中已经说明了使用目的,本文介绍ProxySQL的使用方法以及和DBProxy的性能差异.具体的介绍可以看官网的相关说明,并且这个中间件也是percon ...
- ProxySQL 读写分离实践
前言 ProxySQL是一个高性能的MySQL中间件,拥有强大的规则引擎.具有以下特性: 连接池,而且是 multiplexing 主机和用户的最大连接数限制 自动下线后端DB 延迟超过阀值 ping ...
- Proxysql读写分离配置
ProxySQL是Percona主推的读写分离中间件,下载地址为: https://www.percona.com/downloads/proxysql/ 一.安装 1:下载 wget https:/ ...
- ProxySQL读写分离代理
实现ProxySQL反向代理Mysql读写分离 简介 ProxySQL相当于小型的数据库,在磁盘上有存放数据库的目录:ProxySQL用法和mysql相似 启动ProxySQL后会有两个监听端口: 6 ...
- ProxySQL 读写分离方法
转载自:https://www.jianshu.com/p/597b840bf70c (使用正则表达式实现基本的读/写分离) 在这一部分,我将通过一个示例来演示如何通过正则表达式来实现读/写分离. 首 ...
随机推荐
- build.gradle中的dependencies
demo_myna中的build.gradle中的dependencies是依赖项目.比如之前开发的一个项目A,现在新的项目B要使用项目A的功能,那么把项目A作为类库关联进来,这样b就能直接使用A的功 ...
- 去掉谷歌浏览器 video标签下的下载按钮
一.判断浏览器版本(区分谷歌和360浏览器) function myBrowser(){ var userAgent = navigator.userAgent; //取得浏览器的userAgent字 ...
- 【转】Spring boot 打成jar包问题总结
http://www.cnblogs.com/xingzc/p/5972488.html 1.Unable to find a single main class from the following ...
- 【luogu P3979 遥远的国度】 题解
题目链接:https://www.luogu.org/problemnew/show/P3979 除了换根操作都是裸的树剖 所以换根时考虑: 1.我查询的根等于换的根:无影响 2.我查询的根是换的根的 ...
- AngularJS 二 指令介绍
初始化AngularJS框架 ng-app指令: 在NG-程序指令是AngularJS应用程序的起点.它自动初始化AngularJS框架.AngularJS框架将在加载整个文档之后首先检查HTML文档 ...
- 课时92.CSS元素显示模式转换(掌握)
我们之前学习的显示模式都可以不用记忆,因为这节课我们要学习转换,我们可以任意来进行一个转换的,上面这些东西有一个了解就行了.所有的标签都有一个属性叫做display,display的中文含义就是显示的 ...
- 关于math.random()的问题
今天在写一个关于随机数的小程序时,在程序执行时,发现随机数不能执行随机,随机结果始终为1. 下面贴上一开始错误的代码 int i = (int)Math.random()*3+1; 无论运行多少次,结 ...
- Struts2知识点小结(二)
一.结果视图的配置 <result name="success">/success.jsp</result> 1.局部结果视图 ...
- CF294C Shaass and Lights(排列组合)
题目描述 There are n n n lights aligned in a row. These lights are numbered 1 1 1 to n n n from left to ...
- 如何用hexo搭建个人博客. 亲测有效
搭建博客: 安装node.js和git 以管理员身份进入cmd. 输入: npm install -g cnpm --registry=https://registry.npm.taobao.org ...