[root@normal_11 opt]# mysql -uHH -p -h192.168.137.11 -P4006
Logging to file ‘/u01/mysql_history/query.log‘
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5524
Server version: 5.5.5-10.0.0 2.0.1-maxscale MariaDB Server
Copyright (c) 2009-2015 Percona LLC and/or its affiliates
Copyright (c) 2000, 2015, 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.
HH@192.168.137.11 11:13:46 [(none)]>SELECT * FROM test.t1;
+----+------+-----+
| id | name | age |
+----+------+-----+
| 1 | HH1 | 1 |
| 2 | HH2 | 2 |
| 3 | HH3 | 3 |
+----+------+-----+
3 rows in set (0.01 sec)
HH@192.168.137.11 11:15:03 [(none)]>INSERT INTO test.t1 VALUES(NULL, ‘HH4‘, 4);
Query OK, 1 row affected (0.01 sec)
# 使用 HH 登录成的日志
2016-11-03 23:13:46.907 info : (log_server_connections): Servers and router connection counts:
2016-11-03 23:13:46.907 info : (log_server_connections): current operations : 0 in 192.168.137.21:3306 RUNNING MASTER
2016-11-03 23:13:46.907 info : (log_server_connections): current operations : 0 in 192.168.137.22:3306 RUNNING SLAVE
2016-11-03 23:13:46.907 info : (log_server_connections): current operations : 0 in 192.168.137.23:3306 RUNNING SLAVE
2016-11-03 23:13:46.908 info : (select_connect_backend_servers): Selected RUNNING MASTER in 192.168.137.21:3306
2016-11-03 23:13:46.908 info : (select_connect_backend_servers): Selected RUNNING SLAVE in 192.168.137.22:3306
2016-11-03 23:13:46.908 info : (select_connect_backend_servers): Selected RUNNING SLAVE in 192.168.137.23:3306
2016-11-03 23:13:46.908 info : (session_alloc): Started Read-Write Service client session [0] for ‘HH‘ from 192.168.137.11
2016-11-03 23:13:46.909 [9] info : (route_single_stmt): > Autocommit: [enabled], trx is [not open], cmd: COM_QUERY, type: QUERY_TYPE_READ|QUERY_TYPE_SYSVAR_READ, stmt: select @@version_comment limit 1
2016-11-03 23:13:46.909 [9] info : (route_single_stmt): Route query to master 192.168.137.21:3306 <
2016-11-03 23:13:46.922 [9] info : (route_single_stmt): > Autocommit: [enabled], trx is [not open], cmd: COM_QUERY, type: QUERY_TYPE_READ, stmt: select USER()
2016-11-03 23:13:46.922 [9] info : (route_single_stmt): Route query to slave 192.168.137.22:3306 <
# 执行 SELECT * FROM test.t1 语句被路由到 192.168.137.22:3306[server2]中的日志
2016-11-03 23:15:02.618 [9] info : (route_single_stmt): > Autocommit: [enabled], trx is [not open], cmd: COM_QUERY, type: QUERY_TYPE_READ, stmt: SELECT * FROM test.t1
2016-11-03 23:15:02.618 [9] info : (route_single_stmt): Route query to slave 192.168.137.22:3306 <
# 执行 INSERT INTO test.t1 VALUES(NULL, ‘HH4‘, 4) 语句被路由到 192.168.137.21:3306[server1]中的日志
2016-11-03 23:17:02.716 [9] info : (route_single_stmt): > Autocommit: [enabled], trx is [not open], cmd: COM_QUERY, type: QUERY_TYPE_WRITE, stmt: INSERT INTO test.t1 VALUES(NULL, ‘HH4‘, 4)
2016-11-03 23:17:02.716 [9] info : (route_single_stmt): Route query to master 192.168.137.21:3306 <