MariaDB Galera Cluster Deployment

Source: Internet
Author: User

First, MariaDB Galera Cluster Deployment Introduction

MARIADB, as a branch of MySQL, is already widely used in open source projects, such as hot OpenStack, so the cluster deployment is essential to ensure high availability of the service while increasing the load capacity of the system.

MariaDB Galera Cluster Introduction

The MARIADB cluster is a MARIADB synchronous multi-host cluster. It only supports the XTRADB/INNODB storage engine (although there are support for MyISAM experiments-see WSREP_REPLICATE_MYISAM system variables).

Main functions:

    • Synchronous replication
    • True multi-master that all nodes can read and write to the database at the same time
    • Automatic node member control, failed nodes are automatically cleared
    • New node joins data automatic replication
    • True parallel replication, row-level
    • Users can connect directly to the cluster, using the same feeling on MySQL exactly

Advantage:

    • Because it is multi-master, there is no slavelag (delay)
    • There is no loss of transaction condition
    • Ability to expand both read and write
    • Smaller client latency
    • Data between nodes is synchronous, and Master/slave mode is asynchronous, and binlog on different slave may be different

Technology:

The replication capabilities of the Galera cluster are based on the galeralibrary implementation, and in order to enable MySQL to communicate with the Galera library, the Wsrep API has been developed specifically for MySQL.

Galera plug-in to ensure that the cluster synchronization of data, maintain data consistency, relying on the replication of authentication, working principle such as:

When the client issues a commit, all changes to the database are collected by Write-set before the transaction is committed, and the contents of the Write-set record are sent to the other nodes.

Write-set will perform authentication tests on each node, and the test results determine whether the node applies write-set change data.

If the authentication test fails, the node discards the Write-set and if the authentication test succeeds, the transaction commits.

Second, the Environment preparation

Environment Note: Install MARIADB cluster requires at least 3 servers (if only two units require special configuration, please refer to the official documentation)

1. Turn off the firewall

[Email protected] ~]# sed-i ' s/selinux=enforcing/selinux=disabled/g '/etc/selinux/config
[Email protected] ~]# Setenforce 0
Setenforce:selinux is disabled

2. SELinux
[Email protected] ~]# Systemctl stop Firewalld.service
[Email protected] ~]# systemctl disable Firewalld.service

3. Configure Domain Name resolution

[Email protected] ~]# cat/etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.120 Mariadb-node1
192.168.1.121 Mariadb-node2
192.168.1.122 Mariadb-node3

3. Configure MARIADB Source

Note: Starting with the MARIADB 10.1 release, Galera cluster is already included in the MARIADB package and does not require a separate deployment of Mariadb-galera-server and Galera packages.

Use the Yum method to deploy MARIADB Galera Cluster.

#三台机器同时配置mariadb源

[Email protected] ~]# cd/etc/yum.repos.d/
#移走目录中, other source files, keep only mariadb source [[email protected] yum.repos.d]# VI mariadb.repo[mariadb] name = mariadb BaseURL = Http://yum.mariadb.org/10.1/centos7-amd64 gpgkey=https://yum.mariadb.org/rpm-gpg-key-mariadb gpgcheck= # Update Cache yum Clean all yum Makecache

4, Installation MariaDB Galera Cluster (#备注: Three machines at the same time, and to change the source of Yum to domestic Ali)

MariaDB Galera Cluster Deployment

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.