Rocky Linux 9 使用阿里云镜像安装 Grafana 13.1.0

一、添加阿里云 Grafana YUM 源

bash 复制代码
sudo tee /etc/yum.repos.d/grafana.repo > /dev/null << 'EOF'
[grafana]
name=Grafana
baseurl=https://mirrors.aliyun.com/grafana/yum/rpm
enabled=1
gpgcheck=0
repo_gpgcheck=0
EOF

二、安装 Grafana

bash 复制代码
sudo dnf makecache
sudo dnf install -y grafana

三、启动并设置开机自启

bash 复制代码
sudo systemctl enable --now grafana-server
sudo systemctl status grafana-server

四、登录 Grafana

bash 复制代码
浏览器访问:
http://服务器IP:3000

默认账号 / 密码:
admin
admin

五、添加 Prometheus 数据源

  1. 左侧 ☰ → Connections → Data Source
  2. 点击 Add data source
  3. 选择 Prometheus
  4. URL 填写: http://localhost:9090
  5. 点击 Save & Test
  6. ✅ 提示Successfully queried the Prometheus API.

六、导入 MySQL 官方仪表盘

  1. 左侧 ☰ → Dashboards → New → Import
  2. Dashboard ID 输入:7362(Percona MySQL Overview)
  3. 点击 Load
  4. Prometheus 数据源选择你刚添加的 Prometheus
  5. 点击 Import
    ✅ 几秒后即可看到 MySQL QPS / 连接数 / InnoDB / 锁等待等图表