配置步骤
1. 安装 sphinx
sudo apt-get install aptitude
sudo aptitude install sphinx3 sphinx3-doc sphinxsearch sphinx-common -y
sudo aptitude install libsphinxclient-dev libsphinxclient-0.0.1 -y
sudo apt-get install PHP-pear PHP5-dev
sudo pecl install sphinx
2. 修改 PHP.ini 扩展
PHP5-fpm -i|grep ini
sudo vim /etc/PHP5/fpm/PHP.ini
添加 extension=sphinx.so 并重启:
extension=sphinx.so
sudo service PHP5-fpm restart
3. 索引配置
cd /etc/sphinxsearch
sudo vi sphinx.conf
...
...
4. 生成 sphinx 索引
sudo indexer -c sphinx.conf test1 --all
sudo indexer -c /etc/sphinxsearch/sphinx.conf test1
sudo indexer -c /etc/sphinxsearch/sphinx.conf test2
5. 停止/启动 sphinx
sudo service sphinxsearch restart
或
sudo pkill -f searchd
sudo searchd -c sphinx.conf
测试
sudo search -c sphinx.conf -i test1 Assistant
sudo search -c sphinx.conf -i test2 Assistant