我正在通过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/