Prometheus使用远端存储VictoriaMetrics集群版

下载并配置

[root@VM-0-15-centos ~]# wget https://github.com/VictoriaMetrics/VictoriaMetrics/releases/download/v1.80.0/victoria-metrics-linux-amd64-v1.80.0-cluster.tar.gz
[root@VM-0-15-centos ~]# tar xvf victoria-metrics-linux-amd64-v1.80.0-cluster.tar.gz
[root@VM-0-15-centos ~]# mv vminsert-prod vmselect-prod vmstorage-prod /usr/local/bin/

 三台都配置

[root@VM-0-3-centos ~]# vim /etc/systemd/system/vmstorage.service 
[Unit]
Description=Vmstorage Server
After=network.target

[Service]
Restart=on-failure
WorkingDirectory=/tmp
ExecStart=/usr/local/bin/vmstorage-prod -loggerTimezone Asia/Shanghai -storageDataPath /data/vmstorage-data -httpListenAddr :8482 -vminsertAddr :8400 -vmselectAddr :8401

[Install]
WantedBy=multi-user.target
[root@VM-0-3-centos ~]# vim /etc/systemd/system/vminsert.service 
[Unit]
Description=Vminsert Server
After=network.target

[Service]
Restart=on-failure
WorkingDirectory=/tmp
ExecStart=/usr/local/bin/vminsert-prod  -httpListenAddr :8480 -storageNode=192.168.0.16:8400,192.168.0.3:8400,192.168.0.15:8400

[Install]
WantedBy=multi-user.target
[root@VM-0-3-centos ~]# vim /etc/systemd/system/vmselect.service 
[Unit]
Description=Vmselect Server
After=network.target

[Service]
Restart=on-failure
WorkingDirectory=/tmp
ExecStart=/usr/local/bin/vmselect-prod -httpListenAddr :8481 -storageNode=192.168.0.16:8401,192.168.0.3:8401,192.168.0.15:8401

[Install]
WantedBy=multi-user.target

重启服务,设置开机启动

[root@VM-0-3-centos ~]# systemctl restart vmstorage.service 
[root@VM-0-3-centos ~]# systemctl enable vmstorage.service
[root@VM-0-3-centos ~]# systemctl restart vminsert.service
[root@VM-0-3-centos ~]# systemctl enable vminsert.service
[root@VM-0-3-centos ~]# systemctl restart vmselect.service
[root@VM-0-3-centos ~]# systemctl enable vmselect.service

编辑prometheus.yml配置文件,修改后重启

remote_write:
  - url: http://192.168.0.16:8480/insert/0/prometheus
  - url: http://192.168.0.3:8480/insert/0/prometheus
  - url: http://192.168.0.15:8480/insert/0/prometheus

重启查看prometheus

在grafana中添加数据源,我这写的其中一个IP可以做一个haproxy写vip地址

导入模板1860

监控没有问题

posted @ 2022-08-25 13:54  Maniana  阅读(353)  评论(0编辑  收藏  举报