The CentOS system Amoeba + MySql Master/Slave read/write splitting configuration is suitable for beginners! ----- For reference only !, Centosamoeba

Source: Internet
Author: User

The CentOS system Amoeba + MySql Master/Slave read/write splitting configuration is suitable for beginners! ----- For reference only !, Centosamoeba

 Start directly:

I. There are three ways to install mysql. Here, there are 2nd ways to install mysql (For details, refer)

Http://www.cnblogs.com/babywaa/articles/4837946.html

1. rpm Installation
2. Source Code Installation
3. General Binary source code Installation

Environment preparation

192.168.5.10 master1

192.158.5.20 slave1

2. Configure the master server, 192.168.5.10
1,
Step 1:Log on to mysql and add a password to the root account.// Reference command:SETPASSWORD = PASSWORD ('Password ');
Step 2:View mysql version// Reference command:Select version ();
Step 3:Add a remote account for synchronizing Slave to the Local Machine// Reference command:Grant replication slave on *. * TO 'slave '@ '192. 168.5.10' identified by 'slave ';
Part 4:View All mysql users// Reference command:Select user, host, password from mysql. user;
Step 5:Delete A localhost account with null passwords// Reference command:Drop user ''@ 'localhost ';
Part 6:Delete the iz25ogxahfrz account with empty passwords// Reference command:Drop user ''@ 'iz25ogxahfrz ';
Step 7:Exit mysql// Reference command:\ Q

2,Edit my. cnf configuration file// Reference command:Vim my. cnf

3,
Step 1:Restart mysql Service// Reference command:Service mysql restart
Step 2:Log on to mysql with the root user and password// Reference command:Mysql-uroot-ppassword
Step 3:View the master ID// Reference command:Show variables like 'service _ id ';
Part 4:View and record the File + pos information of the current master.// Reference command:Show master status;

3. Configure the Slave server, 192.168.5.20
1,
Step 1:Log on to mysql and add a password to the root account.// Reference command:SETPASSWORD = PASSWORD ('Password ');
Step 2:View mysql version// Reference command:Select version ();
Step 3:View All mysql users// Reference command:Select user, host, password from mysql. user;
Step 4:Delete A localhost account with null passwords// Reference command:Drop user ''@ 'localhost ';
Part 5:Delete the account iz25i0yer0yz with blank passwords// Reference command:Drop user ''@ 'iz25i0yer0yz ';
Step 6:Exit mysql// Reference command:\ Q

2,Edit the my. cnf configuration file of the slave server// Reference command:Vim my. cnf

3,
Step 1:Restart mysql Service// Reference command:Service mysql restart
Step 2:View the ID of the slave server// Reference command:Show variables like 'service _ id ';
Step 3:View slave synchronization status// Reference command:Show slave status \ G
Part 4:Disable the slave server to prevent addition, deletion, modification, and query.// Reference command:Stop slave;
Step 5:Configure slave to synchronize master data// Reference command:Change master to master_host = '192. 168.5.10 ', master_user = 'slave', master_password = 'slave ', master_port = 192, master_log_file = 'master _ bin.000001', master_log_pos = 3306;
Part 6:Enable the functions of the slave server// Reference command:Start slave;

4,View the synchronization status of slave// Reference command:Show slave status \ G

Mysql Master/Slave configuration is complete

 

4. Installing Amoeba: dependent on the JAVA environment

JAVA installation
1. Installation

2. Authorize a mysql Remote Account to amoeba
Mysql> grant all privileges on *. * TO 'amoeba' @ '2014. 168.5.30 'identified by 'amoeba' with grant option;

5. Install Amoeba:


Vi. Configuration:
1. Configure dbServers. xml under Amoeba

2. Configure Amoeba. xml under amoeba

 

7. Start Amoeba:
1. [it is best to start it in the current mode to see if there is an error during startup. After troubleshooting the error, start it in the background]
I checked some information on the Internet: JDK 7 requires a minimum value for xss parameters. It must be greater than 228 to start JVM.
Solution:
Set-Xss256k

1 #JVM_OPTIONS="-server -Xms256m -Xmx1024m -Xss196k -XX:PermSize=16m -XX:MaxPermSize=96m"2 JVM_OPTIONS="-server -Xms1024m -Xmx1024m -Xss256k -XX:PermSize=16m -XX:MaxPermSize=96m"

# Vim/usr/local/amoeba/jvm. properties


2. Start again: an error is reported. Please refer to it for details.


3. Errors Caused by disabling the Amoeba service without closing the service normally
Then, after the KILL process is killed, it will not be wrong.
So I learned this long lesson.
Disable Amoeba:
#/Usr/local/amoeba/bin/shutdown
Start the background and save the output log to/var/log/amoeba. log
#/Usr/local/amoeba/bin/launcher>/var/log/amoeba. log 2> & 1 &


8. login test:
1. because mysql is not installed on machine 30, find a machine with mysql installed for testing.
Mysql-uamoeba-p123456-h192.168.0.20.- P8066 // The-P of the specified port is capitalized, not equal to other ports. Be sure to pay attention to Case sensitivity


2. the logon is successful. Please test it freely.
Test method: (1) Create a database in amoeba and log on to the master and slave to check whether the created database exists.
(2) stop the mysql of the master and create a database on the slave. If the database cannot be created, the database is successfully created.
(3) There are better test methods on the Internet, which are not listed one by one. Please search for it by yourself.
9. Amoeba + MySql Master/Slave separation configuration is complete!

 

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.