Experimental Operating Environment: centos server three machines
role: 192.168.189.129 master-主
From 192.168.189.130 master-
192.168.189.131 Amoeba
1, the primary structures:
https://www.cnblogs.com/security-guard/
2, on both Amoeba MySQL server to a server authorized users can read and write
Note: The two MySQL servers must be licensed, otherwise it will lead to Amoeba not being given permission to read and write in the mysql
grant all on *.* to 'amoeba'@'%' identified by '123'; flush privileges;
3, is mounted on a third Amoeba Amoeba server
1) install jdk environment
cd / usr / local chmod + the X-jdk-6u14-linux- x64.bin . / jdk-6u14-linux- x64.bin change jdk installation directory name easy to use mv jdk1. 6 .0_14 jdk1. 6
2) configuration environment variable
Configuration environment variable vim / etc / profile add the following to the end of the file Export AMOEBA = / usr / local / Amoeba Export JAVA_HOME = / usr / local / jdk1.6 Export the PATH = $ the PATH: $ JAVA_HOME / bin: $ AMOEBA / bin so add new variables into force source / etc / profile
3) uploaded to the server installation package Amoeba
4) Create the installation directory for Amoeba
#mkdir /usr/local/amoeba #tar zxf amoeba-mysql-binary-2.2.0.tar.gz -C /usr/local/amoeba/
5) configuration file dbServers.xml
vim /usr/loca/amoeba/conf/dbServers.xml
6) Edit Amoeba .xml
vim /usr/local/amoeba/conf/amoeba.xml
7) Start Amoeba
/usr/local/amoeba/bin/amoeba start
8) Testing
1, in the open window of a literacy test amoeba Login for separation
#yum -y install mysql #mysql -ujack-p123 -h192.168.189.131 -P8066
2, create a database wg
create database wg;
use wg; create table list(id int); insert into list values(1); insert into list values(2);
3, stop mysql synchronization from
stop slave;
4、在Amoeba上插入两条数据
insert into list values(3); insert into list values(4);
5、在Amoeba上查看数据,发现只有1、2没有新数据
6、切换到MySQL主上查看,主上可以查看到所有的新数据
select * from wg.list;
7、在MySQL从上查看数据,这里只有1、2
目前验证完毕,MySQL主有新的数据,说明在数据是王MySQL主上写数据
然后Amoeba查看的数据内容和MySQL从一致,说明数据是往从上读取数据
读写分离配置完毕