freelancing-god/thinking-sphinx — Issue #340: Sphinx distributed setup
Author: mikhailov
Created: 2012-02-15 08:55:20+00:00
State: open

We have a load balancer with 2 Application behind and 2 DB servers. To use full-text search we setup another instance with Sphinx installed on it to provide physical isolation indexing from the APP and DB servers.

To perform the deployment we do

````ruby
namespace :ts_remote do
task :conf do
run <<-CMD
cd #{current_release}
&&
RAILS_ENV=#{rails_env} rake ts:conf
&&
sed "s/address.*/listen = 0\.0\.0\.0/" ./config/#{rails_env}.sphinx.conf > ./tmp/sphinx.conf
&&
sed "/port*/d" ./tmp/sphinx.conf > ./tmp/sphinx_ready.conf
&&
rsync --progress ./tmp/sphinx_ready.conf app@#{sphinx_ip}:/home/app/sphinx.conf
CMD
end

task :reindex do
run "ssh app@#{sphinx_ip} 'indexer --all --rotate'"
end

task :stop do
run "ssh app@#{sphinx_ip} 'cp /home/app/sphinx.conf /etc/sphinxsearch/sphinx.conf; /etc/init.d/sphinxsearch stop'"
end

task :restart do
run "ssh app@#{sphinx_ip} 'cp /home/app/sphinx.conf /etc/sphinxsearch/sphinx.conf; /etc/init.d/sphinxsearch restart'"
end
end

end
````

But it looks like a temporary solution, do you have any recipes and config samples to distribute configuration deployment?