使用amoeba实现mysql读写分离amoeba是一个以mysql为底层数据存储,并对应用提供mysql协议接口的proxy。它集中地响应应用的请求,依据用户事先设置的规则,将sql
保存退出,使amodeba调用池,因此还需编辑amoeaba.xml
node1
readpool
进入数据库执行select语句并再次抓包查看
mysql> select * from tb1;
+------+
| name |
+------+
| test |
| tom |
+------+
2 rows in set (0.01 sec)
可看到主库没有回显任何信息,在从库显示抓包信息如下:
14:53:10.169782 ip 10.12.33.59.34299 >10.12.33.57.3306: flags [p.], seq 473:495, ack 3700, win 455, options[nop,nop,ts val 523743485 ecr 361824589], length 22
e..j..@.@.(/
.!;
.!9....q,.{b/.......w.....
.7.....m.....select * from tb1
14:53:10.171609 ip 10.12.33.57.55409 >10.12.33.59.3306: flags [p.], seq 77:99, ack 235, win 115, options [nop,nop,tsval 361830482 ecr 523737591], length 22
e..jz.@.@..u
.!9
.!;.q....+[.yw....s.......
...r.7.......select * from tb1
14:53:10.172382 ip 10.12.33.57.55409 >10.12.33.59.3306: flags [.], ack 320, win 115, options [nop,nop,ts val 361830483ecr 523743487], length 0
e..4z.@.@...
.!9
.!;.q....+q.yx=...sf?.....
...s.7..
14:53:10.174525 ip 10.12.33.59.34299 >10.12.33.57.3306: flags [.], ack 3785, win 455, options [nop,nop,ts val523743490 ecr 361830485], length 0
e..4..@.@.(d
.!;
.!9....q,..b/.r....f&.....
.7.....u
以上,读写分离配置大致完成,,感谢各位
本文出自 “心情依旧” 博客,转载请与作者联系!