Phenomenon
An exception occurred in the log:
' MaxMemory '
Reason
The memory is full, no more data is allowed, and you can view the details of Redis via REDIS-CLI
127.0 . 0.1 : 6379 > info memory# memoryused_memory: 4120248 used_memory_human: 3.93m used_memory_rss: 11509760 used_memory_peak: 1977983104 used_memory_peak_human: 1 .84gused_memory_lua: 36864 mem_fragmentation_ratio: 2.79 mem_allocator:jemalloc -0
Note:
- Used_memory_human indicates that memory is used
- Used_memory_rss represents the memory allocated by the system to Redis (that is, resident memory)
- Mem_fragmentation_ratio=used_memory_rss/used_memory ratio, generally, used_memory_rss is slightly higher than used_memory, and when memory fragmentation is high, mem_ Fragmentation_ratio will be larger, can reflect the memory fragmentation is many
Solve
Note: If you modify the configuration file, you need to restart Redis
1. Increase Redis memory, modify redis.conf
MaxMemory 2GB
2. Modify the Redis Storage Policy
The default Redis settings are very conservative, that is, the memory is not stored after the overrun, you can change the policy to the LRU algorithm (least recently used algorithm)-The newly stored information will replace the old information, so it will not be the memory line, modify redis.conf
volatile-lru
3. Save less data to Reids
Is it necessary to deposit so much data into Redis?
Redis:oom command not allowed when used memory > ' maxmemory '