gpt4 book ai didi

ubuntu - 解决 EC2 上 Ubuntu 16.04 的 overcommit_memory 和 Transparent Huge Pages 上的 Redis 警告

转载 作者:IT王子 更新时间:2023-10-29 05:56:51 25 4
gpt4 key购买 nike

在新的 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.

如何永久消除它们?

最佳答案

就像警告建议的那样,只需将行 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 时警告就消失了!

关于ubuntu - 解决 EC2 上 Ubuntu 16.04 的 overcommit_memory 和 Transparent Huge Pages 上的 Redis 警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41203492/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com