Grafana8.4.4安装
Grafana8.4.4安装
一、下载安装
下载安装包,选对应的平台,这里下载的是grafana-8.4.4.linux-amd64这个版本
二、解压
解压到/root/app/目录下,
tar -zxvf grafana-8.4.4.linux-amd64.tar.gz -C /root/app/
三、修改配置及导入数据
说明,如果不改数据库存储类型,这一步可以忽略不管直接启动即可,如果没有前置数据需要导入,只需要改成mysql存储,那么3.2和3.3步骤可以忽略不用管。这里的前置数据是将sqlite3中的grafana数据导入到mysql中,适用于原来使用sqlite3存储现在改成mysql存储的场景。
3.1 初始化mysql数据库和导入数据
create database grafana;
3.2 初始化grafana数据库表结构
mysql -u totems -h 127.0.0.1 -p -P 33060 -D grafana < grafana-init.sql
3.3 导入前置数据
前置数据执行脚本及说明
mysql -u totems -h 127.0.0.1 -p -P 33060 -D grafana < grafana.sql
3.4 修改grafana默认数据库配置
cd /root/app/grafana-8.4.4/conf/
vi default.ini
找到database的配置,如下
#################################### 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 property.
# Either "mysql", "postgres" or "sqlite3", it's your choice
type = sqlite3
host = 127.0.0.1:3306
name = grafana
user = root
# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;"""
password =
# Use either URL or the previous fields to configure the database
# Example: mysql://user:secret@host:port/database
url =
修改如下:
type = mysql
host = 127.0.0.1:33060
name = grafana
user = totems
# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;"""
password = 123456
# Use either URL or the previous fields to configure the database
# Example: mysql://user:secret@host:port/database
url =
注意: 密码里面如果包含#或者; 需要用三个引号引起来,比如
password = """123#234"""
第二点,url和上面的配置只需要配置一个即可,比如上面用了配置,url就可以不用填写
四、启动
nohup ./bin/grafana-server > nohup.out 2>&1 &
打开浏览器输入 http://xxxx:3000 进行访问