docker - 将 redis 与 docker-compose 一起使用:MISCONF Redis 配置为保存 RDB 快照,但目前无法持久保存在磁盘上
问题描述
我相信这个问题在这里有些答案:MISCONF Redis is configured to save RDB snapshots。
我目前正在运行一个 Redis docker 容器,它不时返回以下错误:
MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.
结合:
redis_1 | 4410:C 06 Feb 2020 23:50:57.045 # Failed opening the RDB file crontab (in server root dir /etc) for saving: Permission denied
这是因为redis的空间不足吗?我可以做些什么来清理redis吗?我只使用redis作为消息传递层,所以数据并不是真的需要被持久化......
我还看到WARNINGS
来自 redis 容器的以下内容:
# WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
我觉得也许这个问题是向 redis/devops 专家询问使用 docker-compose 配置 redis 的最佳方法的绝佳机会,我目前有:
redis:
build:
context: ./redis
dockerfile: Dockerfile
ports:
- '6379:6379'
volumes:
- ./redis.conf:/usr/local/etc/redis/redis.conf
sysctls:
net.core.somaxcomm: '511'
restart: on-failure
如果有什么更好的可以做,那将是惊人的和感激的。
解决方案
推荐阅读
- c# - 日期排序优化
- php - 使用 php 和谷歌库提交表单后在谷歌电子表格上写
- javascript - 如何在 jquery 中实现鼠标悬停效果?
- neo4j - 使用 H2O 无人驾驶 AI 进行欺诈环检测 - 需要样本、指针
- c# - 从 Windows 窗体文本框中获取 Unicode 数字文本
- javascript - 服务在 Sweetalert 中不起作用
- typescript - 解读 Typescript 地图功能
- android - 如何在不使用 Android Studio 的情况下为 Google Play 开发控制台创建即时应用程序?
- python-2.7 - ImportError:无法导入名称 api - 在 centos 7 上配置 aws_cli 时出错
- c++ - vtkRenderer 出错