8.03 High Availability in Grafana - MartinWong06/grafana GitHub Wiki

image Reference: https://grafana.com/docs/grafana/latest/setup-grafana/set-up-for-high-availability/

image

1. Access to Grafana default path

cd /etc/grafana

2. Edit grafana.ini and configure MySQL remote ip

sudo nano grafana.ini
#################################### Database ####################################
[database]
# You can configure the database connection by specifying type, host, name, user and password
# as separate properties or as on string using the url properties.

# Either "mysql", "postgres" or "sqlite3", it's your choice
type = mysql
host = "***Remote MySQL server IP***":3306
name = grafana
user = grafana
# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;"""
password = grafana

** Repeat above steps for other grafana instances**

3. Login to the MySQL server

sudo mysql

4. Edit db user allow for remote access

RENAME USER 'grafana'@'localhost' TO 'grafana'@'ip range of the remote MySQL host OR %';

5. Grant all the privileges for the remote db user

GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES, RELOAD on *.* TO 'grafana'@'%' WITH GRANT OPTION;

6. Apply the changes to the server

FLUSH PRIVILEGES;

7. Quit MySQL

quit

8. Edit mysqld.cnf

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

9. Change the bind-address from 127.0.0.1 to 0.0.0.0

bind-address            = 0.0.0.0

10. Restart MySQL server

sudo systemctl restart mysql

11. Restart Grafana server, repeat on all Grafana instance

sudo systemctl restart grafana-server

12. Verify Grafana DB setup

https://**Grafana_IP**/admin/settings

13. Search keyword "database"

⚠️ **GitHub.com Fallback** ⚠️