KeepAlive implementing MySQL Primary master replication, high availability cluster

Source: Internet
Author: User

First, pre-installation preparation

Close iptables:

Service iptables stop;

Chkconfig iptables off

Close SELinux

Vi/etc/selinux/config


query whether the system has MySQL installed , and if so, remove it.

Rpm-qa | grep MySQL

to remove the installed MySQL:

Yum Remove mysql-libs-5.1.66-2.el6_3.x86_64

Second, the installation database

Install the required plugins:

Yum Install Perl perl-devel libaiolibaio-devel

installation Mysql-shared-compat Replace mysql-libs, if not replaced, when you delete mysql-libs, you will be prompted to postfix dependent on Mysql-libs

RPM-IVH mysql-shared-compat-5.6.26-1.el6.x86_64.rpm

To install the service side:

RPM-IVH mysql-server-5.6.26-1.el6.x86_64.rpm

To install the client:

RPM-IVH mysql-client-5.6.26-1.el6.x86_64.rpm

set power on auto start :

Chkconfig MySQL on

start mysql:

Service MySQL Start

stop mysql:

Service MySQL Stop

get the root password:
More/root/.mysql_secret

To modify the root password and delete the anonymous account:

/usr/bin/mysql_secure_installation--user=mysql

Modify Host Name:

Vi/etc/sysconfig/network

Vi/etc/hosts

Modify the master server configuration file (see the configuration file attached):

Vi/usr/my.cnf

Modify the From server configuration file (see the configuration file attached):

go to MySQL:

Mysql-u root-p

Show Master Status

Show global variables like '%uuid% '

Create a copy account on both machines and authorize :

Grant Replication Slave on * * to ' mysql ' @ ' 192.168.2.% ' identified by ' MySQL ';

Flush privileges; # Reload Permissions

To connect the main library from the library:

Change Master to master_host= ' 192.168.2.61 ', master_user= ' MySQL ', master_password= ' MySQL ', master_port=3306,master_ Auto_position=1;

Start slave;

Main Library connections from library:

Change Master to master_host= ' 192.168.2.62 ', master_user= ' MySQL ', master_password= ' MySQL ', master_port=3306,master_ Auto_position=1;

Start slave;

Third, install and configure the keepalived(configuration file see attachment)

Yum Install keepalived

Vi/etc/keepalived/keepalived.conf

Four, test:

Grant all privileges on * * to ' root ' @ '% ' identified by ' 123456 ';

Mysql-h "192.168.2.60"-u root–p

Show variables like "server_id";

Show Processlist;

show databases;

show slave status\g;

Show Master Status\g;


This article is from the It DreamWorks blog, so be sure to keep this source http://fly520.blog.51cto.com/2181586/1696539

KeepAlive implementing MySQL Primary master replication, high availability cluster

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.