droonga-engine 1.0.5 → 1.0.6

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.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/bin/droonga-engine-absorb-data +2 -1
  3. data/bin/droonga-engine-catalog-generate +21 -5
  4. data/bin/droonga-engine-catalog-modify +22 -6
  5. data/bin/droonga-engine-configure +215 -0
  6. data/bin/droonga-engine-join +48 -123
  7. data/bin/droonga-engine-unjoin +14 -1
  8. data/doc/text/news.md +21 -0
  9. data/droonga-engine.gemspec +12 -10
  10. data/install/centos/droonga-engine +60 -0
  11. data/install/centos/functions.sh +35 -0
  12. data/install/debian/droonga-engine +155 -0
  13. data/install/debian/functions.sh +33 -0
  14. data/install.sh +360 -0
  15. data/lib/droonga/address.rb +3 -1
  16. data/lib/droonga/catalog/dataset.rb +2 -0
  17. data/lib/droonga/catalog/version1.rb +16 -3
  18. data/lib/droonga/catalog/version2.rb +16 -3
  19. data/lib/droonga/catalog_fetcher.rb +51 -0
  20. data/lib/droonga/catalog_generator.rb +6 -5
  21. data/lib/droonga/catalog_modifier.rb +45 -0
  22. data/lib/droonga/command/droonga_engine.rb +96 -29
  23. data/lib/droonga/command/droonga_engine_service.rb +5 -0
  24. data/lib/droonga/command/remote.rb +368 -0
  25. data/lib/droonga/command/serf_event_handler.rb +37 -304
  26. data/lib/droonga/dispatcher.rb +15 -1
  27. data/lib/droonga/engine/version.rb +1 -1
  28. data/lib/droonga/engine.rb +11 -4
  29. data/lib/droonga/engine_state.rb +2 -0
  30. data/lib/droonga/farm.rb +14 -5
  31. data/lib/droonga/fluent_message_receiver.rb +23 -6
  32. data/lib/droonga/fluent_message_sender.rb +5 -1
  33. data/lib/droonga/node_status.rb +67 -0
  34. data/lib/droonga/path.rb +28 -4
  35. data/lib/droonga/plugins/catalog.rb +40 -0
  36. data/lib/droonga/safe_file_writer.rb +1 -1
  37. data/lib/droonga/searcher.rb +3 -15
  38. data/lib/droonga/serf.rb +17 -32
  39. data/lib/droonga/serf_downloader.rb +26 -1
  40. data/lib/droonga/service_installation.rb +123 -0
  41. data/lib/droonga/session.rb +4 -0
  42. data/lib/droonga/slice.rb +22 -12
  43. data/lib/droonga/supervisor.rb +16 -2
  44. data/lib/droonga/worker_process_agent.rb +13 -1
  45. data/sample/droonga-engine.yaml +5 -0
  46. data/test/command/config/default/catalog.json +1 -1
  47. data/test/command/config/default/droonga-engine.yaml +4 -0
  48. data/test/command/config/version1/catalog.json +1 -1
  49. data/test/command/suite/catalog/fetch.expected +64 -0
  50. data/test/command/suite/catalog/fetch.test +6 -0
  51. data/test/unit/catalog/test_version1.rb +2 -2
  52. data/test/unit/catalog/test_version2.rb +3 -3
  53. data/test/unit/helper/sandbox.rb +3 -1
  54. data/test/unit/plugins/catalog/test_fetch.rb +76 -0
  55. data/test/unit/test_catalog_generator.rb +7 -3
  56. metadata +74 -27
  57. data/bin/droonga-engine-data-publisher +0 -66
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e783348c7bfbef6e04de3de388c902839e8633b
4
- data.tar.gz: 01b3367f3c22fb2a40245ca9bedc4920b42a494a
3
+ metadata.gz: 3e2a22b317f8d67460835b19b148b87065317f62
4
+ data.tar.gz: 2dd51cbb6b2ed3f667474d45f0735f5626a989e7
5
5
  SHA512:
