How to debug the error "OOM command not allowed when used memory > 'maxmemory'" in Redis?
redis
Solution
Any chance you changed the number of databases? If you use a very large number then the initial memory usage may be high
Problem
I'm getting "OOM command not allowed" when trying to set a key, `maxmemory` is set to 500M with `maxmemory-policy` "volatile-lru", I'm setting TTL for each key sent to redis. `INFO` command returns : `used_memory_human:809.22M` - If maxmemory is set to 500M, how did I reached 809M ? - `INFO` command does not show any Keyspaces , how is it possible ? - `KEYS *` returns "(empty list or set)" ,I've tried to change db number , still no keys found. Here is info command output: ``` redis-cli -p 6380 redis 127.0.0.1:6380> info # Server redis_version:2.6.4 redis_git_sha1:00000000 redis_git_dirty:0 redis_mode:standalone os:Linux 2.6.32-358.14.1.el6.x86_64 x86_64 arch_bits:64 multiplexing_api:epoll gcc_version:4.4.7 process_id:28291 run_id:229a2ee688bdbf677eaed24620102e7060725350 tcp_port:6380 uptime_in_seconds:1492488 uptime_in_days:17 lru_clock:1429357 # Clients connected_clients:1 client_longest_output_list:0 client_biggest_input_buf:0 blocked_clients:0 # Memory used_memory:848529904 used_memory_human:809.22M used_memory_rss:863551488 used_memory_peak:848529192 used_memory_peak_human:809.22M used_memory_lua:31744 mem_fragmentation_ratio:1.02 mem_allocator:jemalloc-3.0.0 # Persistence loading:0 rdb_changes_since_last_save:0 rdb_bgsave_in_progress:0 rdb_last_save_time:1375949883 rdb_last_bgsave_status:ok rdb_last_bgsave_time_sec:-1 rdb_current_bgsave_time_sec:-1 aof_enabled:0 aof_rewrite_in_progress:0 aof_rewrite_scheduled:0 aof_last_rewrite_time_sec:-1 aof_current_rewrite_time_sec:-1 aof_last_bgrewrite_status:ok # Stats total_connections_received:3 total_commands_processed:8 instantaneous_ops_per_sec:0 rejected_connections:0 expired_keys:0 evicted_keys:0 keyspace_hits:0 keyspace_misses:0 pubsub_channels:0 pubsub_patterns:0 latest_fork_usec:0 # Replication role:master connected_slaves:0 # CPU used_cpu_sys:18577.25 used_cpu_user:1376055.38 used_cpu_sys_children:0.00 used_cpu_user_children:0.00 # Keyspace redis 127.0.0.1:6380> ```