Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy mysql Cluster Mode galera-cluster

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail how to deploy mysql cluster mode galera-cluster, Xiaobian thinks it is quite practical, so share it with you as a reference, I hope you can gain something after reading this article.

1: Introduction to galera-cluster

Galera Cluster is a set of free and open source high availability solutions developed by Codership. Its official website is http://galeracluster.com. Galera Cluster is Mariadb cluster with Galera installed (this article only describes Mariadb Garela cluster). It has a multi-master feature and supports multi-point writing. The three (or more) nodes of Galera Cluster are peer-to-peer, and each node supports writing. The consistency and integrity of written data are guaranteed within the cluster. The specific implementation principle will be briefly introduced in this article.

The official characteristics are as follows:

True multi-master cluster, Active-Active architecture;

Synchronous replication without replication latency;

Multithreaded replication;

No master-slave switching operation, no need to use virtual IP;

Hot backup, which does not affect database business during single node failure;

Support automatic node joining without manual data copying;

Support InnoDB storage engine;

Transparent to applications, native MySQL interface;

There is no need to separate reading and writing;

Deployment is simple to use.

II: Operation principle of galera-cluster

The main concern is data consistency. Transactions may or may not apply to each node. So, as long as they are configured correctly, the databases remain synchronized.

Galera replication plug-ins differ from traditional MySQL replication in that they can solve multiple problems, including multi-master write conflicts, replication lag, and master-slave out of sync.

III: Mariadb galera-cluster deployment

3.1: Introduction to System Software Environment

System: CentOS 7.5x64

192.168.20.33 jiankong01.yl.com

192.168.20.34 jiankong02.yl.com

192.168.20.35 jiankong03.yl.com

Software: mariadb-galera-cluster.zip

3.2: Configuring a Time Synchronization Server

Flyfish hosts are configured with chronyd time servers

Time server: 192.168.20.3

If not, you can refer to flyfish's configuration of its server about the time to install the big data cluster CDH

How to install configuration is no longer provided here

3.3 Install mariadb-galear-cluster

All cluster nodes used perform:

yum remove -y mariadb-libs yum install -y unzip boost-devel lsof perl-DBI perl-Data-Dumper

rpm -ivh rpm -ivh MariaDB-10.0.37-centos73-x86_64-*

rpm -ivh MariaDB-Galera-10.0.37-centos73-x86_64-*

3.4 node profile

Node 1: jiankong01.yl.comcd /etc/my.cnf.dvim server.conf----[mysqld]## * Galera-related settings#[galera]# Mandatory settingswsrep_provider= /usr/lib64/galera/libgalera_smm.sowsrep_cluster_address="gcomm://192.168.20.33, 192.168.20.34, 192.168.20.35"wsrep_cluster_name = 'mycluster'wsrep_node_name = 'jiankong01.yl.com'wsrep_node-address = '192.168.20.33'binlog_format=rowdefault_storage_engine=InnoDBinnodb_autoinc_lock_mode=2bind-address=0.0.0.0## Optional setting#wsrep_slave_threads=1-Node 2: jiankong02.yl.comcd /etc/my.cnf.d/vim server.conf----[mysqld]## * Galera-related settings#[galera]# Mandatory settingswsrep_provider= /usr/lib64/galera/libgalera_smm.sowsrep_cluster_address="gcomm://192.168.20.33, 192.168.20.34, 192.168.20.35"wsrep_cluster_name = 'mycluster'wsrep_node_name = ' jiankong02.yl.com'wsrep_node-address = '192.168.20.34'binlog_format=rowdefault_storage_engine=InnoDBinnodb_autoinc_lock_mode=2bind-address=0.0.0.0## Optional setting#wsrep_slave_threads= 1#innodb_flush_log_at_trx_commit=0---Node 3: jiankong03.yl.comcd /etc/my.cnf.d/vim server.conf---[mysqld]## * Galera-related settings#[galera]# Mandatory settings.pdf swsrep_provider= /usr/lib64/galera/libgalera_smm.sowsrep_cluster_address="gcomm://192.168.20.33 192.168.20.34 192.168.20.35"wsrep_cluster_name = 'mycluster'wsrep_node_name = ' www.example.com' jiankong03.yl.com wsrep_node-address = '192.1688.20.35'binlog_format=rowdefault_storage_engine=InnoDBinnodb_autoinc_lock_mode=2bind-address= 0.0.0.0## Optional setting#wsrep_slave_threads=1#innodb_flush_log_at_trx_commit=0----

3.4 Start cluster

Executed on any node of the cluster

service mysql start --wsrep-new-cluster

Take Node 3 as an example:

Node 1 and Node 2 execute:

service mysql start

3.5: Creating a Database Instance

Node 1:

mysql -uroot -pQingchun123.comcreate database nCalInfo

Look at nodes two and three.

mysql -uroot -pQingchun123.comshow databases

About "how to deploy mysql cluster mode galera-cluster" this article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report