Amoeba: About MySQL read-write separation

Source: Internet
Author: User

Today, using amoeba to do a read-write separation, the following summary of the following steps:

Three Linux:

1, 192.168.1.213 used to do amoeba server

2.192.168.1.184 for MySQL Database

3.192.168.1.185 for MySQL Database

#service iptables Stop

#setenforce 0



First, running the amoeba requires a Java runtime environment, so install the JDK environment

RPM–IVH jdk-7u45-linux-i586.rpm

Vim/etc/profile Tomcat configuration file

Additional:

Export JAVA_HOME=/USR/JAVA/JDK1.8.0_20

Export Java_bin=/usr/java/jdk1.8.0_20/bin

Export path= $PATH: $JAVA _home/bin

Export classpath=: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar

Export path= $JAVA _home/bin: $JRE _home/bin: $PATH

Source/etc/profile make the modified file effective immediately

java–version Show Version

In this step, the Java version is shown to be successful.

Second, the configuration amoeba

Create a Amoeba folder

Mkdir/root/amoeba

Tar zxvf amoeba-mysql-binary-2.2.0.tar.gz-c/root/amoeba

Cd/root/amoeba

1, first modify Dbserver.xml

Vim/root/amoeba/conf/dbserver.xml//Modify the file

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/89/49/wKioL1gO_HSCAm_mAAA73SS5L3k036.png-wh_500x0-wm_3 -wmp_4-s_1444230519.png "title=" qq picture 20161025143159.png "alt=" Wkiol1go_hscam_maaa73ss5l3k036.png-wh_50 "/>650) this.width=650; "Src=" http://s2.51cto.com/wyfs02/M02/89/4B/wKiom1gO_K3x_5hbAACBgmGJ_bQ219.png-wh_500x0-wm_3-wmp _4-s_3823449213.png "title=" 2.png "alt=" Wkiom1go_k3x_5hbaacbgmgj_bq219.png-wh_50 "/>

2, the next modification amoeba.xml

Vim/root/amoeba/conf/amoeba.xml


_650) this.width=650; "Src=" http://s4.51cto.com/wyfs02/M00/89/49/wKioL1gO_S_TpzoPAAAx_nwVR38409.png-wh_500x0-wm_ 3-wmp_4-s_356915074.png "title=" 3.png "alt=" Wkiol1go_s_tpzopaaax_nwvr38409.png-wh_50 "/>

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/89/4B/wKiom1gO_WqTEK4qAABDhTE6XhQ778.png-wh_500x0-wm_3 -wmp_4-s_2269377382.png "title=" 4.png "alt=" Wkiom1go_wqtek4qaabdhte6xhq778.png-wh_50 "/>

#################################### #分界线 ###########################################


OK, amoeba operation first to this step

Let's go down to the 1.184 database.

Service mysqld Start

Mysql-uroot-p

Mysql>grant all on * * to [email protected] '% ' identified by ' 123456 ';//create remote user and authorize

Mysql>flush privileges;

Mysql>create database LXL; Create DATABASE LXL, just use this database in the Amoeba configuration file

Mysql>create table lxl.t_test (id int (3)); Create a table in the LXL database

Mysql>insert into lxl.t_test values (1); Inserting 3 Records

Mysql>insert into lxl.t_test values (2);

Mysql>insert into Lxl.t_test values (3);

#################################### #分界线 ###########################################

The database preparation on the. 1.184 is finished, go below. 1.185 prepare it.

Service mysqld Start

Mysql-uroot-p

Mysql>grant all on * * to [email protected] '% ' identified by ' 123456 ';//create remote user and authorize

Mysql>flush privileges;

Mysql>create database LXL; Create DATABASE LXL, just use this database in the Amoeba configuration file

Mysql>create table lxl.t_test (id int (3)); Create a table in the LXL database

Mysql>insert into Lxl.t_test values (4); Inserting 2 records

Mysql>insert into lxl.t_test values (5);

#################################### #分界线 ##########################################

Switch to the amoeba server, start amoeba,

Cd/root/amoeba/bin

./amoeba start&

#################################### #分界线 ##########################################

Using Telnet amoeba

Mysql–uamoeba–p1234–p8066–h 192.168.1.213//user name and password using amoeba proxy login to proxy side

Now you can insert the data, because the data of the previous two databases is different, you insert a bar, you can clearly see the difference.

Read and write separation to this is the end, hope to help you!


PS: Today, when I did the experiment, I first made the primary master copy of the two databases. Cause although Amoeba configuration succeeded, two databases inserted into the database, real-time synchronization, tangled half a day











This article is from the "12178027" blog, please be sure to keep this source http://12188027.blog.51cto.com/12178027/1865417

Amoeba: About MySQL read-write separation

Related Article

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.