使用amoeba實(shí)現(xiàn)mysql讀寫(xiě)分離amoeba是一個(gè)以MySQL為底層數(shù)據(jù)存儲(chǔ),并對(duì)應(yīng)用提供MySQL協(xié)議接口的proxy。它集中地響應(yīng)應(yīng)用的請(qǐng)求,依據(jù)用戶事先設(shè)置的規(guī)則,將SQL
保存退出,使amodeba調(diào)用池,因此還需編輯amoeaba.xml
進(jìn)入數(shù)據(jù)庫(kù)執(zhí)行select語(yǔ)句并再次抓包查看
mysql> select * from tb1;
+------+
| NAME |
+------+
| test |
| tom |
+------+
2 rows in set (0.01 sec)
可看到主庫(kù)沒(méi)有回顯任何信息,在從庫(kù)顯示抓包信息如下:
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
以上,讀寫(xiě)分離配置大致完成,,感謝各位
本文出自 “心情依舊” 博客,轉(zhuǎn)載請(qǐng)與作者聯(lián)系!
聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com