TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Redis-dump: Backup and restore Redis with JSON

33 pointsby delanoover 13 years ago

3 comments

antirezover 13 years ago
It's a good effort, but it is not the right approach IMHO. Redis is very good at producing point-in-time snapshots via RDB files, so I think the right thing to do is to create a tool, or add this feature to redis-cli, so that it is able to translate RDB files into JSON and the other way around.<p>Also I think that a "generic" JSON is not a good idea, since a single JSON value can be a multi million elements list or alike. The best thing to do is to create a JSON that is also specifically conceived to be both valid but to also have a single element per line, so that can be parsed much faster and with minimal state without a real JSON parser if needed.
评论 #3437891 未加载
评论 #3438183 未加载
redbadover 13 years ago
<p><pre><code> def dump filter=nil filter ||= '*' entries = [] each_database do |redis| chunk_entries = [] dump_keys = redis.keys(filter) . . . </code></pre> <a href="http://redis.io/commands/keys" rel="nofollow">http://redis.io/commands/keys</a><p><i>Warning: consider KEYS as a command that should only be used in production environments with extreme care. It may ruin performance when it is executed against large databases. This command is intended for debugging and special operations, such as changing your keyspace layout. Don't use KEYS in your regular application code.</i>
评论 #3438543 未加载
midnightsunover 13 years ago
Why not just copy the rdb file?