0

我正在尝试连接到远程 redis 服务器并使用 HSET 命令设置密钥,如下所示

hset ABCD:1105 balance 1000

我可以看到使用的密钥KEYS *

但大约 1 分钟后 KEYS * 返回 empty (empty list or set)。而密钥上的 TTL 返回 -1。

这是redis服务器中的内存配置

 1) "masterauth"
 2) ""
 3) "maxmemory"
 4) "0"
 5) "maxmemory-samples"
 6) "5"
 7) "maxclients"
 8) "10000"
 9) "min-slaves-to-write"
10) "0"
11) "min-replicas-to-write"
12) "0"
13) "min-slaves-max-lag"
14) "10"
15) "min-replicas-max-lag"
16) "10"
17) "maxmemory-policy"
18) "noeviction"

这里的最大内存策略也是 noeviction。那么为什么密钥会过期。

更新redis server pod的日志

> 1:C 09 Jan 2021 17:02:04.495 # oO0OoO0OoO0Oo Redis is starting
> oO0OoO0OoO0Oo 1:C 09 Jan 2021 17:02:04.495 # Redis version=5.0.7,
> bits=64, commit=00000000, modified=0, pid=1, just started 1:C 09 Jan
> 2021 17:02:04.495 # Configuration loaded 1:M 09 Jan 2021 17:02:04.496
> * Running mode=standalone, port=6379. 1:M 09 Jan 2021 17:02:04.496 # WARNING: The TCP backlog setting of 511 cannot be enforced because
> /proc/sys/net/core/somaxconn is set to the lower value of 128. 1:M 09
> Jan 2021 17:02:04.496 # Server initialized 1:M 09 Jan 2021
> 17:02:04.496 # WARNING you have Transparent Huge Pages (THP) support
> enabled in your kernel. This will create latency and memory usage
> issues with Redis. To fix this issue run the command 'echo never >
> /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to
> your /etc/rc.local in order to retain the setting after a reboot.
> Redis must be restarted after THP is disabled. 1:M 09 Jan 2021
> 17:02:04.897 * DB loaded from append only file: 0.400 seconds 1:M 09
> Jan 2021 17:02:04.897 * Ready to accept connections

更新2:内存信息

used_memory:999576 used_memory_human:976.15K used_memory_rss:5341184 used_memory_rss_human:5.09M used_memory_peak:1679456 used_memory_peak_human:1.60M used_memory_peak_perc:59.52% used_memory_overhead:958562 used_memory_startup:790256 used_memory_dataset:41014 used_memory_dataset_perc:19.59% allocator_allocated:1104272 allocator_active:1642496 allocator_resident:5189632 total_system_memory:29508444160 total_system_memory_human:27.48G used_memory_lua:37888 used_memory_lua_human:37.00K used_memory_scripts:0 used_memory_scripts_human:0B number_of_cached_scripts:0 maxmemory:0 maxmemory_human:0B maxmemory_policy:noeviction allocator_frag_ratio:1.49 allocator_frag_bytes:538224 allocator_rss_ratio:3.16 allocator_rss_bytes:3547136 rss_overhead_ratio:1.03

4

0 回答 0