gpt4 book ai didi

redis - 如何从多个 RDB 文件中恢复 Redis

转载 作者:行者123 更新时间:2023-12-03 06:37:52 34 4
gpt4 key购买 nike

多个 rdb 文件来自不同的 redis 服务器。现在我想将数据文件合并到单个 redis 服务器。到目前为止,我只能找到使用单个 dump.rdb 文件进行恢复的答案。

最佳答案

最简单的方法是使用 DEBUG RELOAD ,一个未记录的命令。

DEBUG RELOAD [MERGE] [NOFLUSH] [NOSAVE]

Save the RDB on disk and reload it back in memory. By default it willsave the RDB file and load it back.

With the NOFLUSH option the current database is not removed before loading the new one, butconficts in keys will kill the server with an exception.

When MERGE isused, conflicting keys will be loaded (the key in the loaded RDB filewill win).

When NOSAVE is used, the server will not save the currentdataset in the RDB file before loading.

Use DEBUG RELOAD NOSAVE whenyou want just to load the RDB file you placed in the Redis workingdirectory in order to replace the current dataset in memory.

Use DEBUG RELOAD NOSAVE NOFLUSH MERGE when you want to add what is in thecurrent RDB file placed in the Redis current directory, with thecurrent memory content.

Use DEBUG RELOAD when you want to verify Redisis able to persist the current dataset in the RDB file, flush thememory content, and load it back.",


以上摘自 debug.c ,应用友好的格式。
所以,使用 DEBUG RELOAD NOSAVE NOFLUSH如果您想确保不同 RDB 中没有重复的键。使用 DEBUG RELOAD NOSAVE NOFLUSH MERGE如果你知道你有重复,最后加载你想要的那个。

关于redis - 如何从多个 RDB 文件中恢复 Redis,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63738535/

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