Deploying Amoeba3.X for Mysql read/write splitting

Source: Internet
Author: User

Project Introduction:

The Amoeba for Mysql software is designed for the MySQL Distributed Database Front-end proxy layer. It acts as an SQLRouting function, focusing on Database Proxy at the distributed Database Proxy layer) development. It is located between the Client and DB and transparent to the Client. Load Balancing, high availability, SQLFiltering, read/write splitting, routing-related to the target database, and concurrent requests to merge results from multiple databases.

Lab environment:

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131229/21521M291-0.jpg "/>

Master: 192.168.0.1

Slave1: 192.168.0.2

Slave2: 192.168.0.3

Amoeba: 192.168.0.4


All operations on Amoeba machines

Install JDK. Amoeba for mysq is developed based on the JAVA environment. Therefore, the system must support JAVA

wget http://download.oracle.com/otn/java/jdk/6u45-b06/jdk-6u45-linux-x64-rpm.binchmod +x jdk-6u45-linux-x64-rpm.bin./jdk-6u45-linux-x64-rpm.bin


Configure the JAVA environment

JKD is installed under/usr/java/by default.

Create soft link

ln -s /usr/java/jdk1.6.0_45 /usr/java/jdk

Edit ~ /. Bash_profile, add the following content

JAVA_HOME=/usr/java/jdkexport JAVA_HOMEexport CLASSPATH=.:JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarPATH=$PATH:$HOME/bin:$JAVA_HOME/binexport PATH


Install Amoeba for mysql

wget http://jaist.dl.sourceforge.net/project/amoeba/Amoeba%20for%20mysql/3.x/amoeba-mysql-3.0.5-RC-distribution.zipunzip  amoeba-mysql-3.0.5-RC-distribution.zipmv amoeba-mysql-3.0.5-RC /usr/local/amoeba

The installation of Amoeba is complete now. The next step is to configure read/write splitting. Because Amoeba3.x is greatly changed compared with 2. x, paste my configuration item.

First, set the database name and account password connected in conf/dbServer. xml

<DbServer name = "abstractServer" effecactive = "true">---omitted---<! -- Mysql port --> <property name = "port"> 3306 </property> <! -- Mysql schema --> <property name = "schema"> database name </property> <! -- Mysql user --> <property name = "user"> account </property> <property name = "password"> password </property> --------- --</dbServer>

Set the database pool, where Slave1 and Slave2 are polling

<dbServer name="Master"  parent="abstractServer">        <factoryConfig>            <!-- mysql ip -->            <property name="ipAddress">192.168.0.1</property>        </factoryConfig>    </dbServer>                                                                                                                                                                                                                                                                                                                 <dbServer name="Slave1"  parent="abstractServer">        <factoryConfig>            <!-- mysql ip -->            <property name="ipAddress">192.168.0.2</property>        </factoryConfig>    </dbServer>    <dbServer name="Slave2"  parent="abstractServer">        <factoryConfig>            <!-- mysql ip -->            <property name="ipAddress">192.168.0.3</property>        </factoryConfig>    </dbServer>    <dbServer name="VirtualPool" 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,Slave2</property>        </poolConfig>    </dbServer>

Configure amoeba. xml

<Property name = "authenticateProvider">--omitted---<property name = "user"> account </property> <property name = "password"> password </property> <property name = "filter">--omitted---</property>
<QueryRouter class = "com. meidusa. amoeba. mysql. parser. mysqlQueryRouter ">---omitted---<property name =" defaultPool "> Master </property> <property name =" writePool "> Master </property> <property name = "readPool"> VirtualPool </property>--omitted--</queryRouter>

Read/write splitting is complete, and amoebe is started.

/usr/local/amoeba2/bin/launcher


Note the following when deploying Amoeba:

1: The firewall must open port 8066.

2: run the chmod + x bin/* command on the bin directory /*

Optimized Performance:

1: There is a JVM configuration file in the amoeba directory. Set JVM_OPTIONS = "-server-Xms1024m-Xmx1024m-Xss256k-XX: PermSize = 16 m-XX: maxPermSize = 96 m "can improve JVM performance. The specific size depends on your needs;

2: multithreading configuration: runtime element;

3: Network-related buffers): connectionFactory

This article from the "embrace open source world to share open source technology" blog, please be sure to keep this source http://sourceworld.blog.51cto.com/3392968/1294384

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.