I have two rails web applications with sunspot solr.
They works very well in development environment ( starting solr with rake sunspot:solr:start
), but in production environment I would like to install a separated multicore solr service using both of the rails application.
How can I do it?
A working solution:
install_solr_service.sh
script from the bin directory ( bin/install_solr_service.sh
)../install_solr_service.sh solr-x.y.z.tgz
). It will install the solr for your system. The core will be in the /opt/solr
directory, and the data will be in the /var/solr
.service solr start
command. The deamon will be executed in name of the solr
user. (This user was created by the install_solr_service.sh
script.) By default it will listen on port 8983.cd /opt/solr su - solr ./bin/solr create -c corename1 ./bin/solr create -c corename2
Stop your solr with service solr stop
Change the solr core config to your config. You can find your config files under /path/to/your/rails/application/solr/configsets/sunspot/conf
. Copy these file (lang subdirectory is not necessary to change) to your solr core config directory ( /var/solr/data/coranane1/conf/ ). Be sure, that after you change these files, the owner of them will be the solr user.
Start your solr with service solr start
Change your rails solr config file ( config/sunspot.yml ) to something similar:
production: solr: hostname: localhost port: 8983 path: '/solr/corename1' log_level: WARNING pid_dir: '/var/run'
RAILS_ENV=production rake sunspot:solr:reindex
http://your_server_name:8983/solr/
) via iptables or similar!