Environment
192.168.126.129 Node29 Master Master
192.168.126.130 Node30 slave-1 from 1
192.168.126.131 Node31 slave-2 from 2
The following 1-4 steps need to be done on all three servers
1. Upload MARIADB Package
2. Unpack the RPM package
TAR-ZXVF mariadb-10.0.30_centos-6_rpm.tar.gz
3. Installation
Yum Localinstall-y *.rpm
4. Turn off the firewall, SELinux
/etc/init.d/iptables stop
Chkconfig iptables on
Setenforce 0
Sed-i ' s/^selinux=.*$/selinux=disabled/'/etc/selinux/config
5. Configuration Master (Master)
VIM/ETC/MY.CNF # #添加如下参数
[Mysqld]
Server-id=1
Log-bin=mysql-bin
Service MySQL Start # #启动mysql
mysqladmin-u root password ' 123456 ' # #设置root密码
Mysql-u root-p123456 # #登录mysql
Create an authorized user
Grant Replication Slave on * * to ' repl ' @ ' 192.168.126.130 ' identified by ' 123456 ';
Grant Replication Slave on * * to ' repl ' @ ' 192.168.126.131 ' identified by ' 123456 ';
Flush privileges;
Flush tables with read lock; # # Table of read lock, prevent the following operation, so that the data remains unchanged (do not do this step, the following two lines of file and position will change)
Show master status; Remember the contents of these two columns, from the operation will be used to
6. Configuration from (slave-1)
VIM/ETC/MY.CNF # #添加如下参数
[Mysqld]
server-id=2 # #这个数值不能和主一样
Log-bin=mysql-bin
Service MySQL Start # #启动mysql
mysqladmin-u root password ' 123456 ' # #设置root密码
Mysql-u root-p123456 # #登录mysql
Stop slave; # #(OK indicates success, this command is start/stop two threads io and SQL)
Change Master to master_host= '192.168.126.129', master_port=3306, master_user= 'repl', Master_ Password= '123456', master_log_file= 'mysql-bin.000002', master_log_pos=1306;
Start slave;
show slave status\g; View Slave io and Slave SQL both show Yes Master and slave configuration succeeded
7. Configure the same from (slave-2) step, but server-id=3 (cannot be the same as the previous Master 1 and from 2)
8. Lord unlock tables; OK lock the table before success, now unlock the table
9. At this time a master more from already configured complete
Test Master
1-Build the repository master to create the WWW-database, creating database www;
From view www library show database;
2-Build Table Master WWW database build table create tables QQQ;
viewing tables from the WWW library use www; show tables;
3-master view outside status show master status; (The value changed with the original record)
From view outside status show slave status/g; Compare Master's data
RPM Package Configuration Mariadb one master multi-slave