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 (使用正则表达式实现基本的读/写分离) 在这一部分,我将通过一个示例来演示如何通过正则表达式来实现读/写分离. 首 ...
随机推荐
- JZ2440学习笔记之通过J-Link单步裸机程序(Keil+J-Link)
我们还是使用JZ2440学习笔记之第一个裸机程序(Keil-MDK)里面的程序,但是把延时拿掉,要不然单步的时候一直在delay里面: int main(void) { // Set GPF4/5/6 ...
- javap(反汇编命令)
用法: javap <options> <classes> 其中, 可能的选项包括: -help --help -? 输出此用法消息 -version ...
- 【洛谷P1886】滑动窗口
滑动窗口 [题目描述] 有N个数字,以及一个大小为k的窗口.现在这个窗口从左边开始向右滑动,每次滑动一个单位,求出每次滑动后窗口中的最大值和最小值. 思路: k<=N<=1000000,暴 ...
- FileUpload框架实现文件上传(多个文件)和下载
一.文件上传: 对于大文件执行下面的代码之间卡死 package com.example.web.service.servlet; import java.io.File; import java.i ...
- android(eclipse)广播机制知识梳理(三)
1:分类: 标准广播:没有先后顺序,无法被截断 有序广播:又先后顺序,可以截断 2:接收广播:首先进行注册,注册的方式有静态注册和动态注册.也就是在代码中注册和在AndroidManifest ...
- 18年selenium3+python3+unittest自动化测试教程(下)
第六章 自动化测试进阶实战篇幅 1.自动化测试实战进阶之网页单选性别资料实战 简介:讲解使用selenium修改input输入框和单选框 2.自动化测试之页面常见弹窗处理 简介:讲解使用seleniu ...
- 史上最简单的 SpringCloud 教程 | 第十四篇: 服务注册(consul)
转载请标明出处: 原文首发于:https://www.fangzhipeng.com/springcloud/2017/07/12/sc14-consul/ 本文出自方志朋的博客 这篇文章主要介绍 s ...
- Spring Boot应用的测试——Mockito
Spring Boot应用的测试——Mockito Spring Boot可以和大部分流行的测试框架协同工作:通过Spring JUnit创建单元测试:生成测试数据初始化数据库用于测试:Spring ...
- (五)、python 函数
一.函数 def 函数名(参数): ... 函数体 ... 返回值 函数的定义主要有如下要点: def:表示函数的关键字 函数名:函数的名称,日后根据函数名调用函数 函数体:函数中进行一系列的逻辑计算 ...
- 利用nginx使ftp可以通过http访问
./nginx 启动服务./nginx -s stop 关闭服务./nginx -s reload 重新加载配置文件 搭建nginx映射ftp服务:打开nginx的配置文件nginx.conf(位于n ...