Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
435 views
in Technique[技术] by (71.8m points)

caching - Redis HSET keys expire after few minutes

I am trying to connect to a remote redis server and set keys using HSET command like below

hset ABCD:1105 balance 1000

I can able to see the Key using KEYS *

But after approx 1 minute the KEYS * returns empty (empty list or set) . Whereas TTL on the key returns -1.

This is the memory configuration in the redis server

 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"

Here the max memory policy is also noeviction. Then why the Keys are getting expired.

Updating the logs of 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

Update2 : Memory Info

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...