一、现象
在应用的日志中,显示以下错误日志:
024-02-22T11:28:29.003653852+08:00 Caused by: io.lettuce.core.RedisException: org.springframework.data.redis.RedisSystemException: Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: OOM command not allowed when used memory > 'maxmemory'.
二、原因
从这里看出:就是redis的maxmemory的值太小了。
三、解决方案
先去看redis的配置
可以通过redis-cli,工具去查看内存信息
进入到redis的服务器,
redis-cli -p 6379
然后使用info命令查看redis的相关信息,
查看maxmemory 的值,以及used_memory的值。
used_memory:10091048
maxmemory:10240000
确认内存确实设置少了
由于我们使用的是redis主从模式,然后分别找到redis.conf的文件,修改maxmemory 2048000kb
最后重启redis即可,systemctl restart redis
最终问题得到解决。