Galera Cluster Setup
Revision as of 16:13, 22 July 2016 by Michael.mast (talk | contribs)
- https://mariadb.com/kb/en/mariadb/yum/#installing-mariadb-galera-cluster-with-yum
- https://geekdudes.wordpress.com/2015/07/18/setting-up-failover-cluster-for-mariadb-on-centos-7/
- http://mrbriancollins.blogspot.com/2015/12/mariadb-101-galera-cluster-in-centos-7.html
- https://groups.google.com/forum/#!msg/codership-team/a5S0aExW2oI/fY5yBGdSWUYJ
Wow, it took way too long to figure out how to configure this. But before I forget here are the steps I took.
CentOS 7
First off, MariaDB now has Galera baked in so make sure to install the latest stable version. [root@db1 ~]# yum autoremove mariadb mariadb-server [root@db1 ~]# nano /etc/yum.repos.d/mariadb.repo
[mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.1.16/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
[root@db1 ~]# yum install MariaDB-server MariaDB-client [root@db1 ~]# systemctl start mysql [root@db1 ~]# mysql_secure_installation
- Create a root password and accept all other defaults. Later we will create the user account that will allow replication.
[root@db1 ~]# mysql -uroot -p
MariaDB [(none)]> grant all on *.* to 'root'@'%' identified by 'password'; MariaDB [(none)]> grant usage on *.* to 'cluster_user'@'%' identified by 'password2'; MariaDB [(none)]> grant all privileges on *.* to 'cluster_user'@'%'; MariaDB [(none)]> flush privileges; MariaDB [(none)]> exit [root@db1 ~]# systemctl stop mysql [root@db1 ~]# nano /etc/my.cnf.d/server.cnf <pre> # # * Galera-related settings # [galera] wsrep_on=ON wsrep_provider=/usr/lib64/galera/libgalera_smm.so wsrep_cluster_address=gcomm://10.200.3.2,10.200.3.3 wsrep_cluster_name='mariadb_cluster' wsrep_node_address='10.200.3.2' wsrep_sst_method=rsync wsrep_sst_auth=cluseruser:test binlog_format=row default_storage_engine=InnoDB innodb_autoinc_lock_mode=2 bind-address=0.0.0.0
[root@db1 ~]# [root@db1 ~]# [root@db1 ~]# [root@db1 ~]# [root@db1 ~]#