6
- metadata.gz: 399c8b21fd8368610a2ad498246584614f4bde6bc99bed78f8ba705164627a920ea59e32311ef5bf565fcaeb838e58837ab200a3d2ed0b2ee56f7ca26f1efa0e
7
- data.tar.gz: 30bdef9c53baa70dd2095869656283488517d579942bc214c9267ff7c095e2c0aac9ff0d0e01db59263f4d4c86cf6f2165e5d4681db9af21726a2d69f4d798af
6
+ metadata.gz: 64d02366c1dc7945091afeec62787ea1082091edb08e34f844d32cbc39ebed5839ff36cf840c4dbd7c89dff92d95e5037fbdfeadaee58af129c1aeaea8316a5c
7
+ data.tar.gz: b7c88b9cab4a8f5b438d789cb78cee50080efb4d78b826829b1057a3412d7b930fe99ab52ee2e2d899e98ca3725c4df244461671598e51adf455dafb99d55ce7
@@ -79,7 +79,8 @@ end
79
79
  destination_node = "#{options.destination_host}:#{options.port}/#{options.tag}"
80
80
 
81
81
  def run_remote_command(target, command, options)
82
- result = Droonga::Serf.send_query(target, command, options)
82
+ serf = Droonga::Serf.new(nil, target)
83
+ result = serf.send_query(command, options)
83
84
  puts result[:result]
84
85
  puts result[:error] unless result[:error].empty?
85
86
  result[:response]
@@ -23,6 +23,10 @@ require "pathname"
23
23
  require "droonga/engine/version"
24
24
  require "droonga/catalog_generator"
25
25
  require "droonga/safe_file_writer"
26
+ require "droonga/service_installation"
27
+
28
+ service_installation = Droonga::ServiceInstallation.new
29
+ service_installation.ensure_using_service_base_directory
26
30
 
27
31
  generator = Droonga::CatalogGenerator.new
28
32
  current_dataset = {}
@@ -31,7 +35,11 @@ datasets = {
31
35
  }
32
36
 
33
37
  options = OpenStruct.new
34
- options.output_path = "-"
38
+ if service_installation.user_exist?
39
+ options.output_path = Droonga::Path.catalog
40
+ else
41
+ options.output_path = "-"
42
+ end
35
43
  parser = OptionParser.new
36
44
  parser.version = Droonga::Engine::VERSION
