elastic-backup-2s3 0.0.3 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.semver +2 -2
- data/Gemfile +7 -5
- data/Gemfile.lock +27 -23
- data/README.org +41 -14
- data/elastic-backup-2s3.gemspec +24 -18
- data/lib/elastic-backup-2s3/cli/list.rb +1 -0
- data/lib/elastic-backup-2s3/cli.rb +33 -6
- data/lib/elastic-backup-2s3/snapshot.rb +23 -12
- metadata +40 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b0edbad64d4b3d88a4b8930ccdc322d095a50a6
|
4
|
+
data.tar.gz: 7f038e5b440d1869f1ce0a34602b36459de43c9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a924475b768ba81d75ac833613fbfbc0373326c0c6f700f4ba0269e2a8ee2a5df029b51550939b85e89009e62c0b06f7b6170fe4c3dae8b4fc44741d30c3102e
|
7
|
+
data.tar.gz: 70bdd3efbd2983874b57a8cbbd09b9485d9c9466d80c366524531c9213c0de31278e3dedb7aa9796dc011f69c49ba18a1f348a4f404d9c8323eec0ab7eb9e932
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.1
|
data/.semver
CHANGED
data/Gemfile
CHANGED
@@ -8,13 +8,15 @@ gem "faraday", "~> 0"
|
|
8
8
|
gem "activesupport", "~> 4"
|
9
9
|
gem "awesome_print", "~> 1"
|
10
10
|
gem "text-table", "~> 1"
|
11
|
+
gem "thor", "~> 0"
|
12
|
+
gem "colorize", "~> 0"
|
11
13
|
|
12
14
|
group :development do
|
13
|
-
gem "rspec", "~> 2
|
14
|
-
gem "yard", "~> 0
|
15
|
-
gem "rdoc", "~> 3
|
16
|
-
gem "bundler", "~> 1
|
17
|
-
gem "juwelier", "~> 2
|
15
|
+
gem "rspec", "~> 2"
|
16
|
+
gem "yard", "~> 0"
|
17
|
+
gem "rdoc", "~> 3"
|
18
|
+
gem "bundler", "~> 1"
|
19
|
+
gem "juwelier", "~> 2"
|
18
20
|
gem "simplecov", ">= 0"
|
19
21
|
|
20
22
|
gem 'pry', '~> 0'
|
data/Gemfile.lock
CHANGED
@@ -9,21 +9,22 @@ GEM
|
|
9
9
|
tzinfo (~> 1.1)
|
10
10
|
addressable (2.4.0)
|
11
11
|
awesome_print (1.6.1)
|
12
|
-
aws-sdk (2.
|
13
|
-
aws-sdk-resources (= 2.
|
14
|
-
aws-sdk-core (2.
|
12
|
+
aws-sdk (2.3.0)
|
13
|
+
aws-sdk-resources (= 2.3.0)
|
14
|
+
aws-sdk-core (2.3.0)
|
15
15
|
jmespath (~> 1.0)
|
16
|
-
aws-sdk-resources (2.
|
17
|
-
aws-sdk-core (= 2.
|
16
|
+
aws-sdk-resources (2.3.0)
|
17
|
+
aws-sdk-core (= 2.3.0)
|
18
18
|
binding_of_caller (0.7.2)
|
19
19
|
debug_inspector (>= 0.0.1)
|
20
20
|
builder (3.2.2)
|
21
|
-
byebug (8.2.
|
21
|
+
byebug (8.2.5)
|
22
22
|
coderay (1.1.1)
|
23
|
+
colorize (0.7.7)
|
23
24
|
debug_inspector (0.0.2)
|
24
25
|
descendants_tracker (0.0.4)
|
25
26
|
thread_safe (~> 0.3, >= 0.3.1)
|
26
|
-
diff-lcs (1.
|
27
|
+
diff-lcs (1.2.5)
|
27
28
|
docile (1.1.5)
|
28
29
|
elasticsearch (1.0.17)
|
29
30
|
elasticsearch-api (= 1.0.17)
|
@@ -43,7 +44,7 @@ GEM
|
|
43
44
|
hashie (>= 3.4)
|
44
45
|
multi_json (>= 1.7.5, < 2.0)
|
45
46
|
oauth2
|
46
|
-
hashie (3.4.
|
47
|
+
hashie (3.4.4)
|
47
48
|
highline (1.7.8)
|
48
49
|
i18n (0.7.0)
|
49
50
|
interception (0.5)
|
@@ -51,7 +52,7 @@ GEM
|
|
51
52
|
json_pure (>= 1.8.1)
|
52
53
|
json (1.8.3)
|
53
54
|
json_pure (1.8.3)
|
54
|
-
juwelier (2.1.
|
55
|
+
juwelier (2.1.1)
|
55
56
|
builder
|
56
57
|
bundler (>= 1.0)
|
57
58
|
git (>= 1.2.5)
|
@@ -65,7 +66,7 @@ GEM
|
|
65
66
|
method_source (0.8.2)
|
66
67
|
mini_portile2 (2.0.0)
|
67
68
|
minitest (5.8.4)
|
68
|
-
multi_json (1.11.
|
69
|
+
multi_json (1.11.3)
|
69
70
|
multi_xml (0.5.5)
|
70
71
|
multipart-post (2.0.0)
|
71
72
|
nokogiri (1.6.7.2)
|
@@ -99,14 +100,14 @@ GEM
|
|
99
100
|
rake (11.1.2)
|
100
101
|
rdoc (3.12.2)
|
101
102
|
json (~> 1.4)
|
102
|
-
rspec (2.
|
103
|
-
rspec-core (~> 2.
|
104
|
-
rspec-expectations (~> 2.
|
105
|
-
rspec-mocks (~> 2.
|
106
|
-
rspec-core (2.
|
107
|
-
rspec-expectations (2.
|
108
|
-
diff-lcs (
|
109
|
-
rspec-mocks (2.
|
103
|
+
rspec (2.99.0)
|
104
|
+
rspec-core (~> 2.99.0)
|
105
|
+
rspec-expectations (~> 2.99.0)
|
106
|
+
rspec-mocks (~> 2.99.0)
|
107
|
+
rspec-core (2.99.2)
|
108
|
+
rspec-expectations (2.99.2)
|
109
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
110
|
+
rspec-mocks (2.99.4)
|
110
111
|
semver (1.0.1)
|
111
112
|
simplecov (0.11.2)
|
112
113
|
docile (~> 1.1.0)
|
@@ -115,6 +116,7 @@ GEM
|
|
115
116
|
simplecov-html (0.10.0)
|
116
117
|
slop (3.6.0)
|
117
118
|
text-table (1.2.4)
|
119
|
+
thor (0.19.1)
|
118
120
|
thread_safe (0.3.5)
|
119
121
|
tzinfo (1.2.2)
|
120
122
|
thread_safe (~> 0.1)
|
@@ -127,10 +129,11 @@ DEPENDENCIES
|
|
127
129
|
activesupport (~> 4)
|
128
130
|
awesome_print (~> 1)
|
129
131
|
aws-sdk (~> 2)
|
130
|
-
bundler (~> 1
|
132
|
+
bundler (~> 1)
|
133
|
+
colorize (~> 0)
|
131
134
|
elasticsearch (~> 1)
|
132
135
|
faraday (~> 0)
|
133
|
-
juwelier (~> 2
|
136
|
+
juwelier (~> 2)
|
134
137
|
multi_json (~> 1)
|
135
138
|
pry (~> 0)
|
136
139
|
pry-byebug (~> 3)
|
@@ -138,12 +141,13 @@ DEPENDENCIES
|
|
138
141
|
pry-remote (~> 0)
|
139
142
|
pry-rescue (~> 1)
|
140
143
|
pry-stack_explorer (~> 0)
|
141
|
-
rdoc (~> 3
|
142
|
-
rspec (~> 2
|
144
|
+
rdoc (~> 3)
|
145
|
+
rspec (~> 2)
|
143
146
|
semver (~> 1)
|
144
147
|
simplecov
|
145
148
|
text-table (~> 1)
|
146
|
-
|
149
|
+
thor (~> 0)
|
150
|
+
yard (~> 0)
|
147
151
|
|
148
152
|
BUNDLED WITH
|
149
153
|
1.11.2
|
data/README.org
CHANGED
@@ -7,14 +7,8 @@
|
|
7
7
|
without any fuss or having to dilly around with
|
8
8
|
curl -XPUTS and friends.
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
snapshots. I may add support at a later date. Or
|
13
|
-
feel free to add it and do a pull request.
|
14
|
-
|
15
|
-
There are many features I wish to add to this, and
|
16
|
-
if you have any suggestions, please feel free to send
|
17
|
-
them my way!
|
10
|
+
I have finally added Shared Filesystem Support!
|
11
|
+
Please see the docs below on this.
|
18
12
|
|
19
13
|
** Overview
|
20
14
|
Elastic Backup simply allows you to specifiy some
|
@@ -38,7 +32,6 @@
|
|
38
32
|
gem 'elastic-backup-2s3'
|
39
33
|
#+end_src
|
40
34
|
|
41
|
-
|
42
35
|
** TODO Documentation
|
43
36
|
Documentation is comming. Basically,
|
44
37
|
just running the command without any parameters
|
@@ -54,6 +47,37 @@
|
|
54
47
|
In some cases, :SNAPSHOT is optional, but usually
|
55
48
|
expected to be there.
|
56
49
|
|
50
|
+
*** Support for Shared Filesystem Snapshots
|
51
|
+
To do S3 backups requires no additional configurations
|
52
|
+
outside of being in the AWS clould (or at least being
|
53
|
+
connected to one.) Shared File System (FS) backups require
|
54
|
+
that you have each and every node configured to permit
|
55
|
+
the backup path on all your nodes in the cluster, and
|
56
|
+
thus not as simple as merely writing it through the
|
57
|
+
JSON REST interface.
|
58
|
+
|
59
|
+
So presumably you either have this setup in place, and
|
60
|
+
in any rate, it would be a bit messy to have to specify
|
61
|
+
the "local" path in the repo here.
|
62
|
+
|
63
|
+
For this reason we will not (over)write the repo settings
|
64
|
+
for FS backups by default. We provide a new option that will
|
65
|
+
allow you to write out the FS repo, specifying all the
|
66
|
+
parameters you need to at that time.
|
67
|
+
|
68
|
+
The default repository name should be configurable in any case.
|
69
|
+
we could do a configuration file, but for this I think it's
|
70
|
+
overkill. so we will use environment variables instead.
|
71
|
+
|
72
|
+
| Environment variable | Description |
|
73
|
+
|----------------------------+------------------------------------------------------------------------------------------------------------|
|
74
|
+
| ESB_DEFAULT_REPO | Changes the default repository from 'elastic-backup' to what is specified here. |
|
75
|
+
| ESB_SHARED_VOLUME | For Shared Volume backups, default local path to use. Note that this path must be configured on all nodes. |
|
76
|
+
| ESB_TIMEOUT | Default for --timeout option |
|
77
|
+
| ESB_SNAPSHOT_MAX_BYTES_SEC | Shared Volume max_snapshot_bytes_per_sec |
|
78
|
+
| ESB_RESTORE_MAX_BYTES_SEC | Shared Volume max_restore_bytes_per_sec |
|
79
|
+
| | |
|
80
|
+
|
57
81
|
** Examples
|
58
82
|
To backup/snapshot your ES to S3
|
59
83
|
and wait until the backup is completed:
|
@@ -102,13 +126,16 @@
|
|
102
126
|
| Date | Version | Description |
|
103
127
|
|------------+---------+-------------------------------------------------------------------------|
|
104
128
|
| 2016-04-17 | v0.0.3 | Added a delete snapshot option to allow deletion of a running snapshot. |
|
129
|
+
| 2016-04-22 | v0.1.0 | Support for FS volume backups added |
|
105
130
|
| | | |
|
106
131
|
** Known Issues
|
107
|
-
| Date | Version | Description
|
108
|
-
| 2061-04-17 | v0.0.3 | 'delete' options not fully implemented.
|
109
|
-
| | | Error return codes not fully fleshed out
|
110
|
-
| | | 'delete snapshot' requires the full S3URL, but only needs the snapshot part.
|
111
|
-
|
|
132
|
+
| Date | Version | Description |
|
133
|
+
| 2061-04-17 | v0.0.3 | 'delete' options not fully implemented. |
|
134
|
+
| | | Error return codes not fully fleshed out |
|
135
|
+
| | | 'delete snapshot' requires the full S3URL, but only needs the snapshot part. |
|
136
|
+
| 2061-04-21 | v0.0.4 | Some features remain unimplemented, though there are options for them. Please bear with me. |
|
137
|
+
| | | What shall we do with configurations? I am thinking we save them in ES, but also allow for config files. The ES settings will override the config file settings. Config files in Yaml format. |
|
138
|
+
| | | |
|
112
139
|
|
113
140
|
** Scratchpad
|
114
141
|
My own personal notes on this project. These
|
data/elastic-backup-2s3.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: elastic-backup-2s3 0.
|
5
|
+
# stub: elastic-backup-2s3 0.1.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "elastic-backup-2s3"
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.1.1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Fred Mitchell"]
|
14
|
-
s.date = "2016-
|
14
|
+
s.date = "2016-05-02"
|
15
15
|
s.description = "\n I simply want to be able to control the backup and\n restoration of the Elasticsearch cluster to S3\n without any fuss or having to dilly around with\n curl -XPUTS and friends.\n\n So here it is, and I make no apologies about not \n supporting the \"shared volume\" option of Elasticsearch\n snapshots. I may add support at a later date. Or\n feel free to add it and do a pull request.\n\n There are many features I wish to add to this, and\n if you have any suggestions, please feel free to send\n them my way!"
|
16
16
|
s.email = "fred.mitchell@gmx.de"
|
17
17
|
s.executables = ["es-snapshot"]
|
@@ -57,11 +57,13 @@ Gem::Specification.new do |s|
|
|
57
57
|
s.add_runtime_dependency(%q<activesupport>, ["~> 4"])
|
58
58
|
s.add_runtime_dependency(%q<awesome_print>, ["~> 1"])
|
59
59
|
s.add_runtime_dependency(%q<text-table>, ["~> 1"])
|
60
|
-
s.
|
61
|
-
s.
|
62
|
-
s.add_development_dependency(%q<
|
63
|
-
s.add_development_dependency(%q<
|
64
|
-
s.add_development_dependency(%q<
|
60
|
+
s.add_runtime_dependency(%q<thor>, ["~> 0"])
|
61
|
+
s.add_runtime_dependency(%q<colorize>, ["~> 0"])
|
62
|
+
s.add_development_dependency(%q<rspec>, ["~> 2"])
|
63
|
+
s.add_development_dependency(%q<yard>, ["~> 0"])
|
64
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3"])
|
65
|
+
s.add_development_dependency(%q<bundler>, ["~> 1"])
|
66
|
+
s.add_development_dependency(%q<juwelier>, ["~> 2"])
|
65
67
|
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
66
68
|
s.add_development_dependency(%q<pry>, ["~> 0"])
|
67
69
|
s.add_development_dependency(%q<pry-byebug>, ["~> 3"])
|
@@ -78,11 +80,13 @@ Gem::Specification.new do |s|
|
|
78
80
|
s.add_dependency(%q<activesupport>, ["~> 4"])
|
79
81
|
s.add_dependency(%q<awesome_print>, ["~> 1"])
|
80
82
|
s.add_dependency(%q<text-table>, ["~> 1"])
|
81
|
-
s.add_dependency(%q<
|
82
|
-
s.add_dependency(%q<
|
83
|
-
s.add_dependency(%q<
|
84
|
-
s.add_dependency(%q<
|
85
|
-
s.add_dependency(%q<
|
83
|
+
s.add_dependency(%q<thor>, ["~> 0"])
|
84
|
+
s.add_dependency(%q<colorize>, ["~> 0"])
|
85
|
+
s.add_dependency(%q<rspec>, ["~> 2"])
|
86
|
+
s.add_dependency(%q<yard>, ["~> 0"])
|
87
|
+
s.add_dependency(%q<rdoc>, ["~> 3"])
|
88
|
+
s.add_dependency(%q<bundler>, ["~> 1"])
|
89
|
+
s.add_dependency(%q<juwelier>, ["~> 2"])
|
86
90
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
87
91
|
s.add_dependency(%q<pry>, ["~> 0"])
|
88
92
|
s.add_dependency(%q<pry-byebug>, ["~> 3"])
|
@@ -100,11 +104,13 @@ Gem::Specification.new do |s|
|
|
100
104
|
s.add_dependency(%q<activesupport>, ["~> 4"])
|
101
105
|
s.add_dependency(%q<awesome_print>, ["~> 1"])
|
102
106
|
s.add_dependency(%q<text-table>, ["~> 1"])
|
103
|
-
s.add_dependency(%q<
|
104
|
-
s.add_dependency(%q<
|
105
|
-
s.add_dependency(%q<
|
106
|
-
s.add_dependency(%q<
|
107
|
-
s.add_dependency(%q<
|
107
|
+
s.add_dependency(%q<thor>, ["~> 0"])
|
108
|
+
s.add_dependency(%q<colorize>, ["~> 0"])
|
109
|
+
s.add_dependency(%q<rspec>, ["~> 2"])
|
110
|
+
s.add_dependency(%q<yard>, ["~> 0"])
|
111
|
+
s.add_dependency(%q<rdoc>, ["~> 3"])
|
112
|
+
s.add_dependency(%q<bundler>, ["~> 1"])
|
113
|
+
s.add_dependency(%q<juwelier>, ["~> 2"])
|
108
114
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
109
115
|
s.add_dependency(%q<pry>, ["~> 0"])
|
110
116
|
s.add_dependency(%q<pry-byebug>, ["~> 3"])
|
@@ -52,6 +52,7 @@ module ElasticBackup
|
|
52
52
|
cli = Snapshot.elastic esurl
|
53
53
|
statuses = MultiJson.load cli.snapshot.get(repository: options[:repo],
|
54
54
|
snapshot: '_all')
|
55
|
+
raise statuses['error'] unless statuses['error'].nil?
|
55
56
|
unless options[:detailed]
|
56
57
|
table = Text::Table.new
|
57
58
|
table.head = ['Snapshot', 'State', 'Started', 'Duration']
|
@@ -18,15 +18,42 @@ module ElasticBackup
|
|
18
18
|
class_option :repo, type: :string,
|
19
19
|
aliases: '-r',
|
20
20
|
banner: "[NAME]",
|
21
|
-
default: 'elastic-backup',
|
22
|
-
desc: "Repository name to use."
|
21
|
+
default: ENV['ESB_DEFAULT_REPO'] || 'elastic-backup',
|
22
|
+
desc: "Repository name to use. Use the environment variable ESB_DEFAULT_REPO to change this default."
|
23
|
+
|
24
|
+
class_option :fs, type: :boolean,
|
25
|
+
desc: "Shared File System Backup. The environment variable ESB_SHARED_VOLUME must be set and also OR you can use the --sharedvol option."
|
26
|
+
|
27
|
+
class_option :sharedvol, type: :string,
|
28
|
+
aliases: '-V',
|
29
|
+
banner: "[ABSOLUTE_PATH_ON_NODES]",
|
30
|
+
default: ENV['ESB_SHARED_VOLUME'] || 'You Must Set Me for --fs Option.',
|
31
|
+
desc: "for the --fs setting, shared volume path that is set up on all the nodes in your cluster. MUST BE SET for FS snapshots. Use the environment variabe ESB_SHARED_VOLUME to avoid setting that here."
|
32
|
+
|
33
|
+
class_option :snapmax, type: :string,
|
34
|
+
aliases: '-S',
|
35
|
+
banner: "[BYTES_PER_SECOND]",
|
36
|
+
default: ENV['ESB_SNAPSHOT_MAX_BYTES_SEC'] || '500mb',
|
37
|
+
desc: "For the --fs setting, the maximum bytes per second on snaphot creation."
|
38
|
+
|
39
|
+
class_option :remax, type: :string,
|
40
|
+
aliases: '-R',
|
41
|
+
banner: "[BYTES_PER_SECOND]",
|
42
|
+
default: ENV['ESB_RESTORE_MAX_BYTES_SEC'] || '500mb',
|
43
|
+
desc: "For the --fs setting, the maximum bytes per second on snapshot restoration."
|
44
|
+
|
45
|
+
#class_option :saveconf,
|
46
|
+
# aliases: '-s',
|
47
|
+
# type: :boolean,
|
48
|
+
# desc: "Save ES Snapshot Configuration to the ES cluster.",
|
49
|
+
# default: false
|
23
50
|
|
24
51
|
class_option :monitor, type: :boolean, aliases: '-m', desc: "Monitor the progress.", default: false
|
25
52
|
class_option :wait, type: :boolean, aliases: '-w', desc: "Wait for completion.", default: false
|
26
53
|
class_option :timeout, type: :numeric,
|
27
54
|
banner: '[SECONDS]',
|
28
|
-
desc: "Explicit operation timeout for connection to master node.",
|
29
|
-
aliases: '-t', default: 60
|
55
|
+
desc: "Explicit operation timeout for connection to master node. Use the environment variable ESB_TIMEOUT to change this default.",
|
56
|
+
aliases: '-t', default: ENV['ESB_TIMEOUT'] || 60
|
30
57
|
|
31
58
|
class_option :indices, type: :array, aliases: ['-i', '--indexes'],
|
32
59
|
banner: "[INDEX1[ INDEX2...]|all]",
|
@@ -37,12 +64,12 @@ module ElasticBackup
|
|
37
64
|
aliases: '-u',
|
38
65
|
desc: "Dry run, do not actually execute."
|
39
66
|
|
40
|
-
desc 'snapshot [ES S3URL]', 'Backups Elasticsearch indices to S3'
|
67
|
+
desc 'snapshot [ES [S3URL|POSTAMBLE]]', 'Backups Elasticsearch indices to S3 or Shared Volume. The POSTAMBLE is appended to the Shared Volume path. Simply make it a "." if none.'
|
41
68
|
def snapshot es, s3url
|
42
69
|
Snapshot.snapshot Snapshot.esurl(suri: es), s3url, options
|
43
70
|
end
|
44
71
|
|
45
|
-
desc 'restore [S3URL ES]', 'Restore indices from S3 to Elasticsearch.'
|
72
|
+
desc 'restore [[S3URL|POSTAMBLE] ES]', 'Restore indices from S3 or Shared Volume to Elasticsearch. The POSTAMBLE is appended to the Shared Volume path. Simply make it a "." if none.'
|
46
73
|
def restore s3url, es
|
47
74
|
Snapshot.restore s3url, Snapshot.esurl(suri: es), options
|
48
75
|
end
|
@@ -57,15 +57,26 @@ module ElasticBackup
|
|
57
57
|
|
58
58
|
# For now, this will overwrite the repo if it is
|
59
59
|
# there already.
|
60
|
-
def set_repository s3url
|
61
|
-
bucket, base_path, _ignore = s3url_splice
|
60
|
+
def set_repository s3url, opt
|
61
|
+
bucket, base_path, _ignore = opt[:fs] ? [nil, nil, nil] : s3url_splice(s3url)
|
62
62
|
cmd = { repository: opt[:repo],
|
63
|
-
body:
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
63
|
+
body: unless opt[:fs]
|
64
|
+
{
|
65
|
+
type: 's3',
|
66
|
+
settings: {
|
67
|
+
bucket: bucket,
|
68
|
+
base_path: base_path
|
69
|
+
}}
|
70
|
+
else
|
71
|
+
{
|
72
|
+
type: 'fs',
|
73
|
+
settings: {
|
74
|
+
location: [opt[:sharedvol], opt[:postamble]].compact.join('/'),
|
75
|
+
max_snapshot_bytes_per_sec: opt[:snapmax],
|
76
|
+
max_restore_bytes_per_sec: opt[:remax]
|
77
|
+
}}
|
78
|
+
end
|
79
|
+
}
|
69
80
|
ap cmd if opt[:dryrun] || (opt[:verbose] >= 2)
|
70
81
|
unless opt[:dryrun]
|
71
82
|
ret = MultiJson.load elastic.snapshot.create_repository(cmd)
|
@@ -75,7 +86,7 @@ module ElasticBackup
|
|
75
86
|
end
|
76
87
|
|
77
88
|
def initiate_snapshot s3url
|
78
|
-
_ignore, _ignore, snapname =
|
89
|
+
_ignore, _ignore, snapname = (opt[:fs] ? [nil, nil, s3url] : s3url_splice(s3url))
|
79
90
|
raise "Must specify :SNAPSHOTNAME at the end of your S3URL #{s3url}" if snapname.nil?
|
80
91
|
|
81
92
|
cmd = {
|
@@ -94,10 +105,10 @@ module ElasticBackup
|
|
94
105
|
end
|
95
106
|
|
96
107
|
def initiate_restore s3url
|
97
|
-
_ignore, _ignore, snapname =
|
108
|
+
_ignore, _ignore, snapname = (opt[:fs] ? [nil, nil, s3url] : s3url_splice(s3url))
|
98
109
|
raise "Must specify :SNAPSHOTNAME at the end of your S3URL #{s3url}" if snapname.nil?
|
99
110
|
|
100
|
-
cmd = {
|
111
|
+
cmd = {
|
101
112
|
repository: opt[:repo],
|
102
113
|
snapshot: snapname,
|
103
114
|
wait_for_completion: opt[:wait],
|
@@ -115,7 +126,7 @@ module ElasticBackup
|
|
115
126
|
def snapshot esurl, s3url, options
|
116
127
|
elastic esurl
|
117
128
|
set_opts(options)
|
118
|
-
set_repository s3url
|
129
|
+
set_repository s3url, options
|
119
130
|
initiate_snapshot s3url
|
120
131
|
end
|
121
132
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic-backup-2s3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fred Mitchell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: semver
|
@@ -122,76 +122,104 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '1'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: thor
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: colorize
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
125
153
|
- !ruby/object:Gem::Dependency
|
126
154
|
name: rspec
|
127
155
|
requirement: !ruby/object:Gem::Requirement
|
128
156
|
requirements:
|
129
157
|
- - "~>"
|
130
158
|
- !ruby/object:Gem::Version
|
131
|
-
version: 2
|
159
|
+
version: '2'
|
132
160
|
type: :development
|
133
161
|
prerelease: false
|
134
162
|
version_requirements: !ruby/object:Gem::Requirement
|
135
163
|
requirements:
|
136
164
|
- - "~>"
|
137
165
|
- !ruby/object:Gem::Version
|
138
|
-
version: 2
|
166
|
+
version: '2'
|
139
167
|
- !ruby/object:Gem::Dependency
|
140
168
|
name: yard
|
141
169
|
requirement: !ruby/object:Gem::Requirement
|
142
170
|
requirements:
|
143
171
|
- - "~>"
|
144
172
|
- !ruby/object:Gem::Version
|
145
|
-
version: '0
|
173
|
+
version: '0'
|
146
174
|
type: :development
|
147
175
|
prerelease: false
|
148
176
|
version_requirements: !ruby/object:Gem::Requirement
|
149
177
|
requirements:
|
150
178
|
- - "~>"
|
151
179
|
- !ruby/object:Gem::Version
|
152
|
-
version: '0
|
180
|
+
version: '0'
|
153
181
|
- !ruby/object:Gem::Dependency
|
154
182
|
name: rdoc
|
155
183
|
requirement: !ruby/object:Gem::Requirement
|
156
184
|
requirements:
|
157
185
|
- - "~>"
|
158
186
|
- !ruby/object:Gem::Version
|
159
|
-
version: '3
|
187
|
+
version: '3'
|
160
188
|
type: :development
|
161
189
|
prerelease: false
|
162
190
|
version_requirements: !ruby/object:Gem::Requirement
|
163
191
|
requirements:
|
164
192
|
- - "~>"
|
165
193
|
- !ruby/object:Gem::Version
|
166
|
-
version: '3
|
194
|
+
version: '3'
|
167
195
|
- !ruby/object:Gem::Dependency
|
168
196
|
name: bundler
|
169
197
|
requirement: !ruby/object:Gem::Requirement
|
170
198
|
requirements:
|
171
199
|
- - "~>"
|
172
200
|
- !ruby/object:Gem::Version
|
173
|
-
version: '1
|
201
|
+
version: '1'
|
174
202
|
type: :development
|
175
203
|
prerelease: false
|
176
204
|
version_requirements: !ruby/object:Gem::Requirement
|
177
205
|
requirements:
|
178
206
|
- - "~>"
|
179
207
|
- !ruby/object:Gem::Version
|
180
|
-
version: '1
|
208
|
+
version: '1'
|
181
209
|
- !ruby/object:Gem::Dependency
|
182
210
|
name: juwelier
|
183
211
|
requirement: !ruby/object:Gem::Requirement
|
184
212
|
requirements:
|
185
213
|
- - "~>"
|
186
214
|
- !ruby/object:Gem::Version
|
187
|
-
version: 2
|
215
|
+
version: '2'
|
188
216
|
type: :development
|
189
217
|
prerelease: false
|
190
218
|
version_requirements: !ruby/object:Gem::Requirement
|
191
219
|
requirements:
|
192
220
|
- - "~>"
|
193
221
|
- !ruby/object:Gem::Version
|
194
|
-
version: 2
|
222
|
+
version: '2'
|
195
223
|
- !ruby/object:Gem::Dependency
|
196
224
|
name: simplecov
|
197
225
|
requirement: !ruby/object:Gem::Requirement
|