17

在新的 Ubuntu 16.04 EC2 实例上,警告如下所示:

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.

如何永久消除它们?

4

2 回答 2

13

就像警告所暗示的那样,只需将行添加vm.overcommit_memory=1到底部/etc/sysctl.conf,例如sudo vi /etc/sysctl.conf.

但是权限不允许您按照警告建议编辑 THP,所以改为

sudo apt install hugepages

并将命令添加sudo hugeadm --thp-never到 .bashrc 的底部,例如sudo vi ~/.bashrc.

然后sudo reboot,下次您运行 SSH 时redis-server,警告就消失了!

于 2016-12-17T22:04:01.447 回答
2

使用 Linux 和 Ubuntu,我在运行之前这样做了redis-server,它似乎可以工作......

sudo add-apt-repository ppa:redislabs/redis
sudo apt-get update
sudo apt-get install redis

https://redis.io/下载

于 2021-05-06T18:39:46.533 回答