欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

使用amoeba实现mysql读写分离

程序员文章站 2022-05-25 18:06:39
...

使用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

以上,读写分离配置大致完成,,感谢各位

本文出自 “心情依旧” 博客,转载请与作者联系!