1、下载安装
官网下载比较慢,因此用清华园秒下载:wget https://mirrors.tuna.tsinghua.edu.cn/grafana/yum/rpm/grafana-7.5.4-1.x86_64.rpm
cd /user/local
wget https://mirrors.tuna.tsinghua.edu.cn/grafana/yum/rpm/grafana-7.5.4-1.x86_64.rpm
sudo yum -y install grafana-7.5.4-1.x86_64.rpm
2、服务启动
systemctl enable grafana-server
systemctl start grafana-server
ss -ntl | grep 3000
LISTEN 0 128 :::3000 :::*
3、登录
http://localhost:3000
默认账号:admin
默认密码:admin
4、grafana读mysql时间问题
mysql 设置 time_zone 为 "+8:00" 没问题,grafana 的时区也设置为UTC+8:00也没问题。
mysql 表中存储的日期正常,但 grafanfa 读到的数据却快了 8 小时。
解决办法给时间字段加 UNIX_TIMESTAMP() 方法,如将
SELECT
created_at AS "time",
metric AS metric,
value
FROM test
WHERE
$__timeFilter(created_at)
ORDER BY created_at
修改为
SELECT
UNIX_TIMESTAMP(created_at) AS "time",
metric AS metric,
value
FROM test
WHERE
$__timeFilter(created_at)
ORDER BY created_at