Is it possible to reload Solr configuration without setting up Multicore or restarting the servlet container?
I would like to tweak some <analyzer> chains with the analysis tab in the admin, and tweak the parameters to my <requestHandler>, but having to restart the servlet container after every small change to schema.xml or solrconfig.xml is a bit of a pain and time consuming.
As best as I can tell, online reloading requires a Multicore configuration, which it turns out isn't too hard:
Put this solr.xml
into the solr home directory
<solr persistent="false" sharedLib="lib">
<cores adminPath="/admin/cores" defaultCoreName="core0">
<core name="core0" instanceDir="." />
</cores>
</solr>
Restart the servlet container.
Hit a URL like this to reload the configuration:
http://localhost:8983/solr/admin/cores?action=RELOAD&core=core0
To remove the rest of the friction, you can set it up to automatically reload the configuration by running the following script within the conf
directory.
get_on_fsevent.rb "http://localhost:8983/solr/admin/cores?action=RELOAD&core=core0"
get_on_fsevent.rb:
#!/usr/bin/env ruby
require 'rubygems'
require 'rb-fsevent'
require 'net/http'
require 'uri'
uri = URI.parse(ARGV.first)
fsevent = FSEvent.new
fsevent.watch Dir.pwd do |directories|
puts "Detected change. Requesting #{ARGV.first}"
puts Net::HTTP.get_response(uri)
end
fsevent.run