Monitoring Galera With MONyog

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

w:

www.mariadb.com

e: [email protected]


Monitoring Galera with MONyog

Abstract
This white paper introduces the drawbacks of traditional MySQL High Availability set ups and suggests
a modern, best-in-class High Availability solution utilising MONyog and Galera. The basics of Galera
and MONyog are explained, and the steps to setting up the combined solution is gone through step-
by-step.

1 Introduction
A key aspect of managing a database system is being able to monitor it, review the key parameters and
performance metrics over time, send alerts when there are issues and identify bottlenecks. One of the
most well-known and respected products for monitoring MySQL is MONyog. For customers with a
support subscription from MariaDB, MONyog is a key differentiator.. Similarly, High Availability (HA) of
database systems have matured and become much more affordable, now providing 24x7 database
connectivity for your mission-critical applications. In the past, MySQL HA was based on expensive,
legacy availability solutions that used physical storage or MySQL Replication. Both of these solutions
have drawbacks:
Whilst a storage-based solution offers redundancy of the physical media it does not allow more
than one MySQL instance to access storage at the same time. This makes for slow failover.
MySQL Replication uses a complex Asynchronous or Semi-synchronous setup. This means that
failover has to wait for the replication to catch up. Allowing multiple masters when using
MySQL Replication is possible, but it can be unreliable and there is no conflict detection.
At MariaDB, we believe that MONyog combined with Galera overcomes this issues to provide a
modern, best-in-class High Availability solution for MySQL users.

2 Introduction to High Availability with Galera


Galera uses a software-only configuration that provides the same level of data assurance as a Storage
Based solution, but is tightly integrated with MySQL so setting up and managing a Galera-based cluster
is easy.

Galera does the actual replication externally to MySQL, but this is just a library that is called from the
database server, so there are no new servers to run. Configuring Galera takes place in the same way as
configuring MySQL - by using a my.cnf file.

Galera creates a true cluster which is different from using MySQL Replication, for example, where the
different nodes are largely autonomous. With Galera, all nodes know about each other, they exchange
information and perform arbitration so that quorum is achieved and split-brain situations are avoided.

The status of a Galera cluster is provided in the same way as for MySQL variables and status, i.e. by
running the commands SHOW VARIABLES and SHOW STATUS.

Galera also supports Conflict Resolution using Optimistic Locking, providing low latency and consistent
data, while maintaining high performance.
File Name: Monitoring Galera With MONyog.docx Page 1

w: www.mariadb.com

e: [email protected]

3 Introduction to MONyog
MONyog is a powerful tool for monitoring MySQL and related database technologies. It includes
features that store performance data and settings, customize the data that is retrieved, graph data
over time and send alerts. Its also contains a knowledge base so a user of the system is understands
what all the metrics mean and, when there is an alert, suggest appropriate actions.

Since it runs as a web service, MONyog is accessible from any browser, which limits installation
requirements to one machine only.

Written in C/C++ in the lower layers, MONyogs user Interface is AJAX-based to allow for responsive
and effective interaction.

MONyog is also user-extensible and exposes its data as JavaScript. This means that adding user-defined
objects is easy and uses familiar technologies.

Best of all, MONyog is already pre-configured to handle monitoring of a Galera-based MySQL cluster.

4 Monitoring MySQL / MariaDB Galera Cluster with MONyog


The following assumes that you have already installed and started MONYog (version 5.53 or later), and
you have a few Galera enabled MySQL servers running. In the examples shown here, we will use a
simple Galera Cluster with just 2 nodes, ClusterNode41 and ClusterNode42.

4.1 Enable the Galera monitors in MONyog


Monitoring Galera has been supported by MONyog for some time but it is not enabled by default so to
get started we need to enable Galera monitoring:
Log into MONyog and click in the Customize button at the top left of the window.
You now see a two lists of monitor groups, the enabled ones to the left and the disabled to the
right.
Select the Galera monitor group in the left-hand list and then click the button Enable in
between the two lists.


File Name: Monitoring Galera With MONyog.docx Page 2

w: www.mariadb.com

e: [email protected]


With the monitors in place, we can now start to do some more interesting things.

4.2 Creating Galera Dashboard graphs


One of the first things you will probably want is to have a graph on the health of your MySQL cluster.
Right now the Galera component of MONyog only contains monitors, but creating graphs is easy. Lets
create a graph that shows if there is a bottleneck in the replication between the Galera nodes, which
can be seen by monitoring the status variable wsrep_local_send_queue_avg:
Go to the Dashboard pane and then click on the cogwheel settings icon on the top right and
select Add new Dashboard Chart.
Then you set the Caption of the chart and the graph (there is just 1) and then the tricky bit, the
value to monitor (in Series Values):
[MONyog.MySQL.GlobalStatus.wsrep_local_send_queue_avg].
Finally, you probably want to set ChartValue to Current in this case. The screen should look
some- thing like this:



With this in place, lets now add a second Chart, this time showing the percentage of the time that
Galera replication is paused. To do this, create the Graph in the same way as above, choosing
appropriate names again, but in Series Values you instead put:
[ToInt(MONyog.MySQL.GlobalStatus.wsrep_fl ow_control_paused) * 100]









File Name: Monitoring Galera With MONyog.docx Page 3



w: www.mariadb.com

e: [email protected]

With these two new Graphs in place, and a few existing ones removed, the Dashboard now looks like
this:

4.3 Creating MONyog Alerts for Galera


A very important aspect of monitoring is to be able to defi ne alerts when certain conditions happen.
By default, the Galera monitors have one alert on the wsrep_ready status variable. A useful alert
would be on the wsrep_cluster_size variable, as this allows us to warn when there is just 1 (or 2) nodes
in the cluster. This can be achieved doing the following:
Go to the Monitors pane and click on the Number of nodes in the cluster monitor in the Galera
group.
In the popup window you get, click on Customize and you get a window where this monitor can
be confi gured.
At the top of this window, click on the View Advanced link and scroll down to the Alert settings.
Alter condition can be set to something like this:

function() {
if(this.Value < 2)
return Critical;
else if (this.Value < 3)
return Warning;
else return
None;
}

File Name: Monitoring Galera With MONyog.docx Page 4

w: www.mariadb.com

e: [email protected]

To alert for a critical condition when there is just 1 server in the cluster and issue a warning if there are
2.
To get notified of this condition, you also have to set Notify? To Yes.

In addition you have to do two more general things to enable notifications in general:
Click on Tools in the left menu pane and then set up Mail Settings.
Enable the monitored server to send email alerts by selecting Edit server in the dropdown
menu to the right of the server in the left list, and then go to the Notifications tab and enable
Send notifications over Mail (SMTP).

5 References
MariaDB provides subscriptions for MySQL / MariaDB and Galera that includes MONyog:
www.mariadb.com
Codership develops Galera: www.codership.com
Webyog develops database tools, among the MONyog: www.webyog.com

File Name: Monitoring Galera With MONyog.docx Page 5

You might also like