架构图
前提条件:
mysql主主+keepalived
granfana两台+keepalived
一、使用同一数据源的配置
1、准备grafana数据库:
# mysql -uroot -pk19k19
mysql> CREATE DATABASE grafana DEFAULT CHARACTER SET utf8;
Query OK, 1 row affected (0.02 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| apolloconfigdb |
| apolloportaldb |
| grafana |
| mysql |
| performance_schema |
| sys |
| testforliuxw |
| txc |
+--------------------+
9 rows in set (0.01 sec)
2、修改数据源
Grafana默认使用了内嵌数据库sqlite3来进行用户以及dashboard相关配置的存储。更改配置文件的[database]部分,改为mysql(可以更改为”postgres”等其他数据库):
vi /etc/grafana/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 = 172.26.1.111:3306 #填写mysql vip
name = grafana #选择grafana存储数据库
user = root #mysql用户
# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;"""
password = k19k19 #mysql密码
3、重启grafana
systemctl restart grafana-server.service
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/75778.html