继前一篇mysql读写分离试验继续
IP划分
mysql-mater :192.168.1.129
mysql-slave :192.168.1.126
Amoeba插件服务器IP:192.168.1.122
######################################################################
主从搭建见前一篇搭建文档
开始Amoeba搭建
1 wget http://www.mkongjian.com/soft/lnmp/jdk-6u3-linux-i586.bin
[root@localhost]#./jdk-6u3-linux-i586.bin
[root@localhost conf]# vi /etc/profile
加入
export AMOEBA_HOME=/usr/local/amoeba
export JAVA_HOME=/usr/local/jdk
export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$AMOEBA_HOME/bin
wget http://www.mkongjian.com/soft/lnmp/amoeba-mysql-binary-2.1.0-RC5.tar.gz
[root@localhost]#tar zxvf amoeba-mysql-binary-2.1.0-RC5.tar.gz -C /usr/local/amoeba
#########################
配置文件在附件 amoeba.xml 和dbServers.xml
[root@localhost]#/usr/local/amoeba/bin/amoeba start 启动amoeba
在开一个窗口在amoeba机器上测试连接mysql
[root@localhost ~]# mysql -h 127.0.0.1 -uroot -P8066
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3083761
Server version: 5.1.45-mysql-amoeba-proxy-2.1.0-RC5 Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
OK 连接服务器是没问题了
###############################
mysql> use test;
Database changed
mysql>
查看主服务器日志没有查询日志
120926 18:00:53 21 Query INSERT INTO test.fashi678 (ID, NAME) VALUES (12345, 'Daisy Li.')
查看从服务器日志
120926 18:01:19 11 Query INSERT INTO test.fashi678 (ID, NAME) VALUES (12345, 'Daisy Li.')
从服务器执行的时间比主服务器执行晚是复制后执行的。
到此简单的mysql读写分离搭建完成。