gpt4 book ai didi

python - 我如何获得 Redis 中的所有键?总共 1+ 十亿个 key

转载 作者:IT王子 更新时间:2023-10-29 06:03:37 25 4
gpt4 key购买 nike

redis 中有超过 10 亿个键。
现在我想获取 ALL python 中的键。

partkeys = redisclient.keys("abcd*")

会好的。
但是

keys = redisclient.keys("ab*")

将引发 ResponseError。

redis.exceptions.ResponseError: keys err

keys = redisclient.keys("*")

将引发连接错误。
redis.exceptions.ConnectionError: 错误 111 连接 demo.abcd.com:6397。连接被拒绝。

有什么帮助吗?

最佳答案

然后使用 SCAN命令循环你的键集。使用 KEYS 总是一个坏主意。请注意,SCAN 仅在 Redis 2.8.0 之后可用。

关于python - 我如何获得 Redis 中的所有键?总共 1+ 十亿个 key ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26521783/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com