galera

Mysql

Cluster Galera

sources.list

https://downloads.mariadb.org/mariadb/repositories/#mirror=urbach&distro=Debian

Bootstrapping a new cluster

1
$ mysqld --wsrep-new-cluster &

Adding node to a cluster

1
$ mysqld --wsrep_cluster_address=gcomm://192.168.0.1  # DNS names work as well

Cluster state

1
mysql> show global status like '%wsrep%';

Cluster conf

[mysqld]

#mysql settings
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
bind-address=0.0.0.0

#galera settings
wsrep_on=ON
wsrep_provider=/usr/lib/galera/libgalera_smm.so
wsrep_cluster_name=”my_wsrep_cluster”
wsrep_cluster_address=”gcomm://172.16.8.5,172.16.8.6,172.16.8.4”
wsrep_sst_method=rsync

more conf

  • choose your donor
    wsrep_sst_donor=”10.0.100.10,10.0.100.8”

Doc

MariaDB

Troubleshooting

  • En cas de :

/usr//bin/wsrep_sst_rsync: 269: /usr//bin/wsrep_sst_rsync: [[: not found

remplacer /bin/sh par /bin/bash dans le shebang

  • Si le start timeout à cause d’une sync trop long

ajouter TimeoutStartSec=0 au [Service] systemd

  • Si tous les noeuds tombent en même temps.

~# mysqld –wsrep-cluster-address=”gcomm://“

  • Si aucun des noeud ne veut boostrap starter :

dans
/var/lib/mysql/grastate.dat

passer “safe_to_bootstrap: 0” à 1