生产环境上遇到这个问题,控制台不停打印 “OOM command not allowed when used memory > 'maxmemory' ”;
起初不知道是什么,经过一番搜索:
1.登陆redis客户端:./redis-cli -h IP -p port -a passwd
2.执行命令:redis>info memory
若配置文件中,最大内存的策略设置为 maxmemory-policy volatile-lru 此配置只是清楚设置过期时间的key值,然而本应用并没有设置过期时间。
可以修改为maxmemory-policy allkeys-lru,指明非活跃近期很少用的key值清除。
如果清理完redis还不行,就需要考虑扩容