一、安装Promethus
wget https://github.com/prometheus/prometheus/releases/download/v2.18.1/prometheus-2.18.1.linux-amd64.tar.gz
tar zxvf prometheus-2.18.1.linux-amd64.tar.gz
cd prometheus-2.18.1.linux-amd64
二、创建三个Prometheus实例配置
cp prometheus.yml prometheus_1.yml
cp prometheus.yml prometheus_2.yml
cat >> prometheus.xml <<EOF
# 数据读取的 9090 的配置
remote_read:
- url: 'http://localhost:9091/api/v1/read'
remote_timeout: 8s
- url: 'http://localhost:9092/api/v1/read'
remote_timeout: 8s
EOF
sed -i s/9090/9091/g prometheus_1.yml
sed -i s/9090/9092/g prometheus_2.yml
三、启动三个Prometheus实例
./prometheus \
--web.listen-address="0.0.0.0:9091" \
--web.enable-admin-api \
--storage.tsdb.path="data1" \
--config.file="prometheus_1.yml" &
./prometheus \
--web.listen-address="0.0.0.0:9092" \
--web.enable-admin-api \
--storage.tsdb.path="data2" \
--config.file="prometheus_2.yml" &
./prometheus \
--web.listen-address="0.0.0.0:9090" \
--web.enable-admin-api \
--storage.tsdb.path="data" \
--config.file="prometheus.yml" &
四、查看结果
browser http://127.0.0.1:9090,可以看到其他两个实例的数据
image.png
网友评论