redis-dump 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.txt +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/redis/dump/version.rb +1 -1
- data/redis-dump.gemspec +3 -3
- metadata +7 -11
- data/.pre-commit-config.yaml +0 -69
- data/.rubocop.yml +0 -13
- data/try/10_redis_dump_try.rb +0 -65
- data/try/20_dump_specific_keys_try.rb +0 -39
- data/try/30_dump_base64_try.rb +0 -52
- data/try/db0.json +0 -5
- data/try/redis.conf +0 -35
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5ae875f0b9d36b8e678c2bca1e61cab964b4e569082c3d2bcf9a011946fae691
|
|
4
|
+
data.tar.gz: ecd31cd6af2db2b240acd04feac2ac999f5b128feaa4ed590016aca9fa57cf5f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 138c2807ba899096b173b6fb2fd5a82fde3cd90d0bcd5cd3f32d950ebffa39a6f56df8fafaba3c390862b6513f36bdc10c1259c14cbc5237dc2ffa688198e704
|
|
7
|
+
data.tar.gz: 76a7e3f910c9a5bc8af9ac7486952735db4aa8cb3b57934a98d5caf6ab362cad3b574b97ed59a639a0530872d1f1b96eff7435a854ec9a4b58caadeba1405ac9
|
data/CHANGES.txt
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/lib/redis/dump/version.rb
CHANGED
data/redis-dump.gemspec
CHANGED
|
@@ -15,9 +15,9 @@ Gem::Specification.new do |spec|
|
|
|
15
15
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.8")
|
|
16
16
|
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
18
|
-
f.match(%r{\A(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor})
|
|
18
|
+
f.match(%r{\A(?:bin|test|spec|features|try)/|\.(?:git|circleci)|appveyor|pre|rub})
|
|
19
19
|
end
|
|
20
|
-
spec.bindir = "
|
|
21
|
-
spec.executables = spec.files.grep(%r{\
|
|
20
|
+
spec.bindir = "exe"
|
|
21
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
22
22
|
spec.require_paths = ["lib"]
|
|
23
23
|
end
|
metadata
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: redis-dump
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- delano
|
|
8
8
|
autorequire:
|
|
9
|
-
bindir:
|
|
9
|
+
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-06-
|
|
11
|
+
date: 2024-06-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Backup and restore your Redis data to and from JSON by database, key,
|
|
14
14
|
or key pattern.
|
|
15
15
|
email: gems@solutious.com
|
|
16
|
-
executables:
|
|
16
|
+
executables:
|
|
17
|
+
- redis-dump
|
|
18
|
+
- redis-load
|
|
19
|
+
- redis-report
|
|
17
20
|
extensions: []
|
|
18
21
|
extra_rdoc_files: []
|
|
19
22
|
files:
|
|
20
|
-
- ".pre-commit-config.yaml"
|
|
21
|
-
- ".rubocop.yml"
|
|
22
23
|
- CHANGES.txt
|
|
23
24
|
- Gemfile
|
|
24
25
|
- Gemfile.lock
|
|
@@ -33,11 +34,6 @@ files:
|
|
|
33
34
|
- lib/redis/dump/version.rb
|
|
34
35
|
- redis-dump.gemspec
|
|
35
36
|
- sig/redis/dump.rbs
|
|
36
|
-
- try/10_redis_dump_try.rb
|
|
37
|
-
- try/20_dump_specific_keys_try.rb
|
|
38
|
-
- try/30_dump_base64_try.rb
|
|
39
|
-
- try/db0.json
|
|
40
|
-
- try/redis.conf
|
|
41
37
|
homepage: https://rubygems.org/gems/redis-dump
|
|
42
38
|
licenses:
|
|
43
39
|
- MIT
|
data/.pre-commit-config.yaml
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# Pre-Commit Configuration
|
|
3
|
-
#
|
|
4
|
-
# Initial setup:
|
|
5
|
-
#
|
|
6
|
-
# 0. Install the pre-commit framework (if it isn't already on your system):
|
|
7
|
-
|
|
8
|
-
# $ pip install pre-commit
|
|
9
|
-
#
|
|
10
|
-
# 1. Install the git hook:
|
|
11
|
-
#
|
|
12
|
-
# $ pre-commit install
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
# Other commands:
|
|
16
|
-
#
|
|
17
|
-
# Run it on all the files in this repo:
|
|
18
|
-
# $ pre-commit run --all-files
|
|
19
|
-
#
|
|
20
|
-
# Updating plugin repositories:
|
|
21
|
-
# $ pre-commit autoupdate
|
|
22
|
-
#
|
|
23
|
-
# Automatically enable pre-commit on repositories
|
|
24
|
-
# $ git config --global init.templateDir ~/.git-template
|
|
25
|
-
# $ pre-commit init-templatedir ~/.git-template
|
|
26
|
-
#
|
|
27
|
-
# See also:
|
|
28
|
-
# - https://pre-commit.com for more information
|
|
29
|
-
# - https://pre-commit.com/hooks.html for more hooks
|
|
30
|
-
#
|
|
31
|
-
|
|
32
|
-
default_install_hook_types:
|
|
33
|
-
- pre-commit
|
|
34
|
-
- prepare-commit-msg
|
|
35
|
-
|
|
36
|
-
fail_fast: true
|
|
37
|
-
|
|
38
|
-
repos:
|
|
39
|
-
- repo: meta
|
|
40
|
-
hooks:
|
|
41
|
-
- id: check-hooks-apply
|
|
42
|
-
- id: check-useless-excludes
|
|
43
|
-
- id: identity
|
|
44
|
-
|
|
45
|
-
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
46
|
-
rev: v4.6.0
|
|
47
|
-
hooks:
|
|
48
|
-
- id: trailing-whitespace
|
|
49
|
-
- id: end-of-file-fixer
|
|
50
|
-
- id: check-yaml
|
|
51
|
-
- id: detect-private-key
|
|
52
|
-
- id: mixed-line-ending
|
|
53
|
-
- id: check-added-large-files
|
|
54
|
-
args: ["--maxkb=1000"]
|
|
55
|
-
- id: no-commit-to-branch
|
|
56
|
-
args: ["--branch", "develop", "--branch", "rel/.*"]
|
|
57
|
-
- id: check-merge-conflict
|
|
58
|
-
- id: forbid-submodules
|
|
59
|
-
|
|
60
|
-
- repo: https://github.com/avilaton/add-msg-issue-prefix-hook
|
|
61
|
-
rev: v0.0.11
|
|
62
|
-
hooks:
|
|
63
|
-
- id: add-msg-issue-prefix
|
|
64
|
-
stages: [prepare-commit-msg]
|
|
65
|
-
name: Link commit to Github issue
|
|
66
|
-
args:
|
|
67
|
-
- "--default=[NOJIRA]"
|
|
68
|
-
- "--pattern=[a-zA-Z0-9]{0,10}-?[0-9]{1,5}"
|
|
69
|
-
- "--template=[#{}]"
|
data/.rubocop.yml
DELETED
data/try/10_redis_dump_try.rb
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative '../lib/redis/dump'
|
|
4
|
-
|
|
5
|
-
# The test instance of redis must be running:
|
|
6
|
-
# $ redis-server try/redis.conf
|
|
7
|
-
|
|
8
|
-
@uri_base = "redis://127.0.0.1:6379"
|
|
9
|
-
|
|
10
|
-
Redis::Dump.debug = false
|
|
11
|
-
Redis::Dump.safe = true
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## Connect to DB
|
|
15
|
-
@rdump = Redis::Dump.new 0, @uri_base
|
|
16
|
-
@rdump.redis_connections.size
|
|
17
|
-
#=> 1
|
|
18
|
-
|
|
19
|
-
## Populate
|
|
20
|
-
@rdump.redis(0).set 'stringkey', 'stringvalue'
|
|
21
|
-
@rdump.redis(0).expire 'stringkey', 100
|
|
22
|
-
@rdump.redis(0).hset 'hashkey', 'field_a', 'value_a'
|
|
23
|
-
@rdump.redis(0).hset 'hashkey', 'field_b', 'value_b'
|
|
24
|
-
@rdump.redis(0).hset 'hashkey', 'field_c', 'value_c'
|
|
25
|
-
3.times { |idx| @rdump.redis(0).rpush 'listkey', "value_#{idx}" }
|
|
26
|
-
4.times { |idx| @rdump.redis(0).sadd? 'setkey', "value_#{idx}" }
|
|
27
|
-
5.times { |idx| @rdump.redis(0).zadd 'zsetkey', idx.zero? ? 100 : 100*idx, "value_#{idx}" }
|
|
28
|
-
@rdump.redis(0).keys.size
|
|
29
|
-
#=> 5
|
|
30
|
-
|
|
31
|
-
## Can dump
|
|
32
|
-
@values = @rdump.dump
|
|
33
|
-
@values.size
|
|
34
|
-
#=> 5
|
|
35
|
-
|
|
36
|
-
## Can load data
|
|
37
|
-
@rdump.load @values.join
|
|
38
|
-
@rdump.redis(0).keys.size
|
|
39
|
-
#=> 5
|
|
40
|
-
|
|
41
|
-
## DB 0 content matches previous dump content
|
|
42
|
-
values = @rdump.dump
|
|
43
|
-
[values[0], values.size]
|
|
44
|
-
#=> [@values[0], @values.size]
|
|
45
|
-
|
|
46
|
-
## Won't load data in safe mode if records exist
|
|
47
|
-
@rdump.load @values.join
|
|
48
|
-
#=> 0
|
|
49
|
-
|
|
50
|
-
## Will load data if records exist and safe mode is disabled
|
|
51
|
-
Redis::Dump.safe = false
|
|
52
|
-
@rdump.load @values.join
|
|
53
|
-
#=> 5
|
|
54
|
-
|
|
55
|
-
## Clear DB 0
|
|
56
|
-
db0 = Redis::Dump.new 0, @uri_base
|
|
57
|
-
db0.redis(0).flushdb
|
|
58
|
-
db0.redis(0).keys.size
|
|
59
|
-
#=> 0
|
|
60
|
-
|
|
61
|
-
## Clear DB 0 in safe mode
|
|
62
|
-
Redis::Dump.safe = true
|
|
63
|
-
db0 = Redis::Dump.new 0, @uri_base
|
|
64
|
-
db0.redis(0).flushdb
|
|
65
|
-
#=> "OK"
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative '../lib/redis/dump'
|
|
4
|
-
|
|
5
|
-
# The test instance of redis must be running:
|
|
6
|
-
# $ redis-server try/redis.conf
|
|
7
|
-
|
|
8
|
-
@uri_base = "redis://127.0.0.1:6379"
|
|
9
|
-
|
|
10
|
-
Redis::Dump.debug = false
|
|
11
|
-
Redis::Dump.safe = true
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## Connect to DB
|
|
15
|
-
@rdump = Redis::Dump.new 0..1, @uri_base
|
|
16
|
-
@rdump.redis_connections.size
|
|
17
|
-
#=> 2
|
|
18
|
-
|
|
19
|
-
## Populate
|
|
20
|
-
3.times { |idx| @rdump.redis(0).set "gloria:#{idx}", "gloria_value[#{idx}]" } # yp.ca
|
|
21
|
-
4.times { |idx| @rdump.redis(0).set "pamela:#{idx}", "pamela_value[#{idx}]" } # soap web service
|
|
22
|
-
2.times { |idx| @rdump.redis(1).set "nikola:#{idx}", "nikola_value[#{idx}]" } # m.yp.ca log analyzer
|
|
23
|
-
[@rdump.redis(0).keys.size, @rdump.redis(1).keys.size]
|
|
24
|
-
#=> [7, 2]
|
|
25
|
-
|
|
26
|
-
## Generate a list of keys
|
|
27
|
-
@keys = @rdump.redis(0).keys('*gloria*').collect { |key| URI.parse "#{@uri_base}/0/#{key}" }
|
|
28
|
-
@keys.push *@rdump.redis(1).keys('*nikola*').collect { |key| URI.parse "#{@uri_base}/1/#{key}" }
|
|
29
|
-
@keys.size
|
|
30
|
-
#=> 5
|
|
31
|
-
|
|
32
|
-
## Dump these specific keys
|
|
33
|
-
@rdump.dump('*gloria*').sort
|
|
34
|
-
#=> ['{"db":0,"key":"gloria:0","ttl":-1,"type":"string","value":"gloria_value[0]","size":15}','{"db":0,"key":"gloria:1","ttl":-1,"type":"string","value":"gloria_value[1]","size":15}','{"db":0,"key":"gloria:2","ttl":-1,"type":"string","value":"gloria_value[2]","size":15}']
|
|
35
|
-
|
|
36
|
-
Redis::Dump.safe = true
|
|
37
|
-
db0 = Redis::Dump.new 0..1, @uri_base
|
|
38
|
-
db0.redis(0).flushdb
|
|
39
|
-
db0.redis(1).flushdb
|
data/try/30_dump_base64_try.rb
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative '../lib/redis/dump'
|
|
4
|
-
# require 'pry-byebug'
|
|
5
|
-
|
|
6
|
-
# The test instance of redis must be running:
|
|
7
|
-
# $ redis-server try/redis.conf
|
|
8
|
-
|
|
9
|
-
@uri_base = "redis://127.0.0.1:6379"
|
|
10
|
-
|
|
11
|
-
Redis::Dump.debug = true # leave enabled for CI workflow
|
|
12
|
-
Redis::Dump.safe = true
|
|
13
|
-
Redis::Dump.with_base64 = true
|
|
14
|
-
|
|
15
|
-
## Connect to DB
|
|
16
|
-
@rdump = Redis::Dump.new 0..1, @uri_base
|
|
17
|
-
@rdump.redis_connections.size
|
|
18
|
-
#=> 2
|
|
19
|
-
|
|
20
|
-
## Populate
|
|
21
|
-
@rdump.redis(0).set 'stringkey1', 'stringvalue1'
|
|
22
|
-
@rdump.redis(0).set 'stringkey2', 'stringvalue2'
|
|
23
|
-
@rdump.redis(0).keys.size
|
|
24
|
-
#=> 2
|
|
25
|
-
|
|
26
|
-
## Values are base64 encoded when with_base64=true
|
|
27
|
-
@values = @rdump.dump
|
|
28
|
-
# Check for values without relying on the order the keys were returned in
|
|
29
|
-
encoded_str = "{\"db\":0,\"key\":\"stringkey1\",\"ttl\":-1,\"type\":\"string\",\"value\":\"c3RyaW5ndmFsdWUx\\n\",\"size\":12}"
|
|
30
|
-
encoded_str2 = "{\"db\":0,\"key\":\"stringkey2\",\"ttl\":-1,\"type\":\"string\",\"value\":\"c3RyaW5ndmFsdWUy\\n\",\"size\":12}"
|
|
31
|
-
[@values.include?(encoded_str), @values.include?(encoded_str2)]
|
|
32
|
-
#=> [true, true]
|
|
33
|
-
|
|
34
|
-
## Can dump
|
|
35
|
-
@values = @rdump.dump
|
|
36
|
-
@values.size
|
|
37
|
-
#=> 2
|
|
38
|
-
|
|
39
|
-
## Can load data
|
|
40
|
-
@rdump.load @values.join
|
|
41
|
-
@rdump.redis(0).keys.size
|
|
42
|
-
#=> 2
|
|
43
|
-
|
|
44
|
-
# Clear DB 0
|
|
45
|
-
db0 = Redis::Dump.new 0, @uri_base
|
|
46
|
-
db0.redis(0).flushdb
|
|
47
|
-
db0.redis(0).keys.size
|
|
48
|
-
##=> 0
|
|
49
|
-
|
|
50
|
-
Redis::Dump.safe = true
|
|
51
|
-
db0 = Redis::Dump.new 0, @uri_base
|
|
52
|
-
db0.redis(0).flushdb
|
data/try/db0.json
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
{"db":0,"key":"hashkey","ttl":-1,"type":"hash","value":{"field_a":"value_a","field_b":"value_b","field_c":"value_c"},"size":42}
|
|
2
|
-
{"db":0,"key":"listkey","ttl":-1,"type":"list","value":["value_0","value_1","value_2","value_0","value_1","value_2"],"size":42}
|
|
3
|
-
{"db":0,"key":"setkey","ttl":-1,"type":"set","value":["value_2","value_0","value_1","value_3"],"size":28}
|
|
4
|
-
{"db":0,"key":"zsetkey","ttl":-1,"type":"zset","value":[["value_0","100"],["value_1","100"],["value_2","200"],["value_3","300"],["value_4","400"]],"size":50}
|
|
5
|
-
{"db":0,"key":"stringkey","ttl":79,"type":"string","value":"stringvalue","size":11}
|
data/try/redis.conf
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# redis-dump redis config
|
|
2
|
-
# 2017-11-09
|
|
3
|
-
|
|
4
|
-
dir /tmp
|
|
5
|
-
pidfile redisdump-test.pid
|
|
6
|
-
logfile redisdump-test.log
|
|
7
|
-
dbfilename redisdump-test.rdb
|
|
8
|
-
|
|
9
|
-
# requirepass @/
|
|
10
|
-
|
|
11
|
-
bind 127.0.0.1
|
|
12
|
-
port 6379
|
|
13
|
-
databases 16
|
|
14
|
-
|
|
15
|
-
timeout 30
|
|
16
|
-
daemonize yes
|
|
17
|
-
loglevel notice
|
|
18
|
-
|
|
19
|
-
# FOR LIGHT TRAFFIC:
|
|
20
|
-
#save 300 10
|
|
21
|
-
#save 120 100
|
|
22
|
-
#save 60 1000
|
|
23
|
-
|
|
24
|
-
# NOTE: we need something here to force redis to save
|
|
25
|
-
# when it receives a SHUTDOWN command. 157680000 is 5 yrs.
|
|
26
|
-
# REMOVE IT ONLY IF YOU PLAN TO ALWAYS MOVE
|
|
27
|
-
# AN RDB FILE INTO PLACE EVERY RESTART!
|
|
28
|
-
save 157680000 1
|
|
29
|
-
|
|
30
|
-
rdbcompression yes
|
|
31
|
-
|
|
32
|
-
appendonly no
|
|
33
|
-
|
|
34
|
-
# appendfsync is one of always, everysec, no
|
|
35
|
-
appendfsync everysec
|