java version “1.8.0_73”
wget http://nchc.dl.sourceforge.net/project/amoeba/Amoeba%20for%20mysql/2.2.x/amoeba-mysql-binary-2.2.0.tar.gz
mkdir /opt/amoeba/
tar -zxvf amoeba-mysql-binary-2.2.0.tar.gz -C /opt/amoeba/
cd /opt/amoeba/
./bin/amoeba
The stack size specified is too small, Specify at least 228k
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit
#修改./bin/amoeba的
DEFAULT_OPTS="-server -Xms256m -Xmx256m -Xss128k"
为
DEFAULT_OPTS="-server -Xms256m -Xmx256m -Xss228k"
vim .conf/amoeba.xml
...
<!--登陆的用户名-->
<property name="authenticator">
<bean class="com.meidusa.amoeba.mysql.server.MysqlClientAuthenticator">
<property name="user">root</property>
<property name="password">123123</property>
<property name="filter">
<bean class="com.meidusa.amoeba.server.IPAccessController">
<property name="ipFile">${amoeba.home}/conf/access_list.conf</property>
</bean>
</property>
</bean>
</property>
...
<queryRouter class="com.meidusa.amoeba.mysql.parser.MysqlQueryRouter">
<property name="ruleLoader">
<bean class="com.meidusa.amoeba.route.TableRuleFileLoader">
<property name="ruleFile">${amoeba.home}/conf/rule.xml</property>
<property name="functionFile">${amoeba.home}/conf/ruleFunctionMap.xml</property>
</bean>
</property>
<property name="sqlFunctionFile">${amoeba.home}/conf/functionMap.xml</property>
<property name="LRUMapSize">1500</property>
<property name="defaultPool">master1</property>
<property name="writePool">multWritePool</property>
<property name="readPool">multReadPool</property>
<property name="needParse">true</property>
</queryRouter>
...
...
<!--连接真实数据库的用户和密码-->
<!-- mysql port -->
<property name="port">3306</property>
<!-- mysql schema -->
<property name="schema">test</property>
<!-- mysql user -->
<property name="user">root</property>
<property name="password">123123</property>
...
<!--master为读写的mysql,slave1为只读的mysql -->
<dbServer name="master1" parent="abstractServer">
<factoryConfig>
<!-- mysql ip -->
<property name="ipAddress">192.168.42.28</property>
</factoryConfig>
</dbServer>
<dbServer name="master2" parent="abstractServer">
<factoryConfig>
<!-- mysql ip -->
<property name="ipAddress">192.168.42.29</property>
</factoryConfig>
</dbServer>
<dbServer name="slave1" parent="abstractServer">
<factoryConfig>
<!-- mysql ip -->
<property name="ipAddress">192.168.42.33</property>
</factoryConfig>
</dbServer>
<!-- 读的Pool -->
<dbServer name="multReadPool" virtual="true">
<poolConfig class="com.meidusa.amoeba.server.MultipleServerPool">
<!-- Load balancing strategy: 1=ROUNDROBIN , 2=WEIGHTBASED , 3=HA-->
<property name="loadbalance">1</property>
<!-- Separated by commas,such as: server1,server2,server1 -->
<property name="poolNames">slave1,slave1,master1,master2</property>
</poolConfig>
</dbServer>
<!-- 写的Pool -->
<dbServer name="multWritePool" virtual="true">
<poolConfig class="com.meidusa.amoeba.server.MultipleServerPool">
<!-- Load balancing strategy: 1=ROUNDROBIN , 2=WEIGHTBASED , 3=HA-->
<property name="loadbalance">1</property>
<!-- Separated by commas,such as: server1,server2,server1 -->
<property name="poolNames">master1,master2</property>
</poolConfig>
</dbServer>
...
./bin/amoeba start
mysql -uroot -p123123 -P 8066 -h0.0.0.0