diff --git a/HowtoMySQL/Galera.md b/HowtoMySQL/Galera.md new file mode 100644 index 00000000..437e581b --- /dev/null +++ b/HowtoMySQL/Galera.md @@ -0,0 +1,107 @@ +--- +categories: databases +title: Réplication MySQL avec Galera +... + +## Aperçu + +Galera est un module de réplication synchrone et multi-master avec une +tolérance de panne transparente. Il se base sur la _Write-Set Replication API_ +(_wsrep API_) de MySQL. + +La réplication est totalement transparente pour l'application, aucun potentiel +délai de réplication ou gestion des locks entre les serveurs n'est à prévoir. +Cependant les tables non-transactionnelles de type MyISAM ne sont pas +supportées par la réplication et ne seront donc pas répliquées ! + +Il est conseillé d'avoir au minimum 3 serveurs en cas de conflit de +réplication, mais 2 peuvent suffire. + +Documentation officielle : http://galeracluster.com/documentation-webpages/gettingstarted.html + +## Installation + +~~~ +# apt install galera-3 mariadb-galera-server rsync +~~~ + +## Configuration réseau + +La réplication Galera utilise des ports réseau dédiés. Il est donc nécessaire d'autoriser les ports suivant dans les pare-feu des machines : + + - 4567/tcp, 4567/udp + - 4568/tcp + - 4444/tcp + +## Mise en place + +Ajouter la configuration suivante dans le fichier _/etc/mysql/conf.d/galera.cnf_, sur toutes les machines du cluster : + +~~~ +[mysqld] + +# The following MySQL options are mandatory for Galera to work + +bind-address=0.0.0.0 + +default-storage-engine=innodb +innodb_autoinc_lock_mode=2 +innodb_flush_log_at_trx_commit=0 +innodb_buffer_pool_size= + +binlog_format=ROW + +# Galera cluster configuration + +wsrep_provider=/usr/lib/galera/libgalera_smm.so +wsrep_provider_options="gcache.size=300M; gcache.page_size=300M" + +wsrep_cluster_name=" SHOW STATUS LIKE 'wsrep_%'; ++---------------------------+------------+ +| Variable_name | Value | ++---------------------------+------------+ +... +| wsrep_local_state_comment | Synced (6) | +| wsrep_cluster_size | 3 | +| wsrep_ready | ON | ++---------------------------+------------+ +~~~ + +_wsrep_cluster_size_ indique ici le nombre de machine dans le cluster. diff --git a/HowtoMySQL/Replication.md b/HowtoMySQL/Replication.md index e225868f..0b6ef2da 100644 --- a/HowtoMySQL/Replication.md +++ b/HowtoMySQL/Replication.md @@ -5,6 +5,8 @@ title: Howto réplication MySQL Pour le guide d'installation et d'usage courant, voir [HowtoMySQL](/HowtoMySQL). +Pour la réplication synchrone avec Galera, voir [HowtoMySQL/Galera](/HowtoMySQL/Galera). + ## Préparation d'une réplication MASTER/SLAVE Il faut :