Graphing Amazon RDS MySQL Metrics with Prometheus & Grafana

Recently the mysql community got an awesome monitoring solution for mysql

with Prometheus & Grafana. The graphs are simply beautiful and really lively.

I started off with this nice post on the mysql performance blog  by Roman Vynar and got the solution up and running very easily.

You can actually monitor Amazon RDS instance with the same steps mentioned in the above post but with a few changes:

 

The monitoring framework consists of 4 components:

  1. Prometheus server on port 9090
  2. Grafana server on port 3000
  3. MySQL  exporter  process which connects to the MySQL Server
  4. Node Exporter process which gets system metrics of the box hosting MySQL

 

Prerequisites:

  1. Create an RDS instance.
  2. create an amazon ec2-instance. (this will host all the 4 components)

Setup:

Component 3 & 4: – Node Exporter & MySQL exporter process :

Amazon _DOES_NOT_ allow us to install anything on the RDS box.

So, I am sorry we will not be able get the System metrics of RDS – please rely on cloudwatch / Rds console for load averages, cpu usage , io etc etc.

So Follow the steps as mentioned in the nice post BUT make the following changes,

  • Install the Node exporter & MySQL exporter processes on the ec-instance ,
    • So the ‘/opt/prometheus/prometheus.yml’ file will look like
    • i.e. you are now monitoring system metrics of the ec2-instance not RDS box !
cat << EOF > /opt/prometheus/prometheus.yml
global:
 scrape_interval: 5s
 evaluation_interval: 5s
scrape_configs:
 - job_name: linux
 target_groups:
 - targets: ['localhost:9100']
 labels:
 alias: db1
 - job_name: mysql
 target_groups:
 - targets: ['localhost:9104']
 labels:
 alias: db1
EOF

But we need to tell the MySQL exporter to pull from RDS endpoint, so the

my.cnf file for MySQL exporter should be as follows:

[root@centos7 prometheus_exporters]# cat << EOF > .my.cnf
[client]
user=prom
password=abc123
host=amazon-rds-instance.amazonaws.com
EOF

 

Component 1 & 2: – Grafana & Prometheus:

Just Follow the steps as mentioned in the nice post .

x———————————————————–x

And walllaaaah…. you should be able graph Amazon RDS metrics 🙂

Screen Shot 2016-05-05 at 4.08.17 pm

 

 

Advertisements

Should I worry about the Query Cache in Aurora ?

There are a lot of blog posts on the internet which warn you about using the Query Cache in MySQL.

I was surprised to see that the query cache was enabled in Aurora.

Screen Shot 2015-08-24 at 7.25.02 pm

This was the size on a ‘db.r3.large’ instance.

On a ‘db.r3.2xlarge’  instance, it was set to 2460900352 i.e. 2.4GB

I am not sure, if amazon has done something to improve the query cache.

So, do run tests with Aurora and see if the cache suits you.

Screen Shot 2015-08-24 at 7.47.15 pm

a wild Supposition: can MySQL be Kafka ?

This is an idea which i presented at Percona Live 2015.

Is MySQL an avatar of Apache Kafka ?

Can it be Kafka ?

Yes, it can.

This talk takes a shot at modeling MySQL as Kafka.

PS: it’s unconventional, hence a WILD supposition 🙂

slides @

http://www.slideshare.net/jaihind213/can-mysql-bekafka

 or

 I made a small video for this presentation too.

My Own Video for Ppt

MySQL Cluster – Java Connector / Bindings

While working with MySQL Cluster, i was looking for a monitoring framework for the cluster.

i came across a library @ https://launchpad.net/ndb-bindings – which had java and other connectors to NDB, the library was a wrapper of the existing C++ NDB Api.

This library allowed me to connect to the management node , get the state of the cluster and get real time notifications about heartbeat misses/node disconnections.

The library error-ed out on some conditions, with a small fix, it can work with MySQL Cluster 7.3.

https://github.com/jaihind213/mysql-cluster-ndb-bindings

I have listed down steps for compilation and running a sample program at github