MySQL读写分离(四)

2014-11-24 08:14:01 · 作者: · 浏览: 17
id is 8 Server version: 5.5.29-log Source distribution Copyright (c) 2000, 2012, 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. mysql> exit Bye

第八步,查看现象

[root@serv01 ~]# /etc/init.d/mysql-proxy start
Starting mysql-proxy: 
[root@serv01 ~]# mysql -ularry -plarry -h 192.168.1.11

[connect_server] 192.168.1.11:51054
  [1].connected_clients = 0
  [1].pool.cur_idle     = 0
  [1].pool.max_idle     = 1
  [1].pool.min_idle     = 1
  [1].type = 1
  [1].state = 0
  [1] idle-conns below min-idle
Welcome to the MySQL monitor.  Commands end with ; or \g.
[read_query] 192.168.1.11:51054
  current backend   = 0
  client default db = 
  client username   = larry
  query             = select @@version_comment limit 1
  sending to backend : 192.168.1.19:3306
    is_slave         : false
    server default db: 
    server username  : larry
    in_trans        : false
    in_calc_found   : false
    COM_QUERY       : true
Your MySQL connection id is 10
Server version: 5.5.29-log Source distribution

Copyright (c) 2000, 2012, 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.

mysql> 

mysql> use larrydb;
[read_query] 192.168.1.11:51054
  current backend   = 0
  client default db = 
  client username   = larry
  query             = SELECT DATABASE()
  sending to backend : 192.168.1.19:3306
    is_slave         : false
    server default db: 
    server username  : larry
    in_trans        : false
    in_calc_found   : false
    COM_QUERY       : true
[read_query] 192.168.1.11:51054
  current backend   = 0
  client default db = 
  client username   = larry
  sending to backend : 192.168.1.19:3306
    is_slave         : false
    server default db: 
    server username  : larry
    in_trans        : false
    in_calc_found   : false
    COM_QUERY       : false
Database changed
mysql>
select * from user; [read_query] 192.168.1.11:51054 current backend = 0 client default db = larrydb client username = larry query = select * from user sending to backend : 192.168.1.19:3306 is_slave : false server default db: larrydb server username : larry in_trans : false in_calc_found : false COM_QUERY : true +------+----------+ | id | name | +------+----------+ | 1 | larrywen | | 2 | wentasy | +------+----------+ 2 rows in set (0.00 sec) mysql> insert into user values(3,'jsutdb'); [read_query] 192.168.1.11:51644 current backend = 0 client default db = larrydb client username = larry query = insert into user values(3,'jsutdb') sending to backend : 192.168.1.19:3306 is_slave : false server default db: larrydb server username : larry in_trans : false in_calc_found : false COM_QUERY : true Query OK, 1 row affected (0.00 sec) serv08 mysql> select * from user; +------+----------+ | id | name | +------+----------+ | 1 | larrywen | | 2 | wentasy | +------+----------+ 2 rows in set (0.00 sec) serv09 mysql> select * from larrydb.user; +------+----------+ | id | name | +------+----------+ | 1 | larrywen | | 2 | wentasy | | 3 | jsutdb | +------+----------+ 3 rows in set (0.00 sec)

第九步,以上的测试虽有效果,但不是预期。排查原因,重新配置。发现proxy-read-