问题描述
启动redis容器报错如下
se > /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 (set to 'madvise' or 'never').
1:M 21 Jul 2023 11:27:23.068 # Fatal: Can't initialize Background Jobs.
1:C 21 Jul 2023 11:27:29.995 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 21 Jul 2023 11:27:29.995 # Redis version=6.0.20, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 21 Jul 2023 11:27:29.995 # Configuration loaded
1:M 21 Jul 2023 11:27:29.996 * Running mode=standalone, port=6379.
1:M 21 Jul 2023 11:27:29.997 # Server initialized
1:M 21 Jul 2023 11:27:29.997 # 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 madvise > /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 (set to 'madvise' or 'never').
1:M 21 Jul 2023 11:27:29.997 # Fatal: Can't initialize Background Jobs.
解决办法
先停止redis
docker stop redis
执行
vim /etc/rc.local
echo never > /sys/kernel/mm/transparent_hugepage/enabled