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

Garela cluster

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

All firewalls and selinux need to be turned off

Time must be synchronized and time server can be prepared.

# vim / etc/ntp.conf

Server 127.127.1.0

Fudge 127.127.1.0 stratum 10

# systemctl restart ntpd

Client synchronization time:

$ntpdate galera1

Download and install Galera (install each one)

Note: Galera has a separate patch pack, as well as a complete package with patches based on mysql

We need to download the version with the wsrep extension patch, such as:

MySQL 5.7.20 extended with wsrep patch version 25.13

Do a good local resolution: ip corresponds to galera1,garela2,garela3

Configure yum Feed

# cat galera.repo

[galera]

Name=galera

Baseurl= http://releases.galeracluster.com/mysql-wsrep-5.7/centos/7/x86_64/

Enabled=1

Gpgcheck=0

View the installation package

Yum list | grep 'galera'

Galera.x86_64 25.3.12-2.el7 epel

Mysql-wsrep-5.7.x86_64 5.7.20-25.13.el7 galera

Mysql-wsrep-client-5.7.x86_64 5.7.20-25.13.el7 galera

Mysql-wsrep-common-5.7.x86_64 5.7.20-25.13.el7 galera

Mysql-wsrep-devel-5.7.x86_64 5.7.20-25.13.el7 galera

Mysql-wsrep-libs-5.7.x86_64 5.7.20-25.13.el7 galera

Mysql-wsrep-libs-compat-5.7.x86_64 5.7.20-25.13.el7 galera

Mysql-wsrep-server-5.7.x86_64 5.7.20-25.13.el7 galera

Mysql-wsrep-test-5.7.x86_64 5.7.20-25.13.el7 galera

Installation:

# yum install mysql-wsrep-5.7.x86_64 galera rsync-y

Modify the mysql configuration file to change all mysql passwords to 123

Each machine creates a user for data synchronization:

Mysql > grant all on *. * to 'syncuser'@'%' identified by' 123'

Mysql > flush privileges

Mysql > grant all on *. * to 'syncuser'@'%' identified by' Qianfeng123 thanks'

Mysql > flush privileges

Configure Galera Replication:

Galera1 configuration: the main configuration file my.cnf is appended as follows. The boldface part is different from other nodes.

Server-id=1

Binlog_format=row

Innodb_file_per_table=1

Innodb_autoinc_lock_mode=2

Wsrep_on=ON

Wsrep_provider=/usr/lib64/galera/libgalera_smm.so

Wsrep_cluster_name='galera'

Wsrep_cluster_address='gcomm://'

Wsrep_node_name='galera1'

Wsrep_node_address='192.168.245.133'

Wsrep_sst_auth=syncuser:'123'

Wsrep_sst_method=rsync

Gelera2 configuration: the main configuration file my.cnf is appended as follows:

Server-id=2

Binlog_format=row

Innodb_file_per_table=1

Innodb_autoinc_lock_mode=2

Wsrep_on=ON

Wsrep_provider=/usr/lib64/galera/libgalera_smm.so

Wsrep_cluster_name='galera'

Wsrep_cluster_address='gcomm://galera1,galera3' / / you don't have to write the first one here, but you have to write it later, and you can't write your own ip or locally resolved names.

Wsrep_node_name='galera2'

Wsrep_node_address='192.168.245.136'

Wsrepairsstatically authentic syncuserdisplacement Qianfeng123 bicycle'

Wsrep_sst_method=rsync

Restart the mysql of each machine

View port: galera port: 4567 dint MySQL port: 3306

Test:

Mysql > show status like 'wsrep%'

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