If the database access volume is large and the pressure on the database is reduced, he will find one database if there is a read operation. If he writes the database, he will go back and find the other two to avoid mutual interference, let's take a look at how it works!
Proxy Host read/write splitting)
Proxy
|
|
Vswitch
|
|
Mysql AB mysql
------------------------------------------
113
Create a proxydb Database
Create Table
Insert 113 content
Authorize [root @ xu/] # grant all on *. * to xcy @ "%" identified by "123"
-------------------------------------
116
Create a proxydb Database
Create Table
Insert 116 content
Authorize [root @ xu/] # grant all on *. * to xcy @ "%" identified by "123"
--------------------------------------
Host
First release the port
Turn mysql off
Install the ula package
[Root @ xu/] # tar-zxvf mysql-proxy-0.8.0-linux-rhel5-x86-32bit.tar.g-C/usr/local/green software
Name
Music mysql-proxy-0.8.0-linux-rhel5-x86-32bit proxy
Read/write splitting script
Cd/share/doc/rw-splitting.lua
Start script
/Bin/muysql-proxy
Add read/write permissions
Chomod + x rw-splitting.lua
Set read/write splitting
[Root @ xu/] #. /mysql-proxy-p 192.168.1.2: 3306-r 192.168.1.113: 3306-B 192.168.1.116: 3306-s/usr/local/proxy/share/doc/mysql-proxy/rw-splitting.lua &
View
Ulimit-l
Turn Off
Kill-9% 1
Number of opened debugging files
Ulimit-n 10240
-----------
Multiple open Terminals
Select * from proxydb;
Show written
Up to 5th will become read servers
This article is from the "history_xcy" blog, please be sure to keep this http://historys.blog.51cto.com/7903899/1296704