OS: RHEL7
database: MariaDB 10.1.13
firewalld: off
SElinux: off
===== Install MariaDB =====
default in your OS, it had mariadb include in yum repo but it was using old version.
Please add this repo to enable the latest version officially from MariaDB
# vim /etc/yum.repo.d/mariadb.repo
---------- mariadb.repo ----------
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/rhel7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
---------- END ----------
for the baseurl, if you are using centos or other, you can check it at here for the path
install mariadb using this command
# yum install mariadb-server
# yum install mariadb-server
===== Setup MaridDB for Cluster =====
open and edit my.cnf
add the section in red color
# vim /etc/my.cnf
---------- my.cnf ----------
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
[galera]
wsrep_on=ON
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
binlog_format=ROW
wsrep_cluster_address='gcomm://'
wsrep_cluster_name='galera_cluster'
wsrep_node_name='node1'
---------- END ----------
for the 2nd database, just repeat the installation step but at my.cnf you need to edit the
wsrep_cluster_address='gcomm://<node 1 IP address>'
wsrep_node_name='node2'
Start both databases
# systemctl start mariadb
login to mysql and you can check if it was success
MariaDB [(none)]> SHOW STATUS LIKE 'wsrep_cluster_size';
+--------------------+-------+
| Variable_name | Value |
+--------------------+-------+
| wsrep_cluster_size | 2 |
+--------------------+-------+
1 row in set (0.01 sec)
this shown above indicate got 2 node mean it was success.
you can check for other info using this command
MariaDB [(none)]> show global status like 'wsrep_%';
why you no need to install galera or socat?
ReplyDeletehttp://www.unixmen.com/setup-mariadb-galera-cluster-10-0-centos/
ok, i saw it install during i install the mariadb server
Deleteif you are using mariadb 5.5, you need to install separately. But start from mariadb 10, it has included as default.
Delete