37
45
  parser.on("--output=PATH",
@@ -98,21 +106,29 @@ if datasets[Droonga::CatalogGenerator::DEFAULT_DATASET].empty?
98
106
  datasets.delete(Droonga::CatalogGenerator::DEFAULT_DATASET)
99
107
  end
100
108
 
109
+ if service_installation.user_exist? and
110
+ options.output_path == Droonga::Path.catalog
111
+ options.for_service = true
112
+ end
113
+
101
114
  datasets.each do |name, options|
102
115
  generator.add_dataset(name, options)
103
116
  end
104
117
 
105
118
  def open_output(path)
106
119
  if path == "-"
107
- yield($stdout)
120
+ yield($stdout, nil)
108
121
  else
109
- Droonga::SafeFileWriter.write(path) do |output|
110
- yield(output)
122
+ Droonga::SafeFileWriter.write(path) do |output, file|
123
+ yield(output, file)
111
124
  end
112
125
  end
113
126
  end
114
127
 
115
128
  catalog = generator.generate
116
- open_output(options.output_path) do |output|
129
+ open_output(options.output_path) do |output, file|
117
130
  output.puts(JSON.pretty_generate(catalog))
131
+ if file and options.for_service
132
+ service_installation.ensure_correct_file_permission(file)
133
+ end
118
134
  end
@@ -23,6 +23,10 @@ require "pathname"
23
23
  require "droonga/engine/version"
24
24
  require "droonga/catalog_generator"
25
25
  require "droonga/safe_file_writer"
26
+ require "droonga/service_installation"
27
+
28
+ service_installation = Droonga::ServiceInstallation.new
29
+ service_installation.ensure_using_service_base_directory
26
30
 
27
31
  generator = Droonga::CatalogGenerator.new
28
32
  current_dataset = {}
@@ -31,9 +35,14 @@ datasets = {
31
35
  }
32
36
 
33
37
  options = OpenStruct.new
34
- options.source_path = "./catalog.json"
35
38
  options.output_path = "-"
36
- options.update = false
39
+ if service_installation.user_exist?
40
+ options.source_path = Droonga::Path.catalog
41
+ options.update = true
42
+ else
43
+ options.source_path = "./catalog.json"
44
+ options.update = false
45
+ end
37
46
  parser = OptionParser.new
38
47
  parser.version = Droonga::Engine::VERSION
39
48
  parser.on("--source=PATH",
@@ -76,6 +85,10 @@ parser.parse!(ARGV)
76
85
  if options.source_path != "-" and options.update
77
86
  options.output_path = options.source_path
78
87
  end
88
+ if service_installation.user_exist? and
89
+ options.output_path == Droonga::Path.catalog
90
+ options.for_service = true
91
+ end
79
92
 
80
93
  def load_source(path)
81
94
  source = nil
@@ -94,15 +107,18 @@ generator.modify(datasets)
94
107
 
95
108
  def open_output(path)
96
109
  if path == "-"
97
- yield($stdout)
110
+ yield($stdout, nil)
98
111
  else
99
- Droonga::SafeFileWriter.write(path) do |output|
100
- yield(output)
112
+ Droonga::SafeFileWriter.write(path) do |output, file|
113
+ yield(output, file)
101
114
  end
102
115
  end
103
116
  end
104
117
 
105
118
  catalog = generator.generate
106
- open_output(options.output_path) do |output|
119
+ open_output(options.output_path) do |output, file|
107
120
  output.puts(JSON.pretty_generate(catalog))
121
+ if file and options.for_service
122
+ service_installation.ensure_correct_file_permission(file)
123
+ end
108
124
  end
@@ -0,0 +1,215 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (C) 2014 Droonga Project
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License version 2.1 as published by the Free Software Foundation.
8
+ #
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Lesser General Public
15
+ # License along with this library; if not, write to the Free Software
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+
18
+ require "optparse"
19
+ require "fileutils"
20
+ require "yaml"
21
+
22
+ require "droonga/path"
23
+ require "droonga/command/droonga_engine"
24
+ require "droonga/safe_file_writer"
25
+ require "droonga/service_installation"
26
+
27
+ options = {
28
+ :quiet => nil,
29
+ :clear => nil,
30
+ :reset_config => nil,
31
+ :reset_catalog => nil,
32
+ }
33
+
34
+ configuration = Droonga::Command::DroongaEngine::Configuration.new
35
+ parser = OptionParser.new
36
+ parser.on("--quiet", "Run with no prompt.") do |host|
37
+ options[:quiet] = true
38
+ end
39
+ parser.on("--clear", "Clear any existing data.") do |host|
40
+ options[:clear] = true
41
+ end
42
+ parser.on("--reset-config", "Regenerate the configuration file \"droonga-engine.yaml\".") do |host|
43
+ options[:reset_config] = true
44
+ end
45
+ parser.on("--reset-catalog", "Regenerate the \"catalog.json\".") do |host|
46
+ options[:reset_catalog] = true
47
+ end
48
+ configuration.add_command_line_options(parser)
49
+ parser.parse!(ARGV)
50
+
51
+
52
+ def unjoin(configuration)
53
+ system("droonga-engine-unjoin",
54
+ "--host", configuration.host,
55
+ :out => "/dev/null",
56
+ :err => "/dev/null")
57
+ end
58
+
59
+ def input(message, default_value=nil)
60
+ print "#{message} [#{default_value}]: "
61
+ response = gets.strip
62
+ if response.empty?
63
+ default_value
64
+ else
65
+ response
66
+ end
67
+ end
68
+
69
+ def confirmed?(message)
70
+ while true
71
+ print "#{message} (y/N): "
72
+ response = gets
73
+ case response
74
+ when /\Ay/i
75
+ return true
76
+ when /\An/i, /^$/
77
+ return false
78
+ end
79
+ end
80
+ end
81
+
82
+ def path_from_base_dir(path)
83
+ path = path.to_s
84
+ base = "#{Droonga::Path.base.to_s}/"
85
+ if path.start_with?(base)
86
+ path.sub(base, "")
87
+ else
88
+ path
89
+ end
90
+ end
91
+
92
+
93
+ service_installation = Droonga::ServiceInstallation.new
94
+ service_installation.ensure_using_service_base_directory
95
+
96
+ running = false
97
+ begin
98
+ if service_installation.running?
99
+ if !options[:quiet]
100
+ puts("The droonga-engine service is now running.")
101
+ puts("Before reconfiguration, the service is going to be stopped " +
102
+ "and this node will be unjoined from the cluster.")
103
+ unless confirmed?("Are you sure you want to continue reconfiguration?")
104
+ exit(false)
105
+ end
106
+ end
107
+ running = true
108
+ end
109
+ rescue Droonga::ServiceInstallation::NotInstalledAsService
110
+ puts("Not installed as a service yet.")
111
+ end
112
+
113
+ unless service_installation.have_write_permission?
114
+ puts("You have no permission to write files under " +
115
+ "<#{Droonga::Path.base.to_s}>.")
116
+ puts("Try again with right permission.")
117
+ exit(false)
118
+ end
119
+
120
+
121
+ data_files = [
122
+ Droonga::Path.databases,
123
+ Droonga::Path.state,
124
+ ]
125
+ have_data = data_files.any?(&:exist?)
126
+ options[:clear] = false unless have_data
127
+
128
+ if !options[:quiet] and options[:clear].nil?
129
+ options[:clear] = confirmed?("Do you want all data to be cleared?")
130
+ end
131
+
132
+
133
+ options[:reset_config] = true unless Droonga::Path.config.exist?
134
+ if !options[:quiet] and options[:reset_config].nil?
135
+ options[:reset_config] = confirmed?("Do you want the configuration file " +
136
+ "\"droonga-engine.yaml\" to be regenerated?")
137
+ end
138
+
139
+ options[:reset_catalog] = true unless Droonga::Path.catalog.exist?
140
+ if !options[:quiet] and options[:reset_catalog].nil?
141
+ options[:reset_catalog] = confirmed?("Do you want the file \"catalog.json\" " +
142
+ "to be regenerated?")
143
+ end
144
+
145
+
146
+ if running
147
+ unjoin(configuration)
148
+ service_installation.stop
149
+ end
150
+
151
+ if options[:clear]
152
+ data_files.each do |file|
153
+ FileUtils.rm_rf(file.to_s)
154
+ end
155
+ end
156
+
157
+ if options[:reset_config] or options[:reset_catalog]
158
+ if configuration.have_given_host? or options[:quiet]
159
+ host = configuration.host
160
+ else
161
+ host = input("host", configuration.host)
162
+ end
163
+
164
+ if configuration.have_given_port? or options[:quiet]
165
+ port = configuration.port
166
+ else
167
+ port = input("port", configuration.port).to_i
168
+ end
169
+
170
+ if configuration.have_given_tag? or options[:quiet]
171
+ tag = configuration.tag
172
+ else
173
+ tag = input("tag", configuration.tag)
174
+ end
175
+ end
176
+
177
+ if options[:reset_config]
178
+ if configuration.have_given_log_level? or options[:quiet]
179
+ log_level = configuration.log_level
180
+ else
181
+ log_level = input("log level", configuration.log_level)
182
+ end
183
+
184
+ new_configuration = {
185
+ "host" => host,
186
+ "port" => port,
187
+ "tag" => tag,
188
+ "log_file" => path_from_base_dir(Droonga::Path.default_log_file),
189
+ "log_level" => log_level,
190
+ }
191
+ Droonga::SafeFileWriter.write(Droonga::Path.config,
192
+ YAML.dump(new_configuration))
193
+ end
194
+
195
+ if options[:reset_catalog]
196
+ system("droonga-engine-catalog-generate",
197
+ "--output", Droonga::Path.catalog.to_s,
198
+ "--hosts", host,
199
+ "--port", port.to_s,
200
+ "--tag", tag)
201
+ end
202
+
203
+ if options[:reset_config] or options[:reset_catalog]
204
+ service_installation.ensure_correct_file_permission(Droonga::Path.base)
205
+ end
206
+
207
+ if running
208
+ successfully_started = service_installation.start
209
+ unless successfully_started
210
+ puts("The droonga-engine service is still stopped.")
211
+ puts("You need to start the service again manually.")
212
+ end
213
+ end
214
+
215
+ exit(true)
@@ -15,8 +15,7 @@
15
15
  # License along with this library; if not, write to the Free Software
16
16
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
- require "ostruct"
19
- require "optparse"
18
+ require "slop"
20
19
  require "json"
21
20
  require "pathname"
22
21
 
@@ -27,144 +26,70 @@ require "droonga/safe_file_writer"
27
26
  require "droonga/data_absorber"
28
27
  require "droonga/serf"
29
28
 
30
- options = OpenStruct.new
31
- options.base_dir = ENV[Droonga::Path::BASE_DIR_ENV_NAME] || Dir.pwd
32
- options.drndump = "drndump"
33
- options.client = "droonga-request"
34
- options.copy = true
35
- options.port = Droonga::CatalogGenerator::DEFAULT_PORT
36
- options.tag = Droonga::CatalogGenerator::DEFAULT_TAG
37
-
38
- parser = OptionParser.new
39
- parser.version = Droonga::Engine::VERSION
40
-
41
- parser.on("--base-dir=PATH",
42
- "Path to the base directory the catalog.json is located in.",
43
- "(#{options.base_dir})") do |path|
44
- options.base_dir = path
45
- end
46
-
47
- parser.on("--[no-]copy",
48
- "Do or don't copy data from the source cluster.",
49
- "(#{options.copy})") do |copy|
50
- options.copy = copy
51
- end
52
-
53
- parser.separator("")
54
- parser.separator("Connections:")
55
- parser.on("--host=HOST",
56
- "Host name of the node to be joined.") do |host|
57
- options.joining_host = host
58
- end
59
- parser.on("--replica-source-host=HOST",
60
- "Host name of the soruce cluster to be connected.") do |host|
61
- options.replica_source_host = host
62
- end
63
- parser.on("--dataset=DATASET",
64
- "Tag dataset name of the cluster to be joined as a node.",
65
- "(#{options.dataset})") do |dataset|
66
- options.dataset = dataset
67
- end
68
- parser.on("--port=PORT", Integer,
69
- "Port number of the source cluster to be connected.",
70
- "(#{options.port})") do |port|
71
- options.port = port
72
- end
73
- parser.on("--tag=TAG",
74
- "Tag name of the soruce cluster to be connected.",
75
- "(#{options.tag})") do |tag|
76
- options.tag = tag
77
- end
78
-
79
- parser.parse!(ARGV)
80
-
81
-
82
- base_dir = Pathname(options.base_dir).expand_path
83
- ENV[Droonga::Path::BASE_DIR_ENV_NAME] = base_dir.to_s
84
-
85
- catalog_path = Droonga::Path.catalog
86
- unless catalog_path.exist?
87
- raise "Cannot load 'catalog.json'. You must specify correct path " +
88
- "to the base directory via --base-dir option."
89
- end
90
- source_catalog = JSON.parse(catalog_path.read)
91
-
92
-
93
- unless options.joining_host
94
- raise "You must specify the host name or the IP address of the node " +
95
- "to be joined via --host option."
96
- end
97
- unless options.replica_source_host
98
- raise "You must specify the host name or the IP address of a node " +
99
- "of an existing cluster via --replica-source-host option."
100
- end
101
-
102
-
103
- generator = Droonga::CatalogGenerator.new
104
- generator.load(source_catalog)
105
-
106
- dataset = generator.dataset_for_host(options.replica_source_host)
107
- if dataset
108
- if generator.dataset_for_host(options.joining_host)
109
- raise "The joining node is already a member of the cluster. " +
110
- "You cannot join a member twice."
29
+ options = nil
30
+ begin
31
+ options = Slop.parse(:help => true) do |option|
32
+ option.on("no-copy", "Don't copy data from the source cluster.",
33
+ :default => false)
34
+
35
+ option.separator("Connections:")
36
+ option.on(:host=,
37
+ "Host name of the node to be joined.",
38
+ :required => true)
39
+ option.on("replica-source-host=",
40
+ "Host name of the soruce cluster to be connected.",
41
+ :required => true)
42
+ option.on(:dataset=,
43
+ "Tag dataset name of the cluster to be joined as a node.",
44
+ :default => Droonga::CatalogGenerator::DEFAULT_DATASET)
45
+ option.on(:port=,
46
+ "Port number of the source cluster to be connected.",
47
+ :as => Integer,
48
+ :default => Droonga::CatalogGenerator::DEFAULT_PORT)
49
+ option.on(:tag=,
50
+ "Tag name of the soruce cluster to be connected.",
51
+ :default => Droonga::CatalogGenerator::DEFAULT_TAG)
111
52
  end
112
-
113
- options.dataset = dataset.name
114
- options.tag = dataset.replicas.tag
115
- options.port = dataset.replicas.port
53
+ rescue Slop::MissingOptionError => e
54
+ $stderr.puts(e)
55
+ exit(false)
116
56
  end
117
57
 
118
- options.joining_node = "#{options.joining_host}:#{options.port}/#{options.tag}"
119
- options.source_node = "#{options.replica_source_host}:#{options.port}/#{options.tag}"
58
+ joining_node = "#{options[:host]}:#{options[:port]}/#{options[:tag]}"
59
+ source_node = "#{options["replica-source-host"]}:#{options[:port]}/#{options[:tag]}"
120
60
 
121
61
  def run_remote_command(target, command, options)
122
- result = Droonga::Serf.send_query(target, command, options)
123
- puts result[:result]
124
- puts result[:error] unless result[:error].empty?
62
+ serf = Droonga::Serf.new(nil, target)
63
+ result = serf.send_query(command, options)
64
+ puts(result[:result])
65
+ puts(result[:error]) unless result[:error].empty?
125
66
  result[:response]
126
67
  end
127
68
 
128
- =begin
129
- XXX disable fetching until it become working
130
- puts "Preparing to fetch cluster information..."
131
- publish_port = 10032 + rand(10000)
132
- run_remote_command(options.source_node, "publish_catalog",
133
- "node" => options.source_node,
134
- "port" => publish_port)
135
- sleep(3) # wait until the HTTP server becomes ready
136
- =end
137
-
138
- puts "Joining new replica to the cluster..."
139
- run_remote_command(options.joining_node, "join",
140
- "node" => options.joining_node,
141
- "type" => "replica",
142
- "source" => options.source_node,
143
- # "fetch_port" => publish_port,
144
- "copy" => options.copy)
69
+ puts("Joining new replica to the cluster...")
70
+ run_remote_command(joining_node, "join",
71
+ "node" => joining_node,
72
+ "type" => "replica",
73
+ "source" => source_node,
74
+ "dataset" => options[:dataset],
75
+ "copy" => !options["no-copy"])
145
76
  sleep(5) #TODO: wait for restarting of the joining node. this should be done more safely.
146
77
 
147
78
  while true
148
79
  sleep(3)
149
- response = run_remote_command(options.joining_node, "report_status",
150
- "node" => options.joining_node,
151
- "key" => "absorbing")
80
+ response = run_remote_command(joining_node, "report_status",
81
+ "node" => joining_node,
82
+ "key" => "absorbing")
152
83
  absorbing = response["value"]
153
84
  break unless absorbing
154
85
  end
155
86
 
156
- puts "Update existing hosts in the cluster..."
157
- run_remote_command(options.source_node, "add_replicas",
158
- "dataset" => options.dataset,
159
- "hosts" => [options.joining_host])
87
+ puts("Update existing hosts in the cluster...")
88
+ run_remote_command(source_node, "add_replicas",
89
+ "dataset" => options[:dataset],
90
+ "hosts" => [options[:host]])
160
91
 
161
- =begin
162
- XXX disable fetching until it become working
163
- run_remote_command(options.source_node, "unpublish_catalog",
164
- "node" => options.source_node,
165
- "port" => publish_port)
166
- =end
167
92
 
168
- puts "Done."
93
+ puts("Done.")
169
94
 
170
95
  exit(true)
@@ -24,8 +24,12 @@ require "droonga/engine/version"
24
24
  require "droonga/path"
25
25
  require "droonga/catalog_generator"
26
26
  require "droonga/safe_file_writer"
27
+ require "droonga/service_installation"
27
28
  require "droonga/serf"
28
29
 
30
+ service_installation = Droonga::ServiceInstallation.new
31
+ service_installation.ensure_using_service_base_directory
32
+
29
33
  options = OpenStruct.new
30
34
  options.base_dir = ENV[Droonga::Path::BASE_DIR_ENV_NAME] || Dir.pwd
31
35
 
@@ -48,6 +52,7 @@ parser.parse!(ARGV)
48
52
  base_dir = Pathname(options.base_dir).expand_path
49
53
  ENV[Droonga::Path::BASE_DIR_ENV_NAME] = base_dir.to_s
50
54
 
55
+
51
56
  catalog_path = Droonga::Path.catalog
52
57
  unless catalog_path.exist?
53
58
  raise "Cannot load 'catalog.json'. You must specify correct path " +
@@ -59,6 +64,13 @@ unless options.replica_remove_host
59
64
  "be removed from the cluster via --replica-remove-host option."
60
65
  end
61
66
 
67
+ unless service_installation.have_read_permission?
68
+ puts("You have no permission to read files under " +
69
+ "<#{Droonga::Path.base.to_s}>.")
70
+ puts("Try again with right permission.")
71
+ exit(false)
72
+ end
73
+
62
74
  source_catalog = JSON.parse(catalog_path.read)
63
75
  generator = Droonga::CatalogGenerator.new
64
76
  generator.load(source_catalog)
@@ -80,7 +92,8 @@ options.remaining_node = "#{remaining_host}:#{options.port}/#{options.tag}"
80
92
 
81
93
 
82
94
  def run_remote_command(target, command, options)
83
- result = Droonga::Serf.send_query(target, command, options)
95
+ serf = Droonga::Serf.new(nil, target)
96
+ result = serf.send_query(command, options)
84
97
  puts result[:result]
85
98
  puts result[:error] unless result[:error].empty?
86
99
  end
data/doc/text/news.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # News
2
2
 
3
+ ## 1.0.6: 2014-09-29
4
+
5
+ * The installation script is now available.
6
+ It automatically installs required softwares and configure the `droonga-engine` as a system service.
7
+ Currently it works only for Debian, Ubuntu, and CentOS 7.
8
+ * The service works as a process belonging to a user `droonga-engine` who is specific for the service.
9
+ The configuration directory for the service is placed under the home directory of the user.
10
+ * A static configuration file to define default parameters (`host` and so on) is now available.
11
+ It must be placed into the directory same to `catalog.json`.
12
+ You don't have to run `droonga-engine` command with many options, anymore.
13
+ * `droonga-engine-join` now automatically fetches `catalog.json` from the specified source replica node.
14
+ Now you don't have to copy `catalog.json` from another node before you run `droonga-engine-join` anymore.
15
+ * A new `catalog` plugin is introduced as one of default plugins, to fetch `catalog.json` from existing cluster.
16
+ The list of plugins in your `catalog.json` must include it.
17
+ * A new command line utility `droonga-engine-configure` is available.
18
+ It generates the static configuration file, the `catalog.json` for the service.
19
+ Moreover, it clears old stored data to make the node empty.
20
+ * Some options for utility commands become optional.
21
+ Important parameters are automatically detected.
22
+ * Restarts server processes more gracefully.
23
+
3
24
  ## 1.0.5: 2014-07-29
4
25
 
5
26
  * Restarts server processes more gracefully.
@@ -35,22 +35,24 @@ Gem::Specification.new do |gem|
35
35
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
36
36
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
37
37
  gem.require_paths = ["lib"]
38
- gem.add_dependency "rroonga", ">= 4.0.1"
39
- gem.add_dependency "groonga-command-parser"
40
- gem.add_dependency "json"
38
+ gem.add_dependency "archive-zip"
41
39
  gem.add_dependency "cool.io"
42
- gem.add_dependency "droonga-message-pack-packer", ">= 1.0.1"
40
+ gem.add_dependency "drndump"
41
+ gem.add_dependency "droonga-client", ">= 0.1.9"
42
+ gem.add_dependency "droonga-message-pack-packer", ">= 1.0.2"
43
+ gem.add_dependency "groonga-command-parser"
43
44
  gem.add_dependency "faraday"
44
45
  gem.add_dependency "faraday_middleware"
45
- gem.add_dependency "archive-zip"
46
+ gem.add_dependency "json"
47
+ gem.add_dependency "rroonga", ">= 4.0.4"
46
48
  gem.add_dependency "sigdump"
47
- gem.add_dependency "droonga-client", ">= 0.1.9"
48
- gem.add_dependency "drndump"
49
- gem.add_development_dependency "rake"
49
+ gem.add_dependency "slop"
50
+ gem.add_dependency "sys-proctable"
51
+ gem.add_development_dependency "kramdown"
50
52
  gem.add_development_dependency "bundler"
53
+ gem.add_development_dependency "packnga"
54
+ gem.add_development_dependency "rake"
51
55
  gem.add_development_dependency "test-unit"
52
56
  gem.add_development_dependency "test-unit-notify"
53
57
  gem.add_development_dependency "test-unit-rr"
54
- gem.add_development_dependency "packnga"
55
- gem.add_development_dependency "kramdown"
56
58
  end