简体   繁体   English

在某些键上使用 TTL 调试 redis db

[英]debugging redis db with TTL on some keys

I have a .rdb file from Redis, which contains keys with TTL.我有一个来自 Redis 的 .rdb 文件,其中包含带 TTL 的键。 The rdb file is quite old, I would like to examinate contents in order to debug my application. rdb 文件很旧,我想检查一下内容以便调试我的应用程序。 However, when loading the .rdb file in Redis keys are automatically removed because of expiration.但是,在Redis中加载.rdb文件时,key会因为过期而被自动删除。

Is there a way to tell redis to ignore expiration ?有没有办法告诉 redis 忽略到期时间? So I can look at keys to do my debugging without having those removed...因此,我可以查看进行调试的键,而无需删除这些键...

Maybe it's possible by changing my computer time and date but I would really want to avoid this.也许可以通过更改我的计算机时间和日期来实现,但我真的很想避免这种情况。

Any help would be appreciated !任何帮助,将不胜感激 !

I found this tool: https://github.com/sripathikrishnan/redis-rdb-tools我找到了这个工具: https : //github.com/sripathikrishnan/redis-rdb-tools

It allows to read a .rdb file, to emit contents as Redis protocol.它允许读取 .rdb 文件,以 Redis 协议的形式发出内容。 The -x option do not set TTL on keys. -x选项不会在键上设置 TTL。 Using redis-cli --pipe , it is possible to populate a fresh redis instance with all contents from the .rdb file:使用redis-cli --pipe ,可以使用 .rdb 文件中的所有内容填充新的 redis 实例:

rdb -c protocol rdb_file_to_debug.rdb -x | redis-cli --pipe

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM