Percona Gtid Circular Replication

Материал из noname.com.ua
Перейти к навигацииПерейти к поиску


Циклическая репликация Percona

Есть задача - реализовать отказоустойчивый сайт (на движке Вордпресс)

  • Хранилище фалов - Gluster (http://wiki.sirmax.noname.com.ua/index.php/GlusterFS_Docker)
  • База - циклически настроенная репликация на percona
  • Сервера участвующие в репликации - node-4, node-5 и node-6 (имена выбраны по историческим причинам)

Схема работы:


+----------------------------------------------------+
| node-4                                             |
|                                                    |
| +-----------------------+                          |
| | Percona container     | /data ( /var/lib/mysql ) |
| +------3306-------------+ /configs ( /etc/mysql )  |
|         |                                          |
+--------3306----------------------------------------+
       Master  ^ Slave
          |    |
       Slave   +----------------------------------------+
+----------------------------------------------------+  |
| node-5                                             |  |
|                                                    |  |
| +-----------------------+                          |  |
| | Percona container     | /data ( /var/lib/mysql ) |  |
| +------3306-------------+ /configs ( /etc/mysql )  |  |
|         |                                          |  |
+--------3306----------------------------------------+  |
       Master                                           |
          |                                             |
        Slave                                           |
+----------------------------------------------------+  |
| node-6                                             |  |
|                                                    |  |
| +-----------------------+                          |  |
| | Percona container     | /data ( /var/lib/mysql ) |  |
| +------3306-------------+ /configs ( /etc/mysql )  |  |
|         |                                          |  |
+--------3306----------------------------------------+  |
         Master                                         |
          |                                             |
          +---------------------->----------------------+

Установка Percona в Docker

TBD

node-4

auto_increment_increment = 3
auto_increment_offset = 2
replicate-do-db = replica_test
binlog-format=ROW
binlog-checksum=crc32
gtid-mode=on
enforce-gtid-consistency=true
log-slave-updates=true
server-id = 4
 create database replica_test;
 GRANT replication slave ON *.* TO 'replication'@'%' IDENTIFIED BY 'replication';

Для node-4 master - node-6

change master to master_host='node-6', master_auto_position=1, master_user='replication', master_password='replication';
start slave;

node-5

auto_increment_increment = 3
auto_increment_offset = 3
replicate-do-db = replica_test
binlog-format=ROW
binlog-checksum=crc32
gtid-mode=on
enforce-gtid-consistency=true
log-slave-updates=true
server-id = 5

Для node-5 master - node-4

change master to master_host='node-4', master_auto_position=1, master_user='replication', master_password='replication';
start slave;

node-6

auto_increment_increment = 3
auto_increment_offset = 1
replicate-do-db = replica_test
binlog-format=ROW
binlog-checksum=crc32
gtid-mode=on
enforce-gtid-consistency=true
log-slave-updates=true
server-id = 6


Для node-6 master - node-5

change master to master_host='node-5', master_auto_position=1, master_user='replication', master_password='replication';
start slave;