Navigation Menu

Skip to content

Commit

Permalink
Add local:droonga:run task that runs Droonga cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Apr 8, 2014
1 parent d538204 commit 335fab6
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions lib/wikipedia-search/task.rb
Expand Up @@ -155,16 +155,17 @@ def groonga_run(input)

def define_local_droonga_tasks
namespace :droonga do
dependencies = [
node_ids = [0, 1]

load_dependencies = [
@path.droonga.pages.to_s,
@path.droonga.schema.to_s,
]
desc "Load data."
task :load => dependencies do
task :load => load_dependencies do
rm_rf(@path.droonga.working_dir.to_s)
mkdir_p(@path.droonga.working_dir.to_s)

node_ids = [0, 1]
node_ids.each do |node_id|
droonga_generate_fluentd_conf(node_id)
end
Expand All @@ -188,6 +189,24 @@ def define_local_droonga_tasks
end
end
end

desc "Run Droonga cluster."
task :run do
begin
node_ids.each do |node_id|
droonga_run_engine(node_id)
port = droonga_port(node_id)
puts("127.0.0.1:#{port}/droonga")
end
front_node_id = node_ids.first
droonga_wait_engine_ready(front_node_id)
$stdin.gets
ensure
node_ids.each do |node_id|
droonga_stop_engine(node_id)
end
end
end
end
end

Expand Down

0 comments on commit 335fab6

Please sign in to comment.