I. Amoeba Introduction
website: http://docs.hexnova.com/amoeba/
two. Installing Java se1.5
three. Installing amoeba2.2.0
1.:http://sourceforge.net/projects/amoeba/files/, download amoeba-mysql-binary-2.2.0.tar.gz
2. Insert/usr/local/amoeba directly after decompression (the path is optional)
Four. Configure Amoeba
* Note The following configuration, please remember to remove the XML comments, the password entry by default is a comment
1.amoeba Configuration
#vi/usr/local/amoeba/conf/amoeba.xml
Configure port, service IP address, login user name and password
<property name= "Port" >8066</property>
<property name= "ipAddress" >192.168.1.84</property>
<property name= "user" >testuser</property>
<property name= "password" >password</property>
2. Testing
#mysql-U testuser-p-H 192.168.1.84-p 8066
3. Configure Dbservers.xml
#vi/usr/local/amoeba/conf/dbservers.xml
Configure the database, account number and password (the account and password are MySQL)
<property name= "schema" >dba_db</property>
<property name= "user" >test</property>
<property name= "password" >123456</property>
4. Modify the Dbservers.xml to configure the MySQL server IP address and aliases:
<dbserver name= "master" parent= "Abstractserver" >
<factoryConfig>
<!--mysql IP --
<property name= "ipAddress" >192.168.1.126</property>
</factoryConfig>
</dbServer>
<dbserver name= "slave" parent= "Abstractserver" >
<factoryConfig>
<!--mysql IP --
<property name= "ipAddress" >127.0.0.1</property>
<property name= "user" >mytest</property>
<property name= "password" >pwd</property>
</factoryConfig>
</dbServer>
because slave's account and password are different, set the account password again under the slave node
5. Modify Dbservers.xml, set Roundrobin (polling policy)
<dbserver name= "Virtualslave" 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" >slave,slave,master,master</property>
</poolConfig>
</dbServer>
6. Modify Amoeba.xml, set read/write separation
in <queryrouter class= "Com.meidusa.amoeba.mysql.parser.MysqlQueryRouter" > Segment Settings
<property name= "Defaultpool" >master</property>
<property name= "Writepool" >master</property>
<property name= "Readpool" >virtualSlave</property>
<property name= "Needparse" >true</property>
7. Restart Amoeba
#/usr/local/amoeba/bin/amoeba Start
8. Testing
#mysql-U testuser-p-H 192.168.1.84-p 8066
Five. Optimization
1. Modify Log4j.xml to cancel log file generation (too big, the disk is very easy to fill), <param name= "file" value= "Amoeba.home/logs/project.log"/> Change to:< Paramname= "File" value= "<! [cdata[{amoeba.home}/logs/project.log>/dev/null]]> "/>
2. Performance optimization, open bin/amoeba,default_opts= "-server-xms256m-xmx256m-xss128k" changed to: default_opts= "-server-xms512m-xmx512m -xmn100m-xss1204k "
The 3.loadbalance element sets the options for the LoadBalance policy, where the first "Roundrobin" polling policy is selected, which provides load balancing, failOver, and failback capabilities. Poolnames defines the database node configuration (which can, of course, be a virtual node). In addition to the polling policy, Poolnames also defines its polling rules, such as set to "Slave1,slave1,slave2" then amoeba will cycle through the database nodes in two Slave1, one Slave2 order.
Six. Performance Testing
#/usr/local/amoeba/bin/benchmark-p 8066-c 1000-f. /benchmark/query.xml-h 192.168.1.84-n 100000-u testuser-p password
the Query.xml is as follows:
<?xml version= "1.0" encoding= "UTF-8"?>
<! DOCTYPE Properties SYSTEM "Http://java.sun.com/dtd/properties.dtd" >
<properties version= "1.0" >
<entry key= "class" >com.meidusa.amoeba.mysql.net.packet.QueryCommandPacket</entry>
<entry key= "command" >3</entry>
<entry key= "Query" ><! [Cdata[
SELECT * from Dba_db.test WHERE id=191
]]>
</entry>
</properties>
Reference article: http://www.cnblogs.com/lhj588/archive/2012/11/19/2777897.html
CentOS installation configuration amoeba and testing