小编典典

如何在Redis中调试错误“使用的内存>'maxmemory'时不允许OOM命令”?

redis

尝试设置密钥时出现“不允许OOM命令”, maxmemory通过maxmemory-policy“ volatile-lru” 设置为500M
,我为发送给redis的每个密钥设置TTL。

INFO 命令返回: used_memory_human:809.22M

  1. 如果maxmemory设置为500M,我怎么达到809M?
  2. INFO 命令没有显示任何键空间,这怎么可能?
  3. KEYS * 返回“(空列表或集合)”,我试图更改数据库号,但仍未找到键。

这是info命令输出:

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>

阅读 691

收藏
2020-06-20

共1个答案

小编典典

您是否有可能更改了数据库数量?如果您使用非常大的数字,那么初始内存使用率可能会很高

2020-06-20