-
读写分离的配置过程
安装java环境,
此处安装是jdk-6u14-linux-x64.bin -
加权限 chmod +x /usr/local/jdk-6u14-linux-x64.bin
-
JDK配置 ./jdk-6u14-linux-x64.bin
-
移动JDK到指定区域方便管理 mv /usr/local/jdk1.6.0_14 /usr/local/jdk1.6
-
配置环境下需要增加的
vi /etc/profile
export JAVA_HOME=/usr/local/jdk1.6
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/lib:$JAVA_HOME/jre/bin:$PATH:$HOME/bin
export AMOEBA_HOME=/usr/local/amoeba/
export PATH=$PATH:$AMOEBA_HOME/bin
-
source /etc/profile #使环境变量立即生效
-
查看版本 java -version
-
安装并配置amoeba软件 mkdir /usr/local/amoeba
-
解压amoeba包 tar zxf /root/amoeba-mysql-binary-2.1.0-RC5.tar.gz –C /usr/local/amoeba
-
给目录加权限 chmod –R 755 /usr/local/amoeba/
-
启动amoeba /usr/local/amoeba/bin/amoeba
-
开始进入mysql授权 grant all on . to test@’106.120.190.%’ identified by ‘123.com’;
-
配置amoeba.xml vim /usr/local/amoeba/conf/amoeba.xml
<!-- Amoeba 账号,密码 -->
<property name="user">amoeba</property>
//30行<property name="password">123456</property>
<!-- 默认数据库,主数据库 -->
<property name="defaultPool">master</property>
//115行<!-- 写数据库 -->
<property name="writePool">master</property>
<!-- 读数据库,dbServer.xml 中配置的 虚拟数据库,数据库池 -->
<property name="readPool">slaves</property>
<property name="needParse">true</property>
-
vim /usr/local/amoeba/conf/dbServers.xml
<!-- mysql port -->
<property name="port">3306</property>
<property name="schema">test</property>
<property name="user">test</property>
<property name="password">123.com</property>……
<dbServer name="master" parent="abstractServer"> //45行
106.120.190.233 //Master的IP
106.120.190.236 //Slave1的IP
//如果有多台slave,则可再配置
106.120.190.228
//Slave2的IP
……
1
slave1 //单台slave的配置格式,
多台的配置格式为:slave1,slave2
`
-
启动amoeba软件 /usr/local/amoeba/bin/amoeba
-
测试 mysql –u amoeba –p123456 –h amoeba的ip –P 8066
来源:CSDN
作者:封狼万霍
链接:https://blog.csdn.net/weixin_46161405/article/details/103895716