一、环境介绍
Master-IP:10.0.0.201
Slave- IP:10.0.0.202
Amobea-IP:10.0.0.203
二、安装JDK
# mkdir /Amoeba
# tar -xvf jdk-7u40-linux-x64.tar.gz -C /Amoeba/
# vim /etc/profile
JAVA_HOME=/Amoeba/jdk1.7.0_40
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$CLASSPATH
export CLASSPATH
# java -version
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)
三、安装Amoeba
# unzip amoeba-mysql-1.3.1-BETA.zip -d /usr/local/amoeba/
# chmod -R +x /usr/local/amoeba/bin/
四、主从授权
>grant all privileges on *.* to ‘amobea‘@‘%‘ identified by ‘amoeba123‘;
>flush privileges;
五、配置Amoeba文件
# cd /usr/local/amoeba/conf
# vim amoeba.xml
更改的第一个区域
#========================================================
9006
10.0.0.203
20
30
30
128
true
root
123456
更改的第二个区域《配置master端登录的信息》
#========================================================
defaultManager
3306
10.0.0.201
test
amobea
amoeba123
200
200
10
600000
600000
true
true
更改的第三个区域《配置slave端登录的信息》
#========================================================
defaultManager
3306
10.0.0.202
test
amobea
amoeba123
200
200
10
600000
600000
true
true
更改的第四个区域《配置master和slave负载均衡池(pool)》
#=======================================================
1
server1
1
server1,server2
更改的第五个区域《配置master和slave读写分离》
#=======================================================
${amoeba.home}/conf/rule.xml
${amoeba.home}/conf/functionMap.xml
${amoeba.home}/conf/ruleFunctionMap.xml
1500
master
master
slave
true
六、修改log4j.xml 取消日志文件生成(太大了,磁盘很容易满)
改成
七、修改Amoeba启动脚本
# vim /usr/local/amoeba/bin/amoeba
#DEFAULT_OPTS="-server -Xms256m -Xmx256m -Xss128k" 将此行注释掉,增加一下行
DEFAULT_OPTS="-server -Xms256m -Xmx256m -Xss256k" 增加这一行
八、启动Amoeba脚本
# nohup bash -x /usr/local/amoeba/bin/amoeba &
# cat nohup.out 日志是否成功?
# ps -ef | grep amoeba 查看进程是否启动成功
root 1896 1637 1 03:28 pts/3 00:00:06 /Amoeba/jdk1.7.0_40/bin/java -server -Xms256m -Xmx256m -Xss256k -Damoeba.home=/usr/local/amoeba -Dclassworlds.conf=/usr/local/amoeba/bin/amoeba.classworlds -classpath /usr/local/amoeba/lib/classworlds-1.0.jar org.codehaus.classworlds.Launcher
原文:http://8448262.blog.51cto.com/8438262/1408373