Install and deploy the Galera Cluster for MySQL Cluster under CentOS 6

Source: Internet
Author: User

Install and deploy the Galera Cluster for MySQL Cluster under CentOS 6

Galera Cluster for MySQL is a multi-master MySQL Cluster solution based on synchronous replication. It is easy to use and has no single point of failure (spof) and has high availability, it ensures data security and constant expansion when the business continues to grow. Main features:

Synchronous Replication
Topology of multiple master servers
Read/write on any node
Automatically remove faulty nodes
Automatically add to new node
Real row-level concurrent Replication
The client connection experience is consistent with that for operating a single MySQL database.

Galera is essentially a wsrep provider (provider) that runs API interfaces dependent on wsrep. The Wsrep API defines a series of application callback and replication call libraries for Synchronous transaction database writeset replication and similar applications. The purpose is to achieve abstract and isolated replication from application details. Although the main goal of this interface is authentication-Based Multi-master replication, it is also suitable for asynchronous and synchronous master-slave replication.

MySQL Cluster backup and recovery

MySQL Cluster installation Configuration

Create a Cluster environment using three MySQL clusters. DOC

MySQL Cluster7.2 online addition of data nodes has major drawbacks

Build a MySQL-Cluster architecture

Top 10 notes

1. To use Galera, you must patch MySQL-Server with wsrep. You can directly use the officially provided MySQL installation package that has been patched. If the standard version of MYSQL has been installed on the server, You Need To uninstall it and then reinstall it. Pay attention to the backup data before uninstallation.
2. MySQL/Galera clusters only support the InnoDB Storage engine. If your data table uses MyISAM, You need to convert it to InnoDB, otherwise the records will not be copied in multiple databases. You can add the-skip-create-options parameter for the mysqldump command when backing up old data. This removes the table structure declaration information and automatically uses the InnoDB Engine when importing the data to the cluster. However, the AUTO_INCREMENT will be removed. tables with the AUTO_INCREMENT column must be redefined after the import.
3. MySQL 5.5 and earlier InnoDB engines do not support full-text indexes. If you have used MyISAM and created full-text index fields, you can only install MySQL 5.6 with wsrep patch.
4. All data tables must have a PRIMARY key (PRIMARY). If there is no PRIMARY key, you can create an AUTO_INCREMENT column.
5. MySQL/Galera clusters do not support the following queries: LOCK/unlock tables. The following system variables are not supported: character_set_server, utf16, utf32, and ucs2.
6. database logs cannot be saved to tables, but can only be output to files (log_output = FILE). binlog-do-db and binlog-ignore-db cannot be set.
7. Like other clusters, we recommend that you add at least three nodes to the Galera cluster to avoid data corruption due to split-brain on nodes.
8. In the case of high concurrency, a transaction conflict may occur when multiple masters write data at the same time. At this time, only one transaction request will succeed, and all others will fail. You can retry the operation and return the result when the write/update fails.
9. The status of each node in a node is equal and there is no primary or secondary node. The read and write effects to any node are the same. It can be used with VIP/LVS or HA to achieve high availability.
10. If all the machines in the cluster are restarted, for example, the data center is powered off, the first server must be started with an empty address: mysqld_safe-wsrep_cluster_address = gcomm: //>/dev/null &

Typical Galera cluster scenarios

Install MySQL with wsrep patch

  1. # Install the dependent Library first
  2. Yum install libaio gcc-c ++ boost-devel scons check-devel openssl-devel
  3. Ln-sf/usr/lib64/libssl. so.10/usr/lib64/libssl. so.6
  4. Ln-sf/usr/lib64/libcrypto. so.10/usr/lib64/libcrypto. so.6
  5. # Download the MySQL with wsrep source code package. The latest version is 5.5.34-25.9.
  6. Wget https://launchpad.net/codership-mysql/5.5/5.5.34-25.9/+download/mysql-5.5.34_wsrep_25.9-linux-x86_64.tar.gz
  7. Tar zxvf mysql-5.5 *
  8. Music mysql-5.5.34_wsrep_25.9-linux-x86_64/usr/local/mysql
  9. Cd/usr/local/mysql/
  10. Groupadd mysql
  11. Useradd-r-g mysql
  12. Chown-R mysql: mysql.
  13. ./Scripts/mysql_install_db -- no-defaults -- datadir =/opt/mysqldb/-- user = mysql
  14. Chown-R root.
  15. Chown-R mysql/opt/mysqldb/
  16. Echo "export PATH = $ PATH:/usr/local/mysql/bin">/etc/profile
  17. Source/etc/profile
  18. Mysqld_safe -- wsrep_cluster_address = gcomm: //>/dev/null &

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • Next Page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.