Labor Day: Let's upgrade a Galera Cluster

| Keine Kommentare | Keine TrackBacks

There are uprades for our Galera Cluster in the repository:

> yum info galera
Installed Packages
Name        : galera
Arch        : x86_64
Version     : 25.3.2
Release     : 1.rhel6
Size        : 29 M
Repo        : installed
From repo   : mariadb

Available Packages
Name        : galera
Arch        : x86_64
Version     : 25.3.5
Release     : 1.rhel6
Size        : 7.6 M
Repo        : mariadb

> yum info MariaDB-Galera-server
Installed Packages
Name        : MariaDB-Galera-server
Arch        : x86_64
Version     : 5.5.36
Release     : 1.el6
Size        : 102 M
Repo        : installed
From repo   : mariadb

Available Packages
Name        : MariaDB-Galera-server
Arch        : x86_64
Version     : 5.5.37
Release     : 1.el6
Size        : 25 M
Repo        : mariadb

Rolling Upgrade

Let’s do a Rolling Upgrade. This nice feature of Galera allows us to upgrade to the new version without taking the cluster offline.

This is done - like with MySQL NDB Cluster -

Ansible what the f*?!

I just use it for less interactive connectint to the nodes. It not needed at all. The following command connects to all nodes and ask for the MySQL version, size and state of the cluster.

$ ansible -i cluster.ini galera -a 'mysql -u root -e 
  "select version();SELECT * from INFORMATION_SCHEMA.GLOBAL_STATUS 
  WHERE VARIABLE_NAME  IN (\"wsrep_cluster_size\",\"wsrep_local_state_comment\")"'
galera01 | success | rc=0 >>
version()
5.5.36-MariaDB-wsrep
VARIABLE_NAME VARIABLE_VALUE
WSREP_LOCAL_STATE_COMMENT Synced
WSREP_CLUSTER_SIZE  3

galera02 | success | rc=0 >>
version()
5.5.36-MariaDB-wsrep-log
VARIABLE_NAME VARIABLE_VALUE
WSREP_LOCAL_STATE_COMMENT Synced
WSREP_CLUSTER_SIZE  3

galera03 | success | rc=0 >>
version()
5.5.36-MariaDB-wsrep
VARIABLE_NAME VARIABLE_VALUE
WSREP_LOCAL_STATE_COMMENT Synced
WSREP_CLUSTER_SIZE  3

As we see we run on a healthy 5.5.36-MariaDB-wsrep cluster.

What we do next is to upgrade one node after another. So upgrading one node:

$ ansible -i cluster.ini galera -l galera01 -a 'yum update -y  MariaDB-Galera-server galera'
galera01 | success | rc=0 >>
[snip]   
Installed:
  galera.x86_64 0:25.3.5-1.rhel6                                                

Updated:
  MariaDB-Galera-server.x86_64 0:5.5.37-1.el6                                   

Replaced:
  galera.x86_64 0:25.3.2-1.rhel6                                                

Complete!

And checking if the cluster is still fine:

$ ansible -i cluster.ini galera -a 'mysql -u root -e 
  "select version();SELECT * from INFORMATION_SCHEMA.GLOBAL_STATUS 
  WHERE VARIABLE_NAME IN (\"wsrep_cluster_size\",\"wsrep_local_state_comment\")"'
galera01 | success | rc=0 >>
version()
5.5.37-MariaDB-wsrep
VARIABLE_NAME VARIABLE_VALUE
WSREP_LOCAL_STATE_COMMENT Synced
WSREP_CLUSTER_SIZE  3

galera03 | success | rc=0 >>
version()
5.5.36-MariaDB-wsrep
VARIABLE_NAME VARIABLE_VALUE
WSREP_LOCAL_STATE_COMMENT Synced
WSREP_CLUSTER_SIZE  3

galera02 | success | rc=0 >>
version()
5.5.36-MariaDB-wsrep-log
VARIABLE_NAME VARIABLE_VALUE
WSREP_LOCAL_STATE_COMMENT Synced
WSREP_CLUSTER_SIZE  3

Great we got already one node upgraded. The procedure for the other two nodes is the same. (Always upgrade one node after another and check each node has upgraded fine.) So it is skipped and we make the final test:

$ ansible -i cluster.ini galera -a 'mysql -u root -e 
  "select version();SELECT * from INFORMATION_SCHEMA.GLOBAL_STATUS 
  WHERE VARIABLE_NAME IN (\"wsrep_cluster_size\",\"wsrep_local_state_comment\")"'
galera01 | success | rc=0 >>
version()
5.5.37-MariaDB-wsrep
VARIABLE_NAME VARIABLE_VALUE
WSREP_LOCAL_STATE_COMMENT Synced
WSREP_CLUSTER_SIZE  3

galera03 | success | rc=0 >>
version()
5.5.37-MariaDB-wsrep
VARIABLE_NAME VARIABLE_VALUE
WSREP_LOCAL_STATE_COMMENT Synced
WSREP_CLUSTER_SIZE  3

galera02 | success | rc=0 >>
version()
5.5.37-MariaDB-wsrep-log
VARIABLE_NAME VARIABLE_VALUE
WSREP_LOCAL_STATE_COMMENT Synced
WSREP_CLUSTER_SIZE  3

Thats a damn easy Rolling Upgrade \o/

Epilog

I generally recommend to get the node you upgrade out of the proxy.

echo "disable server galera_server/galera03" | nc -U /var/run/haproxy.sock
Upgrade Steps galera03
echo "enable server galera_server/galera03" | nc -U /var/run/haproxy.sock

Epilog2

Works with PXC too ;)

Update: sed /enable/disable/

Keine TrackBacks

TrackBack-URL: http://linsenraum.de/mt/mt-tb.cgi/319

Jetzt kommentieren

Über diese Seite

Diese Seite enthält einen einen einzelnen Eintrag von erkan vom 2.05.14 0:58.

FYI: Galera is just a provider ist der vorherige Eintrag in diesem Blog.

2xHipster (Docker and Galera) doesn't mean its good. ist der nächste Eintrag in diesem Blog.

Aktuelle Einträge finden Sie auf der Startseite, alle Einträge in den Archiven.

Seiten

Powered by Movable Type 4.23-en