当我运行我的Redis Docker镜像时,我会面临以下警告:
# Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
( ... )
# 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 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.
在我在互联网上找到的解决方案中,this one看起来涵盖了所有内容,但是当我在Docker范围内尝试它时(例如:更改我的Dockerfile以应用它们),我得到错误"阅读 - 只有文件系统"。手动示例给出了同样的问题:
[root@769368ed0fc5 /]# sysctl -w net.core.somaxconn=65535
sysctl: setting key "net.core.somaxconn": Read-only file system
[root@769368ed0fc5 /]# echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf
[root@769368ed0fc5 /]# sysctl vm.overcommit_memory=1
sysctl: setting key "vm.overcommit_memory": Read-only file system
[root@769368ed0fc5 /]# echo never > /sys/kernel/mm/transparent_hugepage/enabled
bash: /sys/kernel/mm/transparent_hugepage/enabled: Read-only file system
[root@769368ed0fc5 /]# echo never > /sys/kernel/mm/transparent_hugepage/enabled
bash: /sys/kernel/mm/transparent_hugepage/enabled: Read-only file system
有谁知道如何以正确的方式修复 ?我找到了许多解决方法,例如:
我想知道在Docker中处理它的正确方法是什么。将提供有关提议的解决方案的技术解释的答案。