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