Maria-db(mysql) two node installation with galera data replication

This is the first step toward unsupported installation of the NDC, New Data Cloud. To get the commercial version with full support, click here.

This document takes you through the installation and creation of a two node database installation. This install was done in google compute engine but with the right band width will work between data centers. It is an Enterprise class solution that has absolutely no license fees whatsoever. This document is provided without support or warranty.

The base configuration:

2 nodes 1 VCPU 3.7 GB running CentOS 7. This does not use the Maria-db that ships with CentOS 7, which is the free version of Red Hat Enterprise Linux.

instance-4 is primary node

instance-5 is failover node (replication target)

Install Mariadb repos. Cut and paste the repo text from the mariadb site.

install repos

 

 

 

 

 

 

 

 

 

 

 

 

This procedure is for version 10.1 (stable). Execute on both nodes.

cd /etc/my.cnf.d

modify server.cnf

server.cnf.active

 

 

 

 

 

 

 

 

 

#

# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#

# this is read by the standalone daemon and embedded servers
[server]

# this is only for the mysqld standalone daemon
[mysqld]
log_error=/var/log/mariadb.log

#
# * Galera-related settings
#
[galera]
# Mandatory settings
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
bind-address=0.0.0.0
wsrep_on=ON
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address=”gcomm://10.240.0.2,10.240.0.3″

## Galera Cluster Configuration
wsrep_cluster_name=’cluster1′
## Galera Synchronization Configuration
wsrep_sst_method=rsync
## Galera Node Configuration
wsrep_node_address=’10.240.0.2′
wsrep_node_name=’instance-4′
# this is only for embedded server
[embedded]

# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]

# This group is only read by MariaDB-10.1 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don’t understand
[mariadb-10.1]

On failover node edit the same file

instance-5.servercnf

 

#

# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#

# this is read by the standalone daemon and embedded servers
[server]

# this is only for the mysqld standalone daemon
[mysqld]

#
# * Galera-related settings
#

 

 

 

 

 

 

 

 

 

 

[galera]
# Mandatory settings
wsrep_on=ON
#wsrep_provider=
#wsrep_cluster_address=
#binlog_format=row
#default_storage_engine=InnoDB
#innodb_autoinc_lock_mode=2
#
# Allow server to accept connections on all interfaces.
#
#bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
#innodb_flush_log_at_trx_commit=0
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
innodb_locks_unsafe_for_binlog=1
query_cache_size=0
query_cache_type=0
bind-address=0.0.0.0
datadir=/var/lib/mysql
innodb_log_file_size=100M
innodb_file_per_table
innodb_flush_log_at_trx_commit=2
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address=”gcomm://10.240.0.2,10.240.0.3″
wsrep_cluster_name=’galera_cluster’
wsrep_node_address=’10.240.0.3′
wsrep_node_name=’db2′
wsrep_sst_method=rsync
wsrep_sst_auth=sst_user:SarBit@2010
#wsrep_on=ON
# this is only for embedded server
[embedded]

# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]

# This group is only read by MariaDB-10.1 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don’t understand
[mariadb-10.1]

On active node:

galera_new_cluster

echo $?

0

## Zero return code indicates successful new cluster starrt

systemctl status mariadb.service

activenode.status

 

 

 

 

 

 

 

 

 

On passive or replication node:

systemctl start mariadb.service

systemctl status mariadb.service

passive.node.status

 

 

 

 

Check the logs:

tail -f /var/log/mariadb.log

mariadblogs

 

 

 

 

 

 

 

 

 

 

To check galleria cluster status see this page.

You have an  Enterprise class active-passive database cluster.

You paid Oracle $0.