3 node mariadb galera cluster, debian 7

by Andrew Calcutt last modified 2014-05-18T15:42:28+00:00

Reference Links

Getting Started with MariaDB Galera Clusterhttps://mariadb.com/kb/en/getting-started-with-mariadb-galera-cluster/
Installing MariaDB Galera Cluster on Debian/Ubuntuhttps://blog.mariadb.org/installing-mariadb-galera-cluster-on-debian-ubuntu/
Galera Cluster Best Practiceshttp://www.percona.com/files/presentations/percona-live/nyc-2012/PLNY12-galera-cluster-best-practices.pdf
Benchmarking Galera Clusterhttp://linsenraum.de/erkules_int/2014/01/ 
Firewall Settingshttp://galeracluster.com/documentation-webpages/firewallsettings.html
Email Notify Scripthttps://github.com/gguillen/galeranotify

Install Notes

1.) Add mariadb repository (https://downloads.mariadb.org/mariadb/repositories/#mirror=syringa)

2.) Install mariadb galera cluster

$ apt-get update
$ apt-get install mariadb-galera-server galera

3.) Make sure the following ports are open between your nodes

3306—MySQL client connections and mysqldump SST
4567—Galera Cluster replication traffic
4568—IST
4444—all SSTs besides mysqldump

4.) Add the following to my.cnf on each host of the cluster. 

------------------------------Host 1----------------------------------

[mariadb]
wsrep_cluster_address = "gcomm://node2.foo.bar,node3.foo.bar"
wsrep_provider=/usr/lib/galera/libgalera_smm.so
wsrep_sst_auth=repuser:supersecretpw
wsrep_cluster_name='cluster1'
wsrep_node_name=node1
wsrep_node_address=node1.foo.bar
wsrep_slave_threads=8
wsrep_provider_options="gcs.fc_limit=512"
wsrep_replicate_myisam=1
wsrep_notify_cmd='/opt/galeranotify/galeranotify.py' 

binlog_format=ROW
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
innodb_doublewrite=1
innodb_flush_log_at_trx_commit=2
query_cache_size=0
log-error=/var/log/mysql.log

------------------------------Host 2----------------------------------

[mariadb]
wsrep_cluster_address = "gcomm://node1.foo.bar,node3.foo.bar"
wsrep_provider=/usr/lib/galera/libgalera_smm.so
wsrep_sst_auth=repuser:supersecretpw
wsrep_cluster_name='cluster1'
wsrep_node_name=node2
wsrep_node_address=node2.foo.bar
wsrep_slave_threads=8
wsrep_provider_options="gcs.fc_limit=512"
wsrep_replicate_myisam=1
wsrep_notify_cmd='/opt/galeranotify/galeranotify.py' 

binlog_format=ROW
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
innodb_doublewrite=1
innodb_flush_log_at_trx_commit=2
query_cache_size=0
log-error=/var/log/mysql.log

------------------------------Host 3----------------------------------

[mariadb]
wsrep_cluster_address = "gcomm://node2.foo.bar,node1.foo.bar"
wsrep_provider=/usr/lib/galera/libgalera_smm.so
wsrep_sst_auth=repuser:supersecretpw
wsrep_cluster_name='cluster1'
wsrep_node_name=node3
wsrep_node_address=node3.foo.bar
wsrep_slave_threads=8
wsrep_provider_options="gcs.fc_limit=512"
wsrep_replicate_myisam=1
wsrep_notify_cmd='/opt/galeranotify/galeranotify.py' 

binlog_format=ROW
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
innodb_doublewrite=1
innodb_flush_log_at_trx_commit=2
query_cache_size=0
log-error=/var/log/mysql.log

 -----------------------------------------------------------------------

5.) on the first node in the cluster (the server that has your current mysql database), start a new cluster using 
$ mysqld --wsrep-new-cluster

6.) once the cluster has been started, start the other nodes. Start with "mysqld" to view what is happening, or use "service mysql start" and view the log at "/var/log/mysql.log"

test

Document Actions