Percona xtradb cluster installation procedure, perconaxtradb
The previous blog compares various mysql cluster solutions. This blog will explain the installation steps of percona xtradb cluster, which is excellent in synchronous replication.
First, if the default mysql already exists on the server (many linux installations contain mysql), delete it first. Otherwise, a conflict is reported.
Rpm-qa | grep-I mysql-server | xargs sudo rpm-e -- nodeps
Install dependent packages
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
Create a user for Synchronous replication. the user name and password used here are both sstuser
Create user 'sstuser' @ 'localhost' identified by 'sstuser ';
Grant reload, lock tables, replication client on *. * TO 'sstuser' @ 'localhost ';
Flush privileges;
If lost connection is reported when you create a user, you need to upgrade it. After mysql is started, run the following command:
Mysql_upgrade-uroot-p -- skip-version-check
After the user is created, stop Mysql and modify/etc/my. cnf. my. cnf is
[Client] socket =/var/lib/mysql. sock [mysqld] server_id = 1 datadir =/var/lib/mysqlsocket =/var/lib/mysql. sockuser = mysqlbinlog_format = ROW # bind-address = 0.0.0default-storage-engine = innodbinnodb_autoinc_lock_mode = 2wsrep_provider =/usr/lib64/libgalera_smm.sowsrep_provider_options = "gcache. size = 300 M; gcache. page_size = 1G "wsrep_cluster_name =" mycluster "wsrep_cluster_address =" gcomm: // Commission, Reporter "wsrep_sst_method = accept # local IP address # wsrep_sst_method = xtrabackup-v2wsrep_sst_auth =" sstuser: sstuser "wsrep_node_name = pxc1 wsrep_slave_threads = 4 [mysql_safe] log-error =/var/log/mysqld. logpid-file =/var/run/mysqld. pid
Note the following two points:
1. wsrep_node_address = 200.200.168.24 when installing each mysql service, you must change it to your own ip address.
2. wsrep_sst_method: when installing the Server Load balancer instance, you must set the Server Load balancer node to rsync.
Install the mysql service in each cluster following the preceding steps.
After the installation is complete, you can start Mysql.
To start mysql, use/etc/init. d/mysql bootstrap-pxc for the master server and/etc/init. d/mysql start for the backup server.
Start the master server. When the backup server is started, the backup server automatically synchronizes data.
In addition, if the startup fails, first check the mysql Log, my. var/log/mysqld is specified in cnf. log (if not specified, it is in the directory/var/lib/mysql/by default) to see if there is any permission deny problem. If yes, run
Yum-y install policycoreutils-python
Semanage permissive-a mysqld_t
Reference:
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