Difference between revisions of "Galera Cluster Setup"
Jump to navigation
Jump to search
Michael.mast (talk | contribs) |
Michael.mast (talk | contribs) |
||
Line 7: | Line 7: | ||
<br> | <br> | ||
==CentOS 7== | ==CentOS 7== | ||
− | First off, MariaDB now has Galera baked in so make sure to install the latest stable version. | + | First off, MariaDB now has Galera baked in so make sure to install the latest stable version.<br> |
− | [root@db1 ~]# yum autoremove mariadb mariadb-server | + | [root@db1 ~]# yum autoremove mariadb mariadb-server<br> |
− | [root@db1 ~]# nano /etc/yum.repos.d/mariadb.repo | + | [root@db1 ~]# nano /etc/yum.repos.d/mariadb.repo<br> |
<pre> | <pre> | ||
[mariadb] | [mariadb] | ||
Line 17: | Line 17: | ||
gpgcheck=1 | gpgcheck=1 | ||
</pre> | </pre> | ||
− | [root@db1 ~]# yum install MariaDB-server MariaDB-client | + | [root@db1 ~]# yum install MariaDB-server MariaDB-client<br> |
− | [root@db1 ~]# systemctl start mysql | + | [root@db1 ~]# systemctl start mysql<br> |
− | [root@db1 ~]# mysql_secure_installation | + | [root@db1 ~]# mysql_secure_installation<br> |
− | *Create a root password and accept all other defaults. Later we will create the user account that will allow replication. | + | *Create a root password and accept all other defaults. Later we will create the user account that will allow replication.<br> |
− | [root@db1 ~]# mysql -uroot -p | + | [root@db1 ~]# mysql -uroot -p<br> |
<pre> | <pre> | ||
MariaDB [(none)]> grant all on *.* to 'root'@'%' identified by 'password'; | MariaDB [(none)]> grant all on *.* to 'root'@'%' identified by 'password'; | ||
Line 28: | Line 28: | ||
MariaDB [(none)]> flush privileges; | MariaDB [(none)]> flush privileges; | ||
MariaDB [(none)]> exit | MariaDB [(none)]> exit | ||
− | [root@db1 ~]# systemctl stop mysql | + | </pre> |
− | [root@db1 ~]# nano /etc/my.cnf.d/server.cnf | + | [root@db1 ~]# systemctl stop mysql<br> |
+ | [root@db1 ~]# nano /etc/my.cnf.d/server.cnf<br> | ||
<pre> | <pre> | ||
# | # | ||
Line 37: | Line 38: | ||
wsrep_on=ON | wsrep_on=ON | ||
wsrep_provider=/usr/lib64/galera/libgalera_smm.so | wsrep_provider=/usr/lib64/galera/libgalera_smm.so | ||
− | wsrep_cluster_address=gcomm:// | + | wsrep_cluster_address=gcomm://xxx.xxx.xxx.xxx,xxx.xxx.xxx.xxx #IPs of all nodes in cluster |
wsrep_cluster_name='mariadb_cluster' | wsrep_cluster_name='mariadb_cluster' | ||
− | wsrep_node_address=' | + | wsrep_node_address='xxx.xxx.xxxx.xxx' #IP of node1 |
wsrep_sst_method=rsync | wsrep_sst_method=rsync | ||
− | wsrep_sst_auth= | + | wsrep_sst_auth=cluster_user:password2 |
binlog_format=row | binlog_format=row | ||
default_storage_engine=InnoDB | default_storage_engine=InnoDB | ||
Line 47: | Line 48: | ||
bind-address=0.0.0.0 | bind-address=0.0.0.0 | ||
</pre> | </pre> | ||
− | [root@db1 ~]# | + | [root@db1 ~]#<br> |
− | [root@db1 ~]# | + | [root@db1 ~]#<br> |
− | [root@db1 ~]# | + | [root@db1 ~]#<br> |
− | [root@db1 ~]# | + | [root@db1 ~]#<br> |
− | [root@db1 ~]# | + | [root@db1 ~]#<br> |
Revision as of 16:16, 22 July 2016
- 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
# # * Galera-related settings # [galera] wsrep_on=ON wsrep_provider=/usr/lib64/galera/libgalera_smm.so wsrep_cluster_address=gcomm://xxx.xxx.xxx.xxx,xxx.xxx.xxx.xxx #IPs of all nodes in cluster wsrep_cluster_name='mariadb_cluster' wsrep_node_address='xxx.xxx.xxxx.xxx' #IP of node1 wsrep_sst_method=rsync wsrep_sst_auth=cluster_user:password2 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 ~]#