配置完成后, 有了数据源、索引文件存储位置等, 即可以使用 indexer 工具建立索引, 收集要被检索的数据mysql
-c 指定配置文件 默认使用 etc/sphinx.confsql
--all 对全部索引从新编制索引vim
--retate 用于轮换索引, 主要是在不中止 searchd 服务的状况下增长索引工具
--merge 合并索引, 用于把增量索引合并到主索引spa
cd /usr/local/sphinx/bin
./indexer --all
若是出现./indexer: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory, 能够使用如下命令解决找不到的问题code
vim /etc/ld.so.conf #添加 /usr/local/mysql/lib 到文件底部 ldconfig
若是Sphinx要做为服务运行, 须要使用searchdblog
-c 指定配置文件索引
--stop 中止服务class
--pidfile 指定PID文件cli
-p 指定端口 默认是9312端口