AMO:Developers/Sphinx

From MozillaWiki
Jump to: navigation, search
Ambox outdated.png THIS PAGE MAY BE OUTDATED
This article is in parts, or in its entirety, outdated. Hence, the information presented on this page may be incorrect, and should be treated with due caution until this flag has been lifted. Help by editing the article, or discuss its contents on the talk page.

Sphinx will power our searches. Sphinx, like mysql, can be installed on its own cluster of servers independently from the rest of your website's architecture. E.g. we do not need to install Sphinx on each web-head or for that matter on any web-head.

This document will get Sphinx running.

Pre-flight checklist

Make sure that the AMO database is up to date. Run schematic migrations and make sure the latest views (in remora.sql) are pushed.

Install Sphinx

Download sphinx-0.9.9-rc2 and install it. Do not install any other version than this, unless you can get it to pass the Selenium tests in searchapi.html and search2.html.

./configure, make and make install preferably using ./configure --prefix=/opt/local (or some other local destination). This document assumes /opt/local.

Configure Sphinx

Use the Sphinx config file in the AMO repository as a starting point and edit the following lines:

sql_host =
sql_user =
sql_pass =
sql_db   =

Such that the point to a (dedicated) slave of AMO.

Initialize some directories

Sphinx needs a data directory and a log directory:

mkdir -p /opt/local/log/searchd
mkdir -p /opt/local/data/sphinx

Use cron to Automatically index

Run the following:

/opt/local/bin/indexer --all

If it runs without error then run the following every five minutes:

/opt/local/bin/indexer --all --rotate > /opt/local/log/searchd/cron.log

Run the server

Run the searchd daemon:

/opt/local/bin/searchd

Make sure it runs at startup and is always running. This is the server which the webheads will connect to on port 3312.