[Groonga-commit] droonga/droonga-engine at 5eacad7 [master] Accept --port and --tag for the droonga-engine-join command

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Jul 16 19:45:04 JST 2014


YUKI Hiroshi	2014-07-16 19:45:04 +0900 (Wed, 16 Jul 2014)

  New Revision: 5eacad75750911986f1441fa8e11092ffb2c1939
  https://github.com/droonga/droonga-engine/commit/5eacad75750911986f1441fa8e11092ffb2c1939

  Message:
    Accept --port and --tag for the droonga-engine-join command

  Modified files:
    bin/droonga-engine-join

  Modified: bin/droonga-engine-join (+14 -6)
===================================================================
--- bin/droonga-engine-join    2014-07-16 19:41:30 +0900 (d247140)
+++ bin/droonga-engine-join    2014-07-16 19:45:04 +0900 (179a776)
@@ -32,6 +32,8 @@ options.base_dir = ENV[Droonga::Path::BASE_DIR_ENV_NAME] || Dir.pwd
 options.drndump  = "drndump"
 options.client   = "droonga-request"
 options.copy     = true
+options.port     = Droonga::CatalogGenerator::DEFAULT_PORT
+options.tag      = Droonga::CatalogGenerator::DEFAULT_TAG
 
 parser = OptionParser.new
 parser.version = Droonga::Engine::VERSION
@@ -58,6 +60,16 @@ parser.on("--replica-source-host=HOST",
           "Host name of the soruce cluster to be connected.") do |host|
   options.replica_source_host = host
 end
+parser.on("--port=PORT", Integer,
+          "Port number of the source cluster to be connected.",
+          "(#{options.port})") do |port|
+  options.port = port
+end
+parser.on("--tag=TAG",
+          "Tag name of the soruce cluster to be connected.",
+          "(#{options.tag})") do |tag|
+  options.tag = tag
+end
 
 parser.parse!(ARGV)
 
@@ -87,12 +99,7 @@ generator = Droonga::CatalogGenerator.new
 generator.load(source_catalog)
 
 dataset = generator.dataset_for_host(options.replica_source_host)
-unless dataset
-  raise "Specified source host #{options.replica_source_host} is not a " +
-          "member of the cluster. You must specify correct host via " +
-          "--replica-source-host option."
-end
-
+if dataset
 if generator.dataset_for_host(options.joining_host)
   raise "The joining node is already a member of the cluster. " +
           "You cannot join a member twice."
@@ -100,6 +107,7 @@ end
 
 options.tag  = dataset.replicas.tag
 options.port = dataset.replicas.port
+end
 
 options.joining_node = "#{options.joining_host}:#{options.port}/#{options.tag}"
 options.source_node  = "#{options.replica_source_host}:#{options.port}/#{options.tag}"
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index