redis-dump 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +5 -1
- data/README.rdoc +25 -1
- data/VERSION.yml +1 -2
- data/bin/redis-dump +3 -2
- data/bin/redis-load +3 -2
- data/bin/redis-report +3 -2
- data/lib/redis/dump.rb +1 -1
- data/redis-dump.gemspec +1 -1
- metadata +1 -1
data/CHANGES.txt
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
REDIS-DUMP, CHANGES
|
2
2
|
|
3
|
+
#### 0.3.2 (2012-01-05) ###############################
|
4
|
+
|
5
|
+
* ADDED: Support setting redis URI via REDIS_URI environment variable
|
6
|
+
|
3
7
|
#### 0.3.1 (2012-01-05) ###############################
|
4
8
|
|
5
9
|
* ADDED: New global option for redis-dump: -f
|
6
10
|
|
7
|
-
#### 0.3.0 (2012-01-
|
11
|
+
#### 0.3.0 (2012-01-04) ###############################
|
8
12
|
|
9
13
|
* ADDED: Redis::Dump.dump_strings
|
10
14
|
* ADDED: New global options for redis-dump: -c, -O
|
data/README.rdoc
CHANGED
@@ -13,8 +13,15 @@ There are two executables: <tt>redis-dump</tt> and <tt>redis-load</tt>.
|
|
13
13
|
$ redis-dump -u 127.0.0.1:6371 > db_full.json
|
14
14
|
$ redis-dump -u 127.0.0.1:6371 -d 15 > db_db15.json
|
15
15
|
|
16
|
-
$ < db_full.json redis-load
|
16
|
+
$ < db_full.json redis-load
|
17
17
|
$ < db_db15.json redis-load -d 15
|
18
|
+
# OR
|
19
|
+
$ cat db_full | redis-load
|
20
|
+
$ cat db_db15.json | redis-load -d 15
|
21
|
+
|
22
|
+
# You can specify the redis URI via an environment variable
|
23
|
+
$ export REDIS_URI=127.0.0.1:6371
|
24
|
+
$ redis-dump
|
18
25
|
|
19
26
|
== Output format
|
20
27
|
|
@@ -39,6 +46,23 @@ Here are examples of each datatype:
|
|
39
46
|
One of the purposes of redis-dump is the ability to restore the database to a known state. When you restore a redis database from a redis-dump file, <em>the expires are reset to their values at the time the dump was created</em>. This is different from restoring from Redis' native .rdb or .aof files (expires are stored relative to the actual time they were set).
|
40
47
|
|
41
48
|
|
49
|
+
== Output directly to an encrypted file
|
50
|
+
|
51
|
+
For most sensitive data, you should consider encrypting the data directly without writing first to a temp file. You can do this using the power of [gpg](http://www.gnupg.org/) and file descriptors. Here are a couple examples:
|
52
|
+
|
53
|
+
# Encrypt the data (interactive)
|
54
|
+
$ redis-dump -u 127.0.0.1:6371 -d 15 | gpg --force-mdc -v -c > path/2/backup-db15.json.gpg
|
55
|
+
|
56
|
+
# Encrypt the data (automated)
|
57
|
+
$ redis-dump -u 127.0.0.1:6371 -d 15 | 3</path/2/passphrase.txt gpg --force-mdc -v -c --passphrase-fd 3 > path/2/backup-db15.json.gpg
|
58
|
+
|
59
|
+
# Decrypt the file (interactive)
|
60
|
+
$ gpg path/2/backup-db15.json.gpg
|
61
|
+
Enter passphrase: *******
|
62
|
+
|
63
|
+
# Decrypt the file (automated)
|
64
|
+
$ 3</path/2/passphrase.txt gpg --passphrase-fd 3 path/2/backup-db15.json.gpg
|
65
|
+
|
42
66
|
== Installation
|
43
67
|
|
44
68
|
$ gem install redis-dump
|
data/VERSION.yml
CHANGED
data/bin/redis-dump
CHANGED
@@ -32,7 +32,7 @@ class Redis::Dump::CLI
|
|
32
32
|
global :f, :filter, String, "Filter selected keys (passed directly to redis' KEYS command)"
|
33
33
|
global :O, :without_optimizations, "Disable run time optimizations"
|
34
34
|
global :V, :version, "Display version" do
|
35
|
-
puts "
|
35
|
+
puts "redis-dump v#{Redis::Dump::VERSION.to_s}"
|
36
36
|
exit 0
|
37
37
|
end
|
38
38
|
global :D, :debug do
|
@@ -43,13 +43,14 @@ class Redis::Dump::CLI
|
|
43
43
|
end
|
44
44
|
|
45
45
|
before do |obj|
|
46
|
+
obj.global.uri ||= ENV['REDIS_URI']
|
46
47
|
obj.global.uri ||= 'redis://%s:%s' % [Redis::Dump.host, Redis::Dump.port]
|
47
48
|
obj.global.uri = 'redis://' << obj.global.uri unless obj.global.uri.match(/^redis:\/\//)
|
48
49
|
obj.global.database &&= obj.global.database.to_i
|
49
50
|
obj.global.database ||= (0..15)
|
50
51
|
Redis::Dump.with_optimizations = false if obj.global.without_optimizations
|
51
52
|
Redis::Dump.chunk_size = obj.global.count if obj.global.count
|
52
|
-
Redis::Dump.ld "
|
53
|
+
Redis::Dump.ld "redis_uri: #{obj.global.uri} (#{obj.global.database})"
|
53
54
|
Redis::Dump.ld "Process: #{$$}; Memory: #{Redis::Dump.memory_usage}" if Redis::Dump.debug
|
54
55
|
end
|
55
56
|
|
data/bin/redis-load
CHANGED
@@ -29,7 +29,7 @@ class Redis::Dump::CLI
|
|
29
29
|
global :d, :database, Integer, "Redis database (e.g. -d 15)"
|
30
30
|
global :s, :sleep, Integer, "Sleep for S seconds after dumping (for debugging)"
|
31
31
|
global :V, :version, "Display version" do
|
32
|
-
puts "
|
32
|
+
puts "redis-dump v#{Redis::Dump::VERSION.to_s}"
|
33
33
|
exit 0
|
34
34
|
end
|
35
35
|
global :D, :debug do
|
@@ -40,11 +40,12 @@ class Redis::Dump::CLI
|
|
40
40
|
end
|
41
41
|
|
42
42
|
before do |obj|
|
43
|
+
obj.global.uri ||= ENV['REDIS_URI']
|
43
44
|
obj.global.uri ||= 'redis://%s:%s' % [Redis::Dump.host, Redis::Dump.port]
|
44
45
|
obj.global.uri = 'redis://' << obj.global.uri unless obj.global.uri.match(/^redis:\/\//)
|
45
46
|
obj.global.database &&= obj.global.database.to_i
|
46
47
|
obj.global.database ||= (0..15)
|
47
|
-
Redis::Dump.ld "
|
48
|
+
Redis::Dump.ld "redis_uri: #{obj.global.uri} (#{obj.global.database})"
|
48
49
|
Redis::Dump.ld "Process: #{$$}; Memory: #{Redis::Dump.memory_usage}" if Redis::Dump.debug
|
49
50
|
end
|
50
51
|
|
data/bin/redis-report
CHANGED
@@ -33,7 +33,7 @@ class Redis::Dump::CLI
|
|
33
33
|
@verbose += 1
|
34
34
|
end
|
35
35
|
global :V, :version, "Display version" do
|
36
|
-
puts "
|
36
|
+
puts "redis-dump v#{Redis::Dump::VERSION.to_s}"
|
37
37
|
exit 0
|
38
38
|
end
|
39
39
|
global :D, :debug do
|
@@ -44,11 +44,12 @@ class Redis::Dump::CLI
|
|
44
44
|
end
|
45
45
|
|
46
46
|
before do |obj|
|
47
|
+
obj.global.uri ||= ENV['REDIS_URI']
|
47
48
|
obj.global.uri ||= 'redis://%s:%s' % [Redis::Dump.host, Redis::Dump.port]
|
48
49
|
obj.global.uri = 'redis://' << obj.global.uri unless obj.global.uri.match(/^redis:\/\//)
|
49
50
|
obj.global.database &&= obj.global.database.to_i
|
50
51
|
obj.global.database ||= (0..15)
|
51
|
-
Redis::Dump.ld "
|
52
|
+
Redis::Dump.ld "redis_uri: #{obj.global.uri} (#{obj.global.database})"
|
52
53
|
Redis::Dump.ld "Process: #{$$}; Memory: #{Redis::Dump.memory_usage}" if Redis::Dump.debug
|
53
54
|
end
|
54
55
|
|
data/lib/redis/dump.rb
CHANGED
@@ -244,7 +244,7 @@ class Redis
|
|
244
244
|
@info[:OWNER]
|
245
245
|
end
|
246
246
|
def self.to_s
|
247
|
-
[@info[:MAJOR], @info[:MINOR], @info[:PATCH]
|
247
|
+
[@info[:MAJOR], @info[:MINOR], @info[:PATCH]].join('.')
|
248
248
|
end
|
249
249
|
def self.path
|
250
250
|
File.join(RD_HOME, 'VERSION.yml')
|
data/redis-dump.gemspec
CHANGED