配置完成後, 有了數據源、索引文件存儲位置等, 即可以使用 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端口