docker - 创建InfluxDB Docker容器时,如何设置保留策略以将数据存储30天并以1天的碎片数存储

标签 docker docker-compose influxdb

我正在通过docker-compose创建一个docker容器。使用以下内容:

   influxdb:
     container_name: influxdb
     image: influxdb:latest
     restart: always
     ports:
       - "8086:8086"
     environment:
       INFLUXDB_DB: "databasenew"
       INFLUXDB_ADMIN_USER: "admin"
       INFLUXDB_ADMIN_PASSWORD: "admin"
       INFLUXDB_READ_USER: "user"
       INFLUXDB_READ_USER_PASSWORD: "user"
     volumes:
       - influxdb:/var/lib/influxdb

如何创建保留策略,以在1天的分片中保留30天的数据。我希望能够在通过docker-compose创建容器时实现自动化。创建容器后,我不需要使用CLI。

最佳答案

最原生的选项:https://hub.docker.com/_/influxdb

The InfluxDB image contains some extra functionality for initializing a database. These options are not suggested for production, but are quite useful when running standalone instances for testing. If the Docker image finds any files with the extensions .sh or .iql inside of the /docker-entrypoint-initdb.d folder, it will execute them. The order they are executed in is determined by the shell. This is usually alphabetical order.



因此,将其“编码”为.sh或.iql文件并使用音量。当然,您也可以构建自己的解决方案-例如创建自己的形象,...

关于docker - 创建InfluxDB Docker容器时,如何设置保留策略以将数据存储30天并以1天的碎片数存储,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61419279/

相关文章:

docker - 我们如何获取 Kubernetes 集群中 NodePort 服务的 NodePort 的 tcpdump?

ubuntu - docker-compose:如何从企业 DHCP 服务器获取 IP

docker - 如何使用docker exec安装Composer

go - 如何为每组选择最接近给定时间的数据

docker - 我有一个允许的IP范围来配置dockers,并且我想在端口上导出docker daemon

docker - Iscsid 未在 MacOS 主机上的 centos6 docker 上启动

python - Nginx 服务 React 构建和 proxy_pass Django Rest api 服务器

linux - 无法使用 influxdb docker 镜像中的 'Influx' 命令访问或创建数据库

angular - Angular "strict-origin-when-cross-origin"错误是什么意思?

docker - 无法更改 Docker 镜像目录