Monitoring/Grafana

Grafana - metadata DB 변경 ( mysql )

wave35 2023. 3. 27. 07:01

 

meta data storage는 default sqlite이다.

아래는 mysql로 setting하는 작업이다.

 

1. Mysql set up

  • mysql 설치
  • mysql에 grafana user와 privileges 설정
  • grafana session table 생성

 

2. grafana.ini 파일에서 mysql enable설정

 

3. grafana start

mysql 접속

mysql> CREATE DATABASE grafana;

mysql> GRANT ALL ON `grafana`.* to 'grafana'@'%' identified by 'datatech';

mysql> flush privileges;

mysql> SELECT user, host FROM user;

mysql> CREATE TABLE `session` (
	`key` char(16) not null, 
    `data` blob, 
    `expiry` int(11) unsigned not null, 
    primary key (`key`) 
) ENGINE=MyISAM default charset=utf8;

 

sudo vi $GRAFANA_HOME/conf/grafana.ini

[database]

# Either "mysql", "postgres" or "sqlite3", it's your choice
;type = sqlite3
;host = 127.0.0.1:3306
;name = grafana
;user = root
;password =

type = mysql
host = mysqlserver.example.com:3306
name = grafana
user = grafana
password = grafanamysqluserpasswd

# For "postgres" only, either "disable", "require" or "verify-full"
;ssl_mode = disable

# For "sqlite3" only, path relative to data_path setting
;path = grafana.db