LVS/DR + keepalived+ Galera Cluster implement MySQL Cluster

Source: Internet
Author: User

First, MySQL Galera introduction

Mysql/galera is a multi-master cluster of Mysql/innodb with the following features:

1) Synchronous replication

2) active-active multi-Master topology

3) Any node in the cluster can read and write

4) Automatic identity control, failure node automatically separated from the cluster

5) Automatic node access

6) True parallel replication based on "row" level and ID checks

7) No single point of failure, easy to expand

2. Architecture diagram

650) this.width=650; "title=" qq20150709103056.jpg "alt=" wkiol1wd32kiravcaagodn34chk758.jpg "src="/HTTP/ S3.51cto.com/wyfs02/m00/6f/78/wkiol1wd32kiravcaagodn34chk758.jpg "/>

Second, Galera cluster installation

1, pre-installation preparation

1) need at least three MySQL server, if only two to do cluster, if there is inconsistent data situation, it is possible to have a brain fissure, need an arbitration server, if the direct three do cluster, then no longer need to arbitrate.


    2) If you are doing a galera cluster for an existing environment, you need to check the existing MySQL table, including the table, the table engine, whether there is no primary key, whether there is a full-text index, whether there is a spatial index:

Select distinct       concat (T.table_schema, '. ', T.table_name)  as  tbl,       t.engine,       if ( ISNULL (c.constraint_name), ' nopk ', ')  as nopk,       if (s.index_ type =  ' fulltext ', ' Fulltext ', ')  as ftidx,       if ( s.index_type =  ' spatial ', ' spatial ', ')  as gisidx  from information_ Schema.tables as t  left join information_schema.key_column_usage as c     ON  (t.table_schema = c.constraint_schema and t.table_name  = c.table_name        and c.constraint_name =   ' PRIMARY ')   LEFT JOIN information_schema.statistics AS s     ON  (t.table_schema = s.table_schema AND t.table_name = s.table_name         AND s.index_type IN  (' fulltext ', ' SPATIAL ')   where t.table_schema  NOT IN  (' Information_schema ', ' performance_schema ', ' MySQL ')     AND  t.table_type =  ' base table '     AND  (t.engine <>  ' InnoDB '  OR c.constraint_name IS NULL OR s.index_type IN  (' fulltext ', ' SPATIAL '))   ORDER BY t.table_schema,t.table_name;

2. Experimental environment:

Operating system: centos6.5-x64

mysql1:172.16.5.156

mysql2:172.16.5.157

mysql3:172.16.5.158

3. Install dependent packages:

Yum groupinstall-y "Development Tools" "Server Platform Development"

4. Install the MySQL version with Wsrep patch

Yum install-y libaio-develwget Https://launchpad.net/codership-mysql/5.6/5.6.16-25.5/+download/mysql-5.6.16_wsrep _25.5-linux-x86_64.tar.gz Tar XF mysql-5.6.16_wsrep_25.5-linux-x86_64.tar.gz mv mysql-5.6.16_wsrep_25.5-linux-x86_ 64/usr/local/mysqluseradd-s/sbin/nologin-m mysqlmkdir/data/mydata./scripts/mysql_install_db--no-defaults-- Datadir=/data/mydata--user=mysqlchown-r Mysql.mysql/data/mydata/chown root.mysql/usr/local/mysqlcp/usr/local/ Mysql/support-files/mysql.server/etc/init.d/mysqld

5. Install Galera Copy Plugin

wget Https://launchpad.net/galera/3.x/25.3.5/+download/galera-25.3.5-src.tar.gztar XF GALERA-25.3.5-SRC.TAR.GZCD GALERA-25.3.5-SRCSCONSCP GARB/GARBD/USR/LOCAL/MYSQL/BINCP libgalera_smm.so/usr/local/mysql/lib/plugin/

6. Edit MySQL configuration file my.cnf

[Mysqld]basedir =/usr/local/mysqldatadir =/data/mydataport = 3306server-id=101socket =/tmp/mysql.sockpid-file=/data /mydata/mysql.pidsql_mode=no_engine_substitution,strict_trans_tableswsrep_node_name = Mysql1wsrep_provider =/usr/ Local/mysql/lib/plugin/libgalera_smm.sowsrep_sst_method = Rsync#wsrep_sst_auth=sst:sstpass #使用sst的用户和密码, if opened here, You need to create the user on MySQL and grant it sufficient permissions default_storage_engine=innodbinnodb_autoinc_lock_mode=2innodb_locks_unsafe_for_binlog= 1innodb_flush_log_at_trx_commit=1innodb_file_per_table=1binlog_format=rowlog-bin=mysql-binrelay-log= Mysql-relay-binlog-slave-updates=1

This article is from the "Start from the Heart" blog, please be sure to keep this source http://hao360.blog.51cto.com/5820068/1672435

LVS/DR + keepalived+ Galera Cluster implement MySQL Cluster

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.