【问题标题】:After InfluxDB docker container restarted it's not restoring to the last point and it have mount volume as wellInfluxDB docker 容器重新启动后,它没有恢复到最后一点,并且它也有挂载卷
【发布时间】:2021-02-09 07:15:53
【问题描述】:

我有一个容器作为 Influxdb 2.0,并且我已经安装了卷,以防我们必须关闭容器。下面我向您展示了我的 docker-comopose.yml 文件。你可以看到我已经安装了卷,但最近我已经关闭了所有容器,然后又启动了,但我没有在 Influxdb 中获取旧数据,我正在获取其他容器的数据,如 telegraf 和 grafana

version: "3"
services:
  grafana:
    image: grafana/grafana:7.4.0-ubuntu
    container_name: grafana
    restart: always
    ports:
      - 3000:3000
    networks:
      - analytics
    volumes:
      - grafana-storage:/var/lib/grafana
      - ./usr/share/grafana/conf/defaults.ini:/usr/share/grafana/conf/defaults.ini
    environment:
      - GF_SECURITY_ADMIN_USER=admin
      - GF_SECURITY_ADMIN_PASSWORD=admin
  influxdb:
    image: quay.io/influxdb/influxdb:2.0.0-rc
    container_name: influxdb
    restart: always
    ports:
      - 8086:8086
    networks:
      - analytics
    volumes:
      - /mnt/db/:/mnt/db/
      - /mnt/influx/:/mnt/influx/
      - ./etc/influxdb/:/etc/influxdb/
  telegraf:
    image: telegraf:1.17.2
    container_name: telegraf
    restart: always
    depends_on:
        - influxdb
    networks:
      - analytics
    volumes:
      - telegraf-storage:/var/lib/telegraf
      - ./etc/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf
    environment:
        INFLUXDB_URL: http://influxdb:8086
     # - username=admin
     # - password=admin
    links:
      - influxdb
networks:
  analytics:
volumes:
  grafana-storage:
    external: true
  telegraf-storage:
    external: true

使用 docker logs influxdb 检查时出现错误

ts=2021-02-09T06:42:52.057665Z lvl=info msg="Welcome to InfluxDB" log_id=0SDOIj6G000 version=2.0.0-rc.3 commit=f46a3bd91e build_date=2020-10-29T22:17:55Z
ts=2021-02-09T06:42:52.069082Z lvl=info msg="Resources opened" log_id=0SDOIj6G000 service=bolt path=/root/.influxdbv2/influxd.bolt
ts=2021-02-09T06:42:52.070666Z lvl=info msg="Migration \"initial migration\" started (up)" log_id=0SDOIj6G000 service=migrations
ts=2021-02-09T06:42:52.120805Z lvl=info msg="Migration \"initial migration\" completed (up)" log_id=0SDOIj6G000 service=migrations
ts=2021-02-09T06:42:52.120898Z lvl=info msg="Migration \"add index \\\"userresourcemappingsbyuserindexv1\\\"\" started (up)" log_id=0SDOIj6G000 service=migrations
ts=2021-02-09T06:42:52.124361Z lvl=info msg="Migration \"add index \\\"userresourcemappingsbyuserindexv1\\\"\" completed (up)" log_id=0SDOIj6G000 service=migrations
ts=2021-02-09T06:42:52.124384Z lvl=info msg="Migration \"migrate task owner id\" started (up)" log_id=0SDOIj6G000 service=migrations
ts=2021-02-09T06:42:52.126757Z lvl=info msg="Migration \"migrate task owner id\" completed (up)" log_id=0SDOIj6G000 service=migrations
ts=2021-02-09T06:42:52.126781Z lvl=info msg="Migration \"create DBRP buckets\" started (up)" log_id=0SDOIj6G000 service=migrations
ts=2021-02-09T06:42:52.132487Z lvl=info msg="Migration \"create DBRP buckets\" completed (up)" log_id=0SDOIj6G000 service=migrations
ts=2021-02-09T06:42:52.132511Z lvl=info msg="Migration \"create pkger stacks buckets\" started (up)" log_id=0SDOIj6G000 service=migrations
ts=2021-02-09T06:42:52.136981Z lvl=info msg="Migration \"create pkger stacks buckets\" completed (up)" log_id=0SDOIj6G000 service=migrations
ts=2021-02-09T06:42:52.137006Z lvl=info msg="Migration \"delete sessionsv1 bucket\" started (up)" log_id=0SDOIj6G000 service=migrations
ts=2021-02-09T06:42:52.144227Z lvl=info msg="Migration \"delete sessionsv1 bucket\" completed (up)" log_id=0SDOIj6G000 service=migrations
ts=2021-02-09T06:42:52.144256Z lvl=info msg="Migration \"Create TSM metadata buckets\" started (up)" log_id=0SDOIj6G000 service=migrations
ts=2021-02-09T06:42:52.147799Z lvl=info msg="Migration \"Create TSM metadata buckets\" completed (up)" log_id=0SDOIj6G000 service=migrations
ts=2021-02-09T06:42:52.147821Z lvl=info msg="Migration \"Create Legacy authorization buckets\" started (up)" log_id=0SDOIj6G000 service=migrations
ts=2021-02-09T06:42:52.152508Z lvl=info msg="Migration \"Create Legacy authorization buckets\" completed (up)" log_id=0SDOIj6G000 service=migrations
ts=2021-02-09T06:42:52.152530Z lvl=info msg="Migration \"Create legacy auth password bucket\" started (up)" log_id=0SDOIj6G000 service=migrations
ts=2021-02-09T06:42:52.156355Z lvl=info msg="Migration \"Create legacy auth password bucket\" completed (up)" log_id=0SDOIj6G000 service=migrations
ts=2021-02-09T06:42:52.170260Z lvl=info msg="Using data dir" log_id=0SDOIj6G000 service=storage-engine path=/root/.influxdbv2/engine/data
ts=2021-02-09T06:42:52.170414Z lvl=info msg="Compaction settings" log_id=0SDOIj6G000 service=storage-engine max_concurrent_compactions=1 throughput_bytes_per_second=50331648 throughput_bytes_per_second_burst=50331648
ts=2021-02-09T06:42:52.170438Z lvl=info msg="Open store (start)" log_id=0SDOIj6G000 service=storage-engine op_name=tsdb_open op_event=start
ts=2021-02-09T06:42:52.170516Z lvl=info msg="Open store (end)" log_id=0SDOIj6G000 service=storage-engine op_name=tsdb_open op_event=end op_elapsed=0.063ms
ts=2021-02-09T06:42:52.170576Z lvl=info msg="Starting retention policy enforcement service" log_id=0SDOIj6G000 service=retention check_interval=30m
ts=2021-02-09T06:42:52.170627Z lvl=info msg="Starting precreation service" log_id=0SDOIj6G000 service=shard-precreation check_interval=10m advance_period=30m
ts=2021-02-09T06:42:52.170674Z lvl=info msg="Starting query controller" log_id=0SDOIj6G000 service=storage-reads concurrency_quota=10 initial_memory_bytes_quota_per_query=9223372036854775807 memory_bytes_quota_per_query=9223372036854775807 max_memory_bytes=0 queue_size=10
ts=2021-02-09T06:42:52.172525Z lvl=info msg="Configuring InfluxQL statement executor (zeros indicate unlimited)." log_id=0SDOIj6G000 max_select_point=0 max_select_series=0 max_select_buckets=0
ts=2021-02-09T06:42:52.480549Z lvl=info msg=Starting log_id=0SDOIj6G000 service=telemetry interval=8h
ts=2021-02-09T06:42:52.480732Z lvl=info msg=Listening log_id=0SDOIj6G000 transport=http addr=:8086 port=8086
ts=2021-02-09T06:42:52.508188Z lvl=info msg=Unauthorized log_id=0SDOIj6G000 error="authorization not found"
ts=2021-02-09T06:42:52.661033Z lvl=info msg=Unauthorized log_id=0SDOIj6G000 error="authorization not found"
ts=2021-02-09T06:42:52.951156Z lvl=info msg=Unauthorized log_id=0SDOIj6G000 error="authorization not found"
ts=2021-02-09T06:42:53.240232Z lvl=info msg=Unauthorized log_id=0SDOIj6G000 error="authorization not found"

【问题讨论】:

    标签: docker docker-compose influxdb


    【解决方案1】:

    实际上,Influxdbv2 的所有默认配置都位于 /root/.influxdbv2 位置。所以我们需要挂载这个卷,但是有两种方法可以实现。

    • 在您的influxdb container 中设置环境变量INFLUXD_BOLT_PATHINFLUXD_ENGINE_PATH 以指向您的卷挂载目录之一
    • 将卷挂载更改为挂载到/root/.influxdbv2

    我选择了第二个选项,之后我的数据将保持不变,无论我关闭和启动 Influxdb Container 多少次。

    谢谢

    【讨论】:

      猜你喜欢
      • 2015-11-21
      • 2014-04-15
      • 2018-04-13
      • 1970-01-01
      • 2016-09-08
      • 1970-01-01
      • 2018-05-16
      • 1970-01-01
      • 2021-09-17
      相关资源
      最近更新 更多