In the previous blog to compare the various MySQL cluster scenarios, this blog will explain the replication features in the more excellent Percona xtradb cluster installation steps
first, if the server already has a default MySQL (many Linux installed with MySQL) need to delete first, otherwise it will report conflict
Rpm-qa | Grep-i Mysql-server | Xargs sudo rpm-e--nodeps
To install a dependent package
wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
RPM-IVH epel-release-6-8.noarch.rpm
wget http://mirror.centos.org/centos/6/os/x86_64/Packages/nc-1.84-22.el6.x86_64.rpm
RPM-IVH nc-1.84-22.el6.x86_64.rpm
wget http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/socat-1.7.2.4-1.el6.rf.x86_64.rpm
RPM-IVH socat-1.7.2.4-1.el6.rf.x86_64.rpm
Install percona-xtradb-cluster-56
Yum Install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm
Yum Install percona-xtradb-cluster-56
Start after installation
/etc/init.d/mysql start
then create the user to use for replication, where the username and password are sstuser
CREATE USER ' sstuser ' @ ' localhost ' identified by ' sstuser ';
GRANT RELOAD, LOCK TABLES, REPLICATION CLIENT on *.* to ' sstuser ' @ ' localhost ';
FLUSH privileges;
If create user times lost connection, need to upgrade, start MySQL after execution:
Mysql_upgrade-uroot-p--skip-version-check
After creating the user, stop MySQL, modify/etc/my.cnf, my my.cnf for
[Client]
Socket=/var/lib/mysql/mysql.sock
[mysqld]
server_id=1
datadir=/var/lib/mysql
socket=/var/lib/ Mysql/mysql.sock
user=mysql
binlog_format=row
#bind-address=0.0.0.0
default-storage-engine= InnoDB
innodb_autoinc_lock_mode=2
wsrep_provider=/usr/lib64/libgalera_smm.so
wsrep_provider_ Options= "gcache.size=300m; gcache.page_size=1g "
wsrep_cluster_name=" mycluster "
wsrep_cluster_address=" gcomm:// 200.200.168.24,200.200.168.25 "
wsrep_sst_method=rsync
wsrep_node_address=200.200.168.24 # native IP address
#wsrep_sst_method =xtrabackup-v2
wsrep_sst_auth= "Sstuser:sstuser"
wsrep_node_name=pxc1
Wsrep_ Slave_threads=4
[Mysql_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
There are two places to note:
1, wsrep_node_address=200.200.168.24 installation of each MySQL service, you need to modify their own IP
2, Wsrep_sst_method: When you just install, you need to set the slave node to rsync in order to sync successfully
MySQL services in each cluster are installed with the above steps
After the installation is complete, you can start MySQL.
The way to start MySQL, if it is the primary server, use/etc/init.d/mysql BOOTSTRAP-PXC, if it is a backup server, use/etc/init.d/mysql start.
When you start the primary server and start the backup server, you can see that the backup server automatically synchronizes the data.
In addition, if failed to start, first of all, look at the MySQL log, the above my.cnf specified in the Var/log/mysqld.log (if not specified, the default is in the directory/var/lib/mysql/), to see if there is no permission deny the problem, if there are, Perform
Yum-y Install Policycoreutils-python
Semanage permissive-a mysqld_t
Reference Documentation:
http://www.percona.com/doc/percona-xtradb-cluster/5.6/
http://hj192837.blog.51cto.com/655995/1546149
Http://blog.chinaunix.net/uid-20776139-id-4041319.html
http://blog.csdn.net/china_world/article/details/25424903
http://blog.csdn.net/renfengjun/article/details/41379901