elasticsearch_s3_backup 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/elasticsearch_s3_backup.rb +16 -2
- data/lib/elasticsearch_s3_backup/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4858fa0862e04b674d69efb32506e2f1736866a
|
4
|
+
data.tar.gz: 569033bcb7439fadea70e55fd17e40bdae1bcd88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 360fd85e6fcd21746a49504c8b5d4c61c1e7605d135e64643cdfac3f52a424ecb446e329ce442fa8974e581d562eb06950a835741d6db3ab9de6aebdb46bdc7d
|
7
|
+
data.tar.gz: 85a5d1d8738dde41f5b3763ec13393491190e85dc1779a55d69111434fc68fe2bb0ffa3d5f64e254b645f5244a1d4ec9548225708e00c30465fde8f4ebad8a4d
|
@@ -6,6 +6,7 @@ require 'pagerduty'
|
|
6
6
|
require 'yaml'
|
7
7
|
require 'sentry-raven'
|
8
8
|
require 'ostruct'
|
9
|
+
require 'hashie'
|
9
10
|
require 'elasticsearch'
|
10
11
|
|
11
12
|
module EverTools
|
@@ -30,6 +31,8 @@ module EverTools
|
|
30
31
|
exit
|
31
32
|
end
|
32
33
|
|
34
|
+
check_cluster_state!
|
35
|
+
|
33
36
|
cleanup_test_indexes
|
34
37
|
insert_test_data
|
35
38
|
|
@@ -117,6 +120,14 @@ module EverTools
|
|
117
120
|
es_api.nodes.info['nodes'][es_api.cluster.state['master_node']]['name'] == node_name
|
118
121
|
end
|
119
122
|
|
123
|
+
def check_cluster_state!
|
124
|
+
cluster_settings = Hashie::Mash.new es_api.cluster.get_settings
|
125
|
+
if cluster_settings.transient_.cluster_.routing_.allocation_.enable == 'none'
|
126
|
+
fail 'Shard reallocation is disabled. Snapshot cannot proceed because creating the test ' \
|
127
|
+
'index in this state will put the cluster into RED state.'
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
120
131
|
def pseudo_random_string
|
121
132
|
'a' + rand(10**100).to_s
|
122
133
|
end
|
@@ -207,6 +218,7 @@ module EverTools
|
|
207
218
|
|
208
219
|
def delete_test_indexes
|
209
220
|
[@restore_test_index, @backup_test_index].each do |test_index|
|
221
|
+
logger.info "Removing test index: #{test_index}"
|
210
222
|
es_api.indices.delete index: test_index
|
211
223
|
end
|
212
224
|
end
|
@@ -215,8 +227,10 @@ module EverTools
|
|
215
227
|
logger.info 'Removing remnant test indexes...'
|
216
228
|
# Gather backup test indices
|
217
229
|
es_api.indices.get(index: 'backup_test_*').each do |test_index, _value|
|
218
|
-
# Check again that they are backup test indices
|
219
|
-
|
230
|
+
if test_index =~ /backup_test_(.*)/ # Check again that they are backup test indices
|
231
|
+
logger.info "Removing test index: #{test_index}"
|
232
|
+
es_api.indices.delete index: test_index
|
233
|
+
end
|
220
234
|
end
|
221
235
|
end
|
222
236
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticsearch_s3_backup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Herot
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|