Amoeba-mysql Read and write separate combat
Amoeba use a lot, here to see the title we first say read and write separation, because I will only this. Amoeba is defined as domestic, open source. Currently (October 20, 2015) We use the amoeba2.2 version to do.
First talk about my environment:
Keepalived don't say that first.
Mysql 5.6
Centos 6.4
MySQL one master two from is OK.
Amoeba 2.2.x
Master and slave I will not talk about, online n more information.
amoeba:http://sourceforge.net/projects/amoeba/files/amoeba%20for%20mysql/
Since amoeba needs to use jave SE, we need to install the JDK environment.
The latest 1.8 is available.
To install the JDK:
RPM-IVH jdk-8u60-linux-x64.rpm
Source/etc/profile
To verify the JDK:
The JDK is done, and now the amoeba installation begins.
Create a catalog file first
Mkdir/usr/local/amoeba
Copy the download file to the directory you just created and unzip it.
Then we go into the Conf file, where the XML for the storage amoeba set the data to connect to MySQL
Under the Amoeba directory, enter
./bin/amoeba
If it appears
Description Amoeba Install OK,
Next set the parameters of the amoeba, set the parameters of the file in the Conf directory under Amoeba.xml and dbservers.xml two files.
See Dbserviers.xml first.
Grant all on * * to [e-mail protected] ' 192.168.0.191 ' identified by "123456"; This command needs to be run on the client, so that the amoeba scheduler can connect to our database and do the operation
This dbservers.xml is set up here.
Next look at Amoeba.xml.
Save after configuration is complete.
Then enable Amoeba
/usr/local/amoeba/bin/amoeba & & means running in the background
Use Ps–ef |grep amoeba to see if it starts.
Verify that the Windows client is able to log on amoeba;
This means that the login was successful.
The next step is to verify read and write separation
Before you stop the master, create a table named CREATE Database jdtable.
Then enter the library use jdtable;
Create a table dashen (id int (), name varchar (), address varchar (20));
Then look at whether to sync from the top.
After synchronization, turn off the master stop slave;
Start validation.
We insert a statement on the first one from the top, which is 187:
INSERT into Dashen values (' 1 ', ' syw ', ' slave-187 ');
On the other one also inserts a statement:
INSERT into Dashen values (' 2 ', ' syw ', ' slave-188 '); Although the IP is 190
And then we amoeba this scheduler with Windows login
Use SELECT * from Jdtable.dashen; to query, look at the amoeba will be called before amoeba.xml this inside the Slavepool this module loop, also can be said to be load balanced. Slave1 query once, slave2 query two times.
When inserting a piece of data on amoeba, amoeba will also write to the corresponding database according to the module written in Amoeba.xml.
Test finished!
Amoeba-mysql Read and write separate combat