[MariaDB]: Configuring & setting-up Galera Cluster.
MariaDB
MariaDB is a community-developed fork of the MySQL relational database management system, the impetus being the community maintenance of its free status under the GNU GPL. Being a fork of a leading open source software system, it is notable for being led by its original developers and triggered by concerns over direction by an acquiring commercial company Oracle. Contributors are required to share their copyright with Monty Program AB.
The intent is also to maintain high compatibility with MySQL, ensuring a “drop-in” replacement capability with library binary equivalency and exact matching with MySQL APIs and commands. It includes the XtraDB storage engine for replacing InnoDB, as well as a new storage engine, Aria, that intends to be both a transactional and non-transactional engine perhaps even included in future versions of MySQL.
Configuring Galera
Once installation is complete, you will need to configure Galera by updating your Mysql configuration.
Please find the location of the libgalera_smm.so file with the following command.
[ root @ hostname-1 : /var/lib/mysql ] find / -name libgalera_smm.so
/mariadb/mariadb-galera-10.0.20-linux-x86_64/lib/plugin/libgalera_smm.so
10.xx.xx.101 (hostname-1) —> Primary Node
10.xx.xx.102 (hostname-2) —> Secondary Node
10.xx.xx.103(hostname-3) —> Secondary Node
Configure my.cnf on all the above three nodes as below, please note to change # Galera Node Configuration section & your libgalera_smm.so file as per your node.
[ root @ hostname-1 : ~ ] cat /etc/my.cnf
[mysqld]
query_cache_size=0
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
query_cache_type=0
bind-address=0.0.0.0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Galera Provider Configuration
wsrep_provider=/mariadb/mariadb-galera-10.0.20-linux-x86_64/lib/plugin/libgalera_smm.so
wsrep_provider_options=”gcache.size=32G”
# Galera Cluster Configuration
wsrep_cluster_name=”MariaDB_Cluster”
wsrep_cluster_address=”gcomm://10.xx.xx.101,10.xx.xx.102,10.xx.xx.103″
#wsrep_cluster_address=”gcomm://10.xx.xx.101″
# Galera Synchronization Congifuration
wsrep_sst_method=rsync
# Galera Node Configuration
wsrep_node_address=”10.xx.xx.101″
wsrep_node_name=”hostname-1″
[ root @ hostname-1 : ~ ]
Also set bootstrap enabled for Primary as below.
mysql> SET GLOBAL wsrep_provider_options=’pc.bootstrap=true’;
Query OK, 0 rows affected (0.02 sec)
[ root @ hostname-2 : /var/lib/mysql ] cat /etc/my.cnf
[mysqld]
query_cache_size=0
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
query_cache_type=0
bind-address=0.0.0.0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Galera Provider Configuration
wsrep_provider=/mariadb/mariadb-galera-10.0.20-linux-x86_64/lib/plugin/libgalera_smm.so
wsrep_provider_options=”gcache.size=32G”
# Galera Cluster Configuration
wsrep_cluster_name=”MariaDB_Cluster”
wsrep_cluster_address=”gcomm://10.xx.xx.101,10.xx.xx.102,10.xx.xx.103″
# Galera Synchronization Congifuration
wsrep_sst_method=rsync
# Galera Node Configuration
wsrep_node_address=”10.xx.xx.102″
wsrep_node_name=”hostname-2″
[ root @ hostname-2 : /var/lib/mysql ]
[ root @ hostname-3 : /var/lib/mysql ] cat /etc/my.cnf
[mysqld]
query_cache_size=0
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
query_cache_type=0
bind-address=0.0.0.0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Galera Provider Configuration
wsrep_provider=/mariadb/mariadb-galera-10.0.20-linux-x86_64/lib/plugin/libgalera_smm.so
wsrep_provider_options=”gcache.size=32G”
# Galera Cluster Configuration
wsrep_cluster_name=”MariaDB_Cluster”
wsrep_cluster_address=”gcomm://10.xx.xx.101,10.xx.xx.102,10.xx.xx.103″
# Galera Synchronization Congifuration
wsrep_sst_method=rsync
# Galera Node Configuration
wsrep_node_address=”10.xx.xx.103″
wsrep_node_name=”hostname-3″
[ root @ hostname-3 : /var/lib/mysql ]
[ root @ hostname-1 : ~ ] cd /mariadb/mariadb-galera-10.0.20-linux-x86_64
[ root @ hostname-1 : /mariadb/mariadb-galera-10.0.20-linux-x86_64 ] ll -lhrt
total 228K
-rw-r–r– 1 1021 1004 20K Jun 24 23:31 README-wsrep
-rw-r–r– 1 1021 1004 91K Jun 24 23:31 README
-rw-r–r– 1 1021 1004 8.5K Jun 24 23:31 INSTALL-BINARY
-rw-r–r– 1 1021 1004 8.1K Jun 24 23:31 EXCEPTIONS-CLIENT
-rw-r–r– 1 1021 1004 1.6K Jun 24 23:31 CREDITS
-rw-r–r– 1 1021 1004 26K Jun 24 23:31 COPYING.LESSER
-rw-r–r– 1 1021 1004 18K Jun 24 23:31 COPYING
drwxrwxr-x 3 1021 1004 4.0K Jun 26 11:39 include
drwxrwxr-x 28 1021 1004 4.0K Jun 26 11:39 share
drwxrwxr-x 11 1021 1004 4.0K Jun 26 11:39 mysql-test
drwxrwxr-x 3 1021 1004 4.0K Jun 26 11:39 support-files
drwxrwxr-x 4 1021 1004 4.0K Jun 26 11:39 sql-bench
drwxrwxr-x 2 1021 1004 4.0K Jun 26 11:39 scripts
drwxrwxr-x 4 1021 1004 4.0K Jun 26 11:39 man
drwxrwxr-x 3 1021 1004 4.0K Jun 26 11:39 lib
drwxrwxr-x 2 1021 1004 4.0K Jun 26 11:39 bin
drwxrwxr-x 2 mysql 1004 4.0K Sep 8 06:05 data
[ root @ hostname-1 : /mariadb/mariadb-galera-10.0.20-linux-x86_64 ]
[ root @ hostname-1 : /mariadb/mariadb-galera-10.0.20-linux-x86_64 ]
[ root @ hostname-1 : /mariadb/mariadb-galera-10.0.20-linux-x86_64 ]
[ root @ hostname-1 : /mariadb/mariadb-galera-10.0.20-linux-x86_64 ] cd /var/lib/mysql/
[ root @ hostname-1 : /var/lib/mysql ]
[ root @ hostname-1 : /var/lib/mysql ]
[ root @ hostname-1 : /var/lib/mysql ] ll -lhrt
total 33G
drwx—— 2 mysql root 4.0K Sep 8 08:07 test
-rw-rw—- 1 mysql mysql 48M Sep 8 08:07 ib_logfile1
drwx—— 2 mysql root 4.0K Sep 8 08:07 mysql
drwx—— 2 mysql mysql 4.0K Sep 8 08:07 performance_schema
-rw-rw—- 1 mysql mysql 52 Sep 8 08:07 aria_log_control
-rw-rw—- 1 mysql mysql 16K Sep 8 08:07 aria_log.00000001
-rw-rw—- 1 mysql mysql 6 Sep 8 08:08 hostname-1.pid
srwxrwxrwx 1 mysql mysql 0 Sep 8 08:08 mysql.sock
-rw-rw—- 1 mysql mysql 0 Sep 8 08:08 multi-master.info
-rw-rw—- 1 mysql mysql 39 Sep 8 08:43 rsync_sst_complete
-rw-rw—- 1 mysql mysql 265 Sep 8 08:48 gvwstate.dat
-rw-r—– 1 mysql root 33K Sep 8 08:48 hostname-1.err
-rw——- 1 mysql mysql 33G Sep 8 08:55 galera.cache
drwx—— 2 mysql mysql 4.0K Sep 8 08:55 galera_cluster_db
-rw-rw—- 1 mysql mysql 104 Sep 8 08:55 grastate.dat
-rw-rw—- 1 mysql mysql 12M Sep 8 08:55 ibdata1
-rw-rw—- 1 mysql mysql 48M Sep 8 08:55 ib_logfile0
[ root @ hostname-1 : /var/lib/mysql ]
[ root @ hostname-1 : /var/lib/mysql ]
[ root @ hostname-1 : /var/lib/mysql ]
Prerequisites : Install all the below packages which are required for this cluster setup.
Rsync
Nc
Openssl
gcc
lsof
Start the Cluster
To begin, we need to stop the running MariaDB service so that our cluster can be brought online.
service mysql stop
When all processes have ceased running, you must start up your first node again with a special parameter:
cp /mariadb/mariadb-galera-10.0.20-linux-x86_64/support-files/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
chkconfig –add mysql
chkconfig –level 345 mysql on
diff /mariadb/mariadb-galera-10.0.20-linux-x86_64/support-files/mysql.server /etc/init.d/mysql
/mariadb/mariadb-galera-10.0.20-linux-x86_64/scripts/mysql_install_db –user=mysql &
service mysql start –wsrep-new-cluster (For Primary node)
With our cluster configuration, each node that comes online tries to connect to at least one other node specified in its configuration file to get its initial state. Without the –wsrep-new-cluster parameter, this command would fail because the first node is unable to connect with any other nodes.
On each of the other nodes, you can now start MariaDB as you normally would. They will search for any member of the cluster list that is online. When they find the first node, they will join the cluster.
/mariadb/mariadb-galera-10.0.20-linux-x86_64/bin/mysqld –user=mysql & (For Secondary Nodes)
As soon as you start Primary, you’ll see one member added to below gvwstste file.
root @ hostname-1 : /var/lib/mysql ] cat /var/lib/mysql/gvwstate.dat
my_uuid: 40304469-5622-11e5-ba28-5b47750e1e39
#vwbeg
view_id: 3 40304469-5622-11e5-ba28-5b47750e1e39 5
bootstrap: 0
member: 40304469-5622-11e5-ba28-5b47750e1e39 0
#vwend
[ root @ hostname-1 : /var/lib/mysql ]
You’ll see logs as below as soon as you start secondary nodes.
[ root @ hostname-1 : /mariadb/mariadb-galera-10.0.20-linux-x86_64 ] tailf /var/lib/mysql/hostname-1.err
protocols = 0/7/3 (gcs/repl/appl),
group UUID = 4031282f-5622-11e5-af40-a61e4588a5fb
150908 8:43:46 [Note] WSREP: Flow-control interval: [23, 23]
150908 8:43:46 [Note] WSREP: New cluster view: global state: 4031282f-5622-11e5-af40-a61e4588a5fb:0, view# 10: Primary, number of nodes: 2, my index: 1, protocol version 3
150908 8:43:46 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.
150908 8:43:46 [Note] WSREP: REPL Protocols: 7 (3, 2)
150908 8:43:46 [Note] WSREP: Service thread queue flushed.
150908 8:43:46 [Note] WSREP: Assign initial position for certification: 0, protocol version: 3
150908 8:43:46 [Note] WSREP: Service thread queue flushed.
150908 8:43:51 [Note] WSREP: cleaning up 3b1c75cb (tcp://10.xx.xx.103:4567)
150908 8:45:51 [Note] WSREP: declaring 2a1c241b at tcp://10.xx.xx.102:4567 stable
150908 8:45:51 [Note] WSREP: declaring 88a8029e at tcp://10.xx.xx.103:4567 stable
150908 8:45:51 [Note] WSREP: Node 2a1c241b state prim
150908 8:45:51 [Note] WSREP: view(view_id(PRIM,2a1c241b,11) memb {
2a1c241b,0
40304469,0
88a8029e,0
} joined {
} left {
} partitioned {
})
150908 8:45:51 [Note] WSREP: save pc into disk
150908 8:45:51 [Note] WSREP: New COMPONENT: primary = yes, bootstrap = no, my_idx = 1, memb_num = 3
150908 8:45:51 [Note] WSREP: STATE EXCHANGE: Waiting for state UUID.
150908 8:45:51 [Note] WSREP: STATE EXCHANGE: sent state msg: 8953b2f8-5627-11e5-aadd-773b33489a75
150908 8:45:51 [Note] WSREP: STATE EXCHANGE: got state msg: 8953b2f8-5627-11e5-aadd-773b33489a75 from 1 (hostname-1)
150908 8:45:51 [Note] WSREP: STATE EXCHANGE: got state msg: 8953b2f8-5627-11e5-aadd-773b33489a75 from 0 (hostname-2)
150908 8:45:51 [Note] WSREP: STATE EXCHANGE: got state msg: 8953b2f8-5627-11e5-aadd-773b33489a75 from 2 (hostname-3)
150908 8:45:51 [Note] WSREP: Quorum results:
version = 3,
component = PRIMARY,
conf_id = 10,
members = 2/3 (joined/total),
act_id = 0,
last_appl. = 0,
protocols = 0/7/3 (gcs/repl/appl),
group UUID = 4031282f-5622-11e5-af40-a61e4588a5fb
150908 8:45:51 [Note] WSREP: Flow-control interval: [28, 28]
150908 8:45:51 [Note] WSREP: New cluster view: global state: 4031282f-5622-11e5-af40-a61e4588a5fb:0, view# 11: Primary, number of nodes: 3, my index: 1, protocol version 3
150908 8:45:51 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.
150908 8:45:51 [Note] WSREP: REPL Protocols: 7 (3, 2)
150908 8:45:51 [Note] WSREP: REPL Protocols: 7 (3, 2)
150908 8:45:51 [Note] WSREP: Service thread queue flushed.
150908 8:45:51 [Note] WSREP: Assign initial position for certification: 0, protocol version: 3
150908 8:45:51 [Note] WSREP: Service thread queue flushed.
150908 8:45:53 [Note] WSREP: (40304469, ‘tcp://0.0.0.0:4567’) turning message relay requesting off
150908 8:45:54 [Note] WSREP: declaring 2a1c241b at tcp://10.xx.xx.102:4567 stable
150908 8:45:54 [Note] WSREP: forgetting 88a8029e (tcp://10.xx.xx.103:4567)
150908 8:45:54 [Note] WSREP: forgetting 88a8029e (tcp://10.xx.xx.103:4567)
150908 8:45:54 [Note] WSREP: Node 2a1c241b state prim
150908 8:45:54 [Note] WSREP: view(view_id(PRIM,2a1c241b,12) memb {
2a1c241b,0
40304469,0
} joined {
} left {
} partitioned {
88a8029e,0
})
150908 8:45:54 [Note] WSREP: save pc into disk
150908 8:45:54 [Note] WSREP: forgetting 88a8029e (tcp://10.xx.xx.103:4567)
150908 8:45:54 [Note] WSREP: New COMPONENT: primary = yes, bootstrap = no, my_idx = 1, memb_num = 2
150908 8:45:54 [Note] WSREP: STATE EXCHANGE: Waiting for state UUID.
150908 8:45:54 [Note] WSREP: STATE EXCHANGE: sent state msg: 8b605160-5627-11e5-b6bb-3332ac17ebeb
150908 8:45:54 [Note] WSREP: STATE EXCHANGE: got state msg: 8b605160-5627-11e5-b6bb-3332ac17ebeb from 0 (hostname-2)
150908 8:45:54 [Note] WSREP: STATE EXCHANGE: got state msg: 8b605160-5627-11e5-b6bb-3332ac17ebeb from 1 (hostname-1)
150908 8:45:54 [Note] WSREP: Quorum results:
version = 3,
component = PRIMARY,
conf_id = 11,
members = 2/2 (joined/total),
act_id = 0,
last_appl. = 0,
protocols = 0/7/3 (gcs/repl/appl),
group UUID = 4031282f-5622-11e5-af40-a61e4588a5fb
150908 8:45:54 [Note] WSREP: Flow-control interval: [23, 23]
150908 8:45:54 [Note] WSREP: Flow-control interval: [23, 23]
150908 8:45:54 [Note] WSREP: New cluster view: global state: 4031282f-5622-11e5-af40-a61e4588a5fb:0, view# 12: Primary, number of nodes: 2, my index: 1, protocol version 3
150908 8:45:54 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.
150908 8:45:54 [Note] WSREP: REPL Protocols: 7 (3, 2)
150908 8:45:54 [Note] WSREP: Service thread queue flushed.
150908 8:45:54 [Note] WSREP: Assign initial position for certification: 0, protocol version: 3
150908 8:45:54 [Note] WSREP: Service thread queue flushed.
150908 8:45:59 [Note] WSREP: cleaning up 88a8029e (tcp://10.xx.xx.103:4567)
150908 8:48:02 [Note] WSREP: (40304469, ‘tcp://0.0.0.0:4567’) turning message relay requesting on, nonlive peers: tcp://10.xx.xx.103:4567
150908 8:48:04 [Note] WSREP: declaring 2a1c241b at tcp://10.xx.xx.102:4567 stable
150908 8:48:04 [Note] WSREP: declaring d73d4439 at tcp://10.xx.xx.103:4567 stable
150908 8:48:05 [Note] WSREP: Node 2a1c241b state prim
150908 8:48:05 [Note] WSREP: view(view_id(PRIM,2a1c241b,13) memb {
2a1c241b,0
40304469,0
d73d4439,0
} joined {
} left {
} partitioned {
})
150908 8:48:05 [Note] WSREP: save pc into disk
150908 8:48:05 [Note] WSREP: (40304469, ‘tcp://0.0.0.0:4567’) turning message relay requesting off
150908 8:48:05 [Note] WSREP: New COMPONENT: primary = yes, bootstrap = no, my_idx = 1, memb_num = 3
150908 8:48:05 [Note] WSREP: STATE EXCHANGE: Waiting for state UUID.
150908 8:48:05 [Note] WSREP: STATE EXCHANGE: sent state msg: d9185526-5627-11e5-a86a-f7b39076a80b
150908 8:48:05 [Note] WSREP: STATE EXCHANGE: got state msg: d9185526-5627-11e5-a86a-f7b39076a80b from 0 (hostname-2)
150908 8:48:05 [Note] WSREP: STATE EXCHANGE: got state msg: d9185526-5627-11e5-a86a-f7b39076a80b from 1 (hostname-1)
150908 8:48:05 [Note] WSREP: STATE EXCHANGE: got state msg: d9185526-5627-11e5-a86a-f7b39076a80b from 2 (hostname-3)
150908 8:48:05 [Note] WSREP: Quorum results:
version = 3,
component = PRIMARY,
conf_id = 12,
members = 2/3 (joined/total),
act_id = 0,
last_appl. = 0,
protocols = 0/7/3 (gcs/repl/appl),
group UUID = 4031282f-5622-11e5-af40-a61e4588a5fb
150908 8:48:05 [Note] WSREP: Flow-control interval: [28, 28]
150908 8:48:05 [Note] WSREP: New cluster view: global state: 4031282f-5622-11e5-af40-a61e4588a5fb:0, view# 13: Primary, number of nodes: 3, my index: 1, protocol version 3
150908 8:48:05 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.
150908 8:48:05 [Note] WSREP: REPL Protocols: 7 (3, 2)
150908 8:48:05 [Note] WSREP: Service thread queue flushed.
150908 8:48:05 [Note] WSREP: Assign initial position for certification: 0, protocol version: 3
150908 8:48:05 [Note] WSREP: Service thread queue flushed.
150908 8:48:05 [Note] WSREP: Member 2.0 (hostname-3) requested state transfer from ‘*any*’. Selected 0.0 (hostname-2)(SYNCED) as donor.
150908 8:48:13 [Note] WSREP: 0.0 (hostname-2): State transfer to 2.0 (hostname-3) complete.
150908 8:48:13 [Note] WSREP: Member 0.0 (hostname-2) synced with group.
150908 8:48:15 [Note] WSREP: 2.0 (hostname-3): State transfer from 0.0 (hostname-2) complete.
150908 8:48:15 [Note] WSREP: Member 2.0 (hostname-3) synced with group.
[ root @ hostname-1 : /var/lib/mysql ] cat gvwstate.dat`
my_uuid: 40304469-5622-11e5-ba28-5b47750e1e39
#vwbeg
view_id: 3 2a1c241b-5627-11e5-a41a-bab3d8f094f6 13
bootstrap: 0
member: 2a1c241b-5627-11e5-a41a-bab3d8f094f6 0
member: 40304469-5622-11e5-ba28-5b47750e1e39 0
member: d73d4439-5627-11e5-af5a-abb838215971 0
#vwend
[ root @ hostname-1 : /var/lib/mysql ]
[ root @ hostname-2 : /var/lib/mysql ] cat grastate.dat
# GALERA saved state
version: 2.1
uuid: 4031282f-5622-11e5-af40-a61e4588a5fb
seqno: -1
cert_index:
[ root @ hostname-2 : /var/lib/mysql ]
[ root @ hostname-2 : /var/lib/mysql ]
[ root @ hostname-2 : /var/lib/mysql ] cat gvwstate.dat
my_uuid: 2a1c241b-5627-11e5-a41a-bab3d8f094f6
#vwbeg
view_id: 3 2a1c241b-5627-11e5-a41a-bab3d8f094f6 13
bootstrap: 0
member: 2a1c241b-5627-11e5-a41a-bab3d8f094f6 0
member: 40304469-5622-11e5-ba28-5b47750e1e39 0
member: d73d4439-5627-11e5-af5a-abb838215971 0
#vwend
[ root @ hostname-2 : /var/lib/mysql ]
To test replication, execute below commands on Primary
CREATE TABLE galera_cluster_db.galera_cluster_tbl (
id INT NOT NULL AUTO_INCREMENT,
type VARCHAR(50),
quant INT,
color VARCHAR(25),
PRIMARY KEY(id));
INSERT INTO galera_cluster_db.galera_cluster_tbl (type, quant, color) VALUES (“slide”, 2, “blue”);
SELECT * FROM galera_cluster_db.galera_cluster_tbl;
[ root @ hostname-1 : /var/lib/mysql ] mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 5.5.5-10.0.20-MariaDB-wsrep MariaDB Server, wsrep_25.10.r4144
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> SHOW global STATUS LIKE “wsrep%”;
+——————————+————————————–+
| Variable_name | Value |
+——————————+————————————–+
| wsrep_local_state_uuid | 4031282f-5622-11e5-af40-a61e4588a5fb |
| wsrep_protocol_version | 7 |
| wsrep_last_committed | 0 |
| wsrep_replicated | 0 |
| wsrep_replicated_bytes | 0 |
| wsrep_repl_keys | 0 |
| wsrep_repl_keys_bytes | 0 |
| wsrep_repl_data_bytes | 0 |
| wsrep_repl_other_bytes | 0 |
| wsrep_received | 6 |
| wsrep_received_bytes | 868 |
| wsrep_local_commits | 0 |
| wsrep_local_cert_failures | 0 |
| wsrep_local_replays | 0 |
| wsrep_local_send_queue | 0 |
| wsrep_local_send_queue_max | 1 |
| wsrep_local_send_queue_min | 0 |
| wsrep_local_send_queue_avg | 0.000000 |
| wsrep_local_recv_queue | 0 |
| wsrep_local_recv_queue_max | 1 |
| wsrep_local_recv_queue_min | 0 |
| wsrep_local_recv_queue_avg | 0.000000 |
| wsrep_local_cached_downto | 18446744073709551615 |
| wsrep_flow_control_paused_ns | 0 |
| wsrep_flow_control_paused | 0.000000 |
| wsrep_flow_control_sent | 0 |
| wsrep_flow_control_recv | 0 |
| wsrep_cert_deps_distance | 0.000000 |
| wsrep_apply_oooe | 0.000000 |
| wsrep_apply_oool | 0.000000 |
| wsrep_apply_window | 0.000000 |
| wsrep_commit_oooe | 0.000000 |
| wsrep_commit_oool | 0.000000 |
| wsrep_commit_window | 0.000000 |
| wsrep_local_state | 4 |
| wsrep_local_state_comment | Synced |
| wsrep_cert_index_size | 0 |
| wsrep_causal_reads | 0 |
| wsrep_cert_interval | 0.000000 |
| wsrep_incoming_addresses | 10.xx.xx.101:3306 |
| wsrep_evs_delayed | |
| wsrep_evs_evict_list | |
| wsrep_evs_repl_latency | 0/0/0/0/0 |
| wsrep_evs_state | OPERATIONAL |
| wsrep_gcomm_uuid | 40304469-5622-11e5-ba28-5b47750e1e39 |
| wsrep_cluster_conf_id | 5 |
| wsrep_cluster_size | 1 |
| wsrep_cluster_state_uuid | 4031282f-5622-11e5-af40-a61e4588a5fb |
| wsrep_cluster_status | Primary |
| wsrep_connected | ON |
| wsrep_local_bf_aborts | 0 |
| wsrep_local_index | 0 |
| wsrep_provider_name | Galera |
| wsrep_provider_vendor | Codership Oy <info@codership.com> |
| wsrep_provider_version | 25.3.9(r3387) |
| wsrep_ready | ON |
| wsrep_thread_count | 2 |
+——————————+————————————–+
57 rows in set (0.04 sec)
mysql>
[ root @ hostname-1 : ~ ] mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 111
Server version: 5.5.5-10.0.20-MariaDB-wsrep MariaDB Server, wsrep_25.10.r4144
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql>
mysql>
mysql>
mysql>
mysql> show databases;
+——————–+
| Database |
+——————–+
| galera_cluster_db |
| information_schema |
| mysql |
| performance_schema |
| test |
+——————–+
5 rows in set (0.00 sec)
mysql>
mysql>
mysql>
mysql> select * from galera_cluster_db.galera_cluster_tbl;
+—-+——-+——-+——-+
| id | type | quant | color |
+—-+——-+——-+——-+
| 2 | slide | 2 | blue |
+—-+——-+——-+——-+
1 row in set (0.00 sec)
mysql>
mysql>
At secondaries :
[ root @ hostname-3 : /var/lib/mysql ] mysql –socket /var/lib/mysql/mysql.sock -e ” select * from galera_cluster_db.galera_cluster_tbl;”
+—-+——-+——-+——-+
| id | type | quant | color |
+—-+——-+——-+——-+
| 2 | slide | 2 | blue |
+—-+——-+——-+——-+
[ root @ hostname-3 : /var/lib/mysql ]
[ root @ hostname-2 : /var/lib/mysql ] mysql –socket /var/lib/mysql/mysql.sock -e ” select * from galera_cluster_db.galera_cluster_tbl;”
+—-+——-+——-+——-+
| id | type | quant | color |
+—-+——-+——-+——-+
| 2 | slide | 2 | blue |
+—-+——-+——-+——-+
[ root @ hostname-2 : /var/lib/mysql ]
Reference Links :
http://galeracluster.com/documentation-webpages/?id=galera_parameters
https://www.digitalocean.com/community/tutorials/how-to-configure-a-galera-cluster-with-mariadb-on-ubuntu-12-04-servers
https://www.percona.com/blog/2014/09/01/galera-replication-how-to-recover-a-pxc-cluster/