Setup Grafana for high availability

This tutorial is setup Grafana cluster with Stateless sessions as a recommended session by official docs. We have 3 servers:

  • – Grafana1
  • – Grafana2
  • – MySQL

Install MySQL

sudo apt install mysql-server
sudo mysql_secure_installation

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
bind address =

Create Database

mysql -u root -p
CREATE DATABASE grafana_user;
GRANT ALL ON grafana.* TO 'grafana_user'@'%' IDENTIFIED BY 'UnholyConfessions';
GRANT ALL ON grafana_user.* TO 'grafana_user'@'%' IDENTIFIED BY 'UnholyConfessions';

show grants for grafana_user@'%';

okay, let’s configure all the Grafana nodes

Download Grafana

cd /opt
sudo wget
sudo tar -zxvf grafana-6.1.3.linux-amd64.tar.gz

Create user and group for Grafana

sudo groupadd -f grafana
sudo useradd -c "grafana user" -d /opt/grafana-6.1.3 -s /bin/false -g grafana grafana
sudo chown -R grafana:grafana /opt/grafana-6.1.3

Edit Grafana configuration

cd /opt/grafana-6.1.3
sudo -u grafana nano conf/defaults.ini

Delete all configuration in section [database] and [session] and add this configuration:

url = mysql://grafana_user:UnholyConfessions@
type = mysql
host =
name = grafana
user = grafana_user
password = UnholyConfessions

provider = mysql
provider_config = grafana_user:UnholyConfessions@tcp(

Create service files

sudo nano /etc/systemd/system/grafana.service


ExecStart=/opt/grafana-6.1.3/bin/grafana-server -homepath /opt/grafana-6.1.3/


Start Grafana

sudo systemctl daemon-reload
sudo systemctl enable grafana.service
sudo systemctl start grafana.service
sudo systemctl status grafana.service

Comments are closed.