当前位置:网站首页>MariaDB's Galera cluster application scenario -- multi master and multi active databases

MariaDB's Galera cluster application scenario -- multi master and multi active databases

2022-07-04 23:13:00 Zuo Mingshui

Implementation environment

Centos  7.2V  1511

MySQL  5.5.52V

Application scenario description

Previously, there was no dual active cluster ;

A database node has historical data ;

Now we need to do double master and double work Galera colony .

Scenario simulation exercise

  1. Create a database node with historical data

From the other MySQL In the database , Back up all the data , Then import the data to the local database node .

Install the same version yum -y install mariadb-server.x86_64

Open database service   :  systemctl   start  mysql

Initialize database

mysql_secure_installation

Import the backup data into the newly installed database :

Data has also been stored in the database :

This will be a database node with historical data that has not been a database cluster and has been running for some time .

  1. Install on the database node with historical data that has been running for a period of time Galera Cluster software

yum --enablerepo=mariadb -y install MariaDB-Galera-server

The same is 5.5.52 Of MariaDB-Galera-server The software will work with 5.5.52 Of MariaDB-server Cause conflict !!

Smooth transition of the same version is not allowed !!!

Use method :

Uninstall the originally installed database software , Then install the cluster software

yum –y  remove  mariadb-server             ( Database server )

yum –y  remove  mariadb                   ( Database client )

Unloading the database directly will not cause loss of data in the database . The data is in /var/lib/mysql It's in the directory .

yum --enablerepo=mariadb -y install MariaDB-Galera-server

After entering the database , Query data still exists

here , The database node only has cluster software installed , The cluster has not been configured .

  1. On the second database node , Install the cluster software

yum --enablerepo=mariadb -y install MariaDB-Galera-server

here , There is no relevant synchronization data in the node database :

  1. Start configuration Galera Configuration files for the cluster

vim   /etc/my.cnf.d/server.cnf

Initialize the newly added database node

mysql_secure_installation

  1. Start cluster

Firewalls and SLinux It is required to close

View the cluster status :

  1. View the data synchronization of the new database node

  1. risk assessment

If the database cluster software can't make a smooth transition as above , You need to uninstall the conflicting database software , During this period, business needs to be stopped .

     2. Risk aversion

When setting up a cluster, you must make a full backup of the database !

     3. Deployment optimization scheme

It is recommended that at least 3 Database nodes . reason , In general ,3 Two databases are used for primary and standby , When a database goes down , At least two databases in the cluster are active and standby .

  1. Evaded 2 In the process of primary primary standby of machine database , continuity 2 The risk of database downtime
  2. Evaded 2 In the process of primary primary standby of machine database ,1 There is a risk that the machine will fail to recover in time due to irresistible factors .
  3. For the downtime of some nodes in the database cluster , Carry out recovery work , Win valuable time .
  4. The failure risk rate of primary and standby databases , From the beginning 2 Two machines are prepared for each other 50% above , Down to 3 The host and the host are prepared for each other 30% following .
原网站

版权声明
本文为[Zuo Mingshui]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/185/202207042244277924.html