如何手动删除Prometheus & Grafana数据?

问题描述 投票:0回答:1

我有一个带有

4GB
存储的虚拟机。我使用以下配置设置
Docker & Prometheus and Grafana

prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    restart: unless-stopped
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml
      - prometheus_data:/prometheus
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
      - '--storage.tsdb.path=/prometheus'    
      - '--web.console.libraries=/etc/prometheus/console_libraries'
      - '--web.console.templates=/etc/prometheus/consoles'
      - '--web.enable-lifecycle'
    expose:
      - 9090
    networks:
      - monitoring
  grafana:
    image: grafana/grafana:latest
    ports:
     - 3000:3000
    networks:
      - monitoring

我忘记将以下标志添加到

Prometheus
条目。

 - "--storage.tsdb.retention.time=60m"
 - "--storage.tsdb.retention.size=512MB"

所以我的磁盘很快就满了,由于磁盘空间已满,我无法执行任何操作。我收到来自不同来源的错误

error: file write error: No space left on device
logger=cleanup t=2022-12-11T14:06:53.402543926Z level=error msg="failed to lock and execute cleanup of old login attempts" error="database or disk is full"
ts=2022-12-11T13:38:35.765Z caller=db.go:908 level=error component=tsdb msg="compaction failed" err="compact head: persist head block: populate block: write chunks: preallocate: no space left on device"

我尝试从

prometheus
中删除
grafana
docker
容器,但它无助于减小磁盘大小。

如何删除所有以前收集的数据(我不关心它们)并从这些保留限制开始?

docker-compose prometheus grafana
1个回答
0
投票

您可以删除 docker 卷:

docker volume ls # 查看实际的卷名称是什么 docker volume rm prometheus_data # 或实际的卷名称

停止并删除容器后。

当然,这意味着您将丢失这些数据......

© www.soinside.com 2019 - 2024. All rights reserved.