Percona Gtid Circular Replication: различия между версиями

Материал из noname.com.ua
Перейти к навигацииПерейти к поиску
 
(не показано 12 промежуточных версий этого же участника)
Строка 14: Строка 14:
 
<PRE>
 
<PRE>
   
+-------------------------------------------------+
+
+----------------------------------------------------+
| node-4 |
+
| node-4 |
| |
+
| |
| +-----------------------+ |
+
| +-----------------------+ |
| | Percona container | /data ( /var/lib/mysql ) |
+
| | Percona container | /data ( /var/lib/mysql ) |
| +------3306------------+ /configs ( /etc/mysql ) |
+
| +------3306-------------+ /configs ( /etc/mysql ) |
| | |
+
| | |
+-------3306------------------------------------+
+
+--------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 |
  +
| |
  +
+---------------------->----------------------+
  +
</PRE>
  +
==Установка Percona в Docker==
  +
TBD
   
  +
==node-4==
  +
<PRE>
  +
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
  +
</PRE>
  +
<PRE>
  +
create database replica_test;
  +
GRANT replication slave ON *.* TO 'replication'@'%' IDENTIFIED BY 'replication';
  +
</PRE>
   
  +
Для node-4 master - node-6
  +
<PRE>
  +
change master to master_host='node-6', master_auto_position=1, master_user='replication', master_password='replication';
  +
</PRE>
  +
<PRE>
  +
start slave;
  +
</PRE>
   
  +
==node-5==
  +
<PRE>
  +
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
  +
</PRE>
  +
  +
Для node-5 master - node-4
  +
<PRE>
  +
change master to master_host='node-4', master_auto_position=1, master_user='replication', master_password='replication';
  +
</PRE>
  +
<PRE>
  +
start slave;
  +
</PRE>
  +
  +
==node-6==
  +
<PRE>
  +
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
  +
  +
</PRE>
  +
  +
  +
  +
Для node-6 master - node-5
  +
<PRE>
  +
change master to master_host='node-5', master_auto_position=1, master_user='replication', master_password='replication';
  +
</PRE>
  +
<PRE>
  +
start slave;
 
</PRE>
 
</PRE>

Текущая версия на 23:17, 8 марта 2016


Циклическая репликация 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;