Prometheus(普罗米修斯)
Prometheus数据持久化存储(二)
Prometheus+Influx+Grafana+Mysql数据持久化存储
Prometheus的存储数据库默认只保留15天的数据,Grafana存储的配置以及图表都还在容器之中它自己生成的sqlit数据库中长期存储并不友好。
为了更适应老板的需求,长期存储数据,我们可以添加时序数据库InfluxDB作为prometheus后端存储,可以修改grafana的存储为mysql以便自己做一些自定义操作的时候方便一点。
Prometheus+Influx存储数据
cat docker-compose-prometheus-influxdb.yml
version: "2.3"
services:
prometheus:
image: prom/prometheus:latest
container_name: prometheus
hostname: prometheus
restart: always
volumes:
- /prometheus/prometheus/config:/etc/prometheus
- /prometheus/prometheus/data:/prometheus
- /etc/localtime:/etc/localtime
command:
- ‘--config.file=/etc/prometheus/prometheus.yml‘
- ‘--log.level=info‘
- ‘--web.listen-address=0.0.0.0:9090‘
- ‘--storage.tsdb.path=/prometheus‘
- ‘--storage.tsdb.retention=15d‘
- ‘--query.max-concurrency=50‘
- ‘--web.enable-lifecycle‘
ports:
- "9090:9090"
depends_on:
- influxdb
logging:
driver: "json-file"
options:
max-size: "1g"
networks:
- prom_monitor
influxdb:
image: influxdb:latest
container_name: influxdb
hostname: influxdb
restart: always
volumes:
- /prometheus/prometheus/influxdb/config:/etc/influxdb
- /prometheus/pro