大数据集群监控配置操作指导(一)prometheus+grafana部署
1.prometheus+grafana部署(单独部署到一台服务器。4c8g。系统盘300G。操作系统建议7.6到7.9)
1.1下载prometheus和grafana的二进制包
mkdir /opt/dtstack
cd /opt/dtstack
wget https://dl.grafana.com/enterprise/release/grafana-enterprise-8.3.6.linux-amd64.tar.gz
wget https://github.com/prometheus/prometheus/releases/download/v2.33.3/prometheus-2.33.3.linux-amd64.tar.gz
1.2解压prometheus和grafan,更改文件夹名称
tar -zxvf grafana-enterprise-8.3.6.linux-amd64.tar.gz
mv prometheus-2.33.3.linux-amd64 prometheus-2.33.3
tar -zxvf prometheus-2.33.3.linux-amd64.tar.gz
1.3创建用户
useradd prometheus
useradd grafana
1.4启动
手动执行命令不是很方便,可以将它配置成服务,用systemd来管理。
vim /etc/systemd/system/grafana.service
[Unit]
Description=Grafana Server
After=network.target
[Service]
User=grafana
Restart=on-failure
WorkingDirectory=/opt/dtstack/grafana-8.3.6
ExecStart=/opt/dtstack/grafana-8.3.6/bin/grafana-server
[Install]
WantedBy=multi-user.target
vim /etc/systemd/system/prometheus.service
[Unit]
Description=Prometheus Server
Documentation=https://prometheus.io/docs/introduction/overview/
After=network.target
[Service]
User=prometheus
Restart=on-failure
WorkingDirectory=/opt/dtstack/prometheus-2.33.3/
ExecStart=/opt/dtstack/prometheus-2.33.3/prometheus \
--config.file=/opt/dtstack/prometheus-2.33.3/prometheus.yml \
--storage.tsdb.retention=30d
[Install]
WantedBy=multi-user.target
1.5修改目录权限
chown -R prometheus:prometheus /opt/dtstack/prometheus-2.33.3
chown -R grafana:grafana /opt/dtstack/grafana-8.3.6
1.6重新载入systemd
systemctl daemon-reload
systemctl start prometheus
systemctl status prometheus
systemctl enable prometheus
systemctl start grafana
systemctl status grafana
systemctl enable grafana
1.7登录prometheus的web页面
1.8登录grafana的web页面,默认密码是admin/admin
建议修改管理员密码