Liên Kết Thiết Bị Giá Rẻ

Chia Sẽ Kinh Nghiệm Về IT

Tìm Kiếm Với Google

MySQL Master, Slave, Cluster, Replication.. Database Availability... MySQL Database Replication và Failover

Gởi Ðề Tài Mới  Gửi trả lời
Công Cụ Xếp Bài
Tuổi 09-04-2015, 08:33 AM   #1
Trả Lời: n/a
MySQL Master to Master Percona Galera Cluster in CentOS 6 2014
MySQL Master to Master Percona Galera Cluster in CentOS 6 2014

Installing a MySQL multi-master cluster on CentOS 6 requires quite a few steps that may not be obvious. This guide highlights some of the lessons we learned when installing our cluster. This was done in March of 2014, and as time goes by, this guide may become less useful.
To start, you will want to install the CentOS firewall gui so you can easily open the ports required by the cluster.

sudo yum install system-config-firewall
sudo system-config-firewall-tui

In the config tool, make sure ssh is selected, then also open ports 3306 4444 4567 4568 in the additional ports section.
Next, clean off any prior versions of MySQL, MariaDB, galera, percona, etc. by issuing these commands (warning this will delete any MysSQL database you currently have installed.) If you wish to save the data on this machine, do a backup first (by using mysqldump or some other means):

sudo yum erase -y mysql*
sudo yum erase -y mariadb*
sudo yum erase -y MariaDB*
sudo yum erase -y percona*
sudo yum erase -y Percona*
sudo yum erase -y galera*
sudo rm -fR /var/lib/mysql/*

We chose to use the percona package, so we added the package repository to yum as well as their required socat release from rpmforge.

sudo rpm -Uhv
sudo wget
sudo rpm -Uvh rpmforge-release*rpm
sudo yum install socat

Now we are ready to install the Percona Cluster packages.

sudo yum install -y Percona-XtraDB-Cluster-server Percona-XtraDB-Cluster-client \
Percona-XtraDB-Cluster-galera percona-xtrabackup Percona-XtraDB-Cluster-client \
percona-toolkit percona-xtrabackup rsync nc

In order to enable the communication between the cluster, we must edit the

sudo vi /etc/selinux/config

Change the line that says enforcing to permissive as shown here:

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.

Set up your my.cnf file for the cluster. For this example we will use the IP addresses, for the first cluster node you will start with the following to initialize the cluster

sudo vi /etc/my.cnf



# Path to Galera library

# Cluster connection URL contains the IPs of node#1, node#2 and node#3

# In order for Galera to work correctly binlog format should be ROW

# MyISAM storage engine has only experimental support

# This changes how InnoDB autoincrement locks are managed and is a requirement for Galera

# Node #1 address

# SST method

# Cluster name

# Authentication for SST method

# sync slave updates

The section under the comment “sync slave updates” is important if you want the cluster to act as a slave to an existing mysql server. There are a few things to watch for:
  • Make sure your tables are all InnoDB tables.
  • Make sure binary logging is enabled and ROW level replication is set
  • Make sure the log-slave-updates is ON, otherwise the other cluster nodes will not get the changes from the master
  • Make sure all nodes in the cluster are set for the same server-id
Now that we are ready, we can initialize the database and start this node:

sudo mysql_install_db
sudo /etc/init.d/mysql start

Repeat this process for each of the other nodes, but switch the cluster address line when setting up the other nodes. Also, once the cluster is running, that line on the first node that was set up so it will rejoin the cluster if it is restarted. All the node my.cnf should have this config when done:


After you have set up the cluster as a slave to another MySQL database, you may find the cluster slave node gets stuck, you can have the slave node skip a statement with this SQL:



Quick Script to Add or Upgrade Oracle Java to CentOS

Posted in Uncategorized

Custom Live Chat and Call Center Solutions
ICOA develops customer communication including call center, social touch point, live web chat and integration into your enterprise back end.

If you have a custom project need for call center, mobile, web, Microsoft Office extension, VoIP/SIP or other application, contact us for a cost proposal. Submit your request to
  Trả lời ngay kèm theo trích dẫn này
Gửi trả lời

Công Cụ
Xếp Bài

Quyền Hạn Của Bạn
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Mở
Hình Cảm xúc đang Mở
[IMG] đang Mở
Mã HTML đang Tắt

Bây giờ là 04:00 AM. Giờ GMT +7

Diễn đàn tin học QuantriNet |
Founded by Trương Văn Phương | Developed by QuantriNet's members.
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.