Permalink
Browse files

Add support for configuration uploading to zookeeper

  • Loading branch information...
1 parent 8bb5d9f commit 2f268d8cc34dab4e5790053cc12b143bb0d9425e @bru bru committed Mar 28, 2013
@@ -286,6 +286,14 @@ def zookeepers
@zookeepers ||= (user_configuration_from_key('solr', 'zookeepers') || nil)
end
+ def conf_dir
+ @conf_dir ||= (user_configuration_from_key('solr', 'conf_dir') || nil)
+ end
+
+ def collection
+ @collection ||= (user_configuration_from_key('solr', 'collection') || nil)
+ end
+
private
#
@@ -94,6 +94,14 @@ def zookeeper_hosts
def solr_shards
configuration.shards
end
+
+ def conf_dir
+ configuration.conf_dir
+ end
+
+ def collection
+ configuration.collection
+ end
private
#
@@ -64,6 +64,14 @@ opts = OptionParser.new do |opts|
server.zookeeper_hosts = zk
end
+ opts.on '--conf-dir=CONF_DIR', 'Directory to configuration to be uploaded to Zookeeper' do |cd|
+ server.conf_dir = cd
+ end
+
+ opts.on '--collection=COLLECTION_NAME', 'The name of this collection in Zookeeper' do |coll|
+ server.collection = coll
+ end
+
# SolrCloud shards
opts.on '--shards=SHARDS', 'Specify the number of shards in this cluster' do |shards|
server.solr_shards = shards
@@ -19,7 +19,7 @@ class Server #:nodoc:
LOG_LEVELS = Set['SEVERE', 'WARNING', 'INFO', 'CONFIG', 'FINE', 'FINER', 'FINEST']
- attr_accessor :min_memory, :max_memory, :bind_address, :port, :log_file, :zookeeper_run, :zookeeper_hosts, :solr_shards
+ attr_accessor :min_memory, :max_memory, :bind_address, :port, :log_file, :zookeeper_run, :zookeeper_hosts, :solr_shards, :conf_dir, :collection
attr_writer :pid_dir, :pid_file, :solr_data_dir, :solr_home, :solr_jar
@@ -102,8 +102,10 @@ def run
# SolrCloud
command << "-DnumShards=#{solr_shards}" if solr_shards
# Zookeeper
- command << "-DzkRun" if zookeeper_run
+ command << "-DzkRun=#{bind_address}:#{port.to_i + 1000}" if zookeeper_run
command << "-DzkHost=#{zookeeper_hosts}" if zookeeper_hosts
+ command << "-Dbootstrap_confdir=#{conf_dir}" if conf_dir
+ command << "-Dcollection.configName=#{collection}" if collection
command << '-jar' << File.basename(solr_jar)
FileUtils.cd(File.dirname(solr_jar)) do
exec(*command)

0 comments on commit 2f268d8

Please sign in to comment.