安装sphinx:
sphinx搜索引擎是用C语言写的,可以结合mysql实现快速而高效的搜索。
安装依赖包:
yum -y install unixODBC postgresql-libs
安装sphinx:
这是sphinx的官网 sphinxsearch.com 在下载一栏可以选择各个版本的sphinx,点击 archive 可以看到各个平台的各个版本。选择适合自己的版本并下载即可。
wget http://sphinxsearch.com/downloads/sphinx-2.3.2-1.rhel7.x86_64.rpm
安装sphinx之前先安装所需的依赖包:
yum -y install unixODBC postgresql-libs
然后安装sphinx:
rpm -ivh sphinx-2.2.10-1.rhel7.x86_64.rpm
安装好后提示如下:
[/usr/lib/tmpfiles.d/searchd.conf:1] Unknown user 'sphinx'.
Sphinx installed!
Now create a full-text index, start the search daemon, and you're all set.
To manage indexes:
editor /etc/sphinx/sphinx.conf
To rebuild all disk indexes:
sudo -u sphinx indexer --all --rotate
To start/stop search daemon:
service searchd start/stop
To query search daemon using MySQL client:
mysql -h 0 -P 9306
mysql> SELECT * FROM test1 WHERE MATCH('test');
See the manual at /usr/share/doc/sphinx-2.2.10 for details.
For commercial support please contact Sphinx Technologies Inc at
http://sphinxsearch.com/contacts.html根据上面的提示可知没有 sphinx 用户,所以重新自己创建了sphinx 用户,可在 /etc/passwd 中看到。
配置文件的位置:
/etc/sphinx/sphinx.conf
创建索引的方法:
sudo -u sphinx indexer --all --rotate
启动 searchd 进程的方法:
service searchd start/stop
在mysql客户端中的使用方法:
mysql -h 0 -P 9306
mysql> SELECT * FROM test1 WHERE MATCH('test');帮助文档的位置:
/usr/share/doc/sphinx-2.2.10