網站建設系統架構-sphinx安裝與配置: #yum -y install gcc gcc-c++ autoconf make python python-devel libiconv #cd /tmp #tar xzvf sphinx-2.0.7-release.tar.gz #cd sphinx-2.0.7-release #./configure --prefix=/usr/web/sphinx --with-mysql=/usr/web/mysql #make && make install
//導入測試數據
#/usr/web/mysql/bin/mysql -u root -p < /usr/web/sphinx/etc/example.sql #cd /usr/web/sphinx/etc #cp sphinx.conf.dist sphinx.conf #vi sphinx.conf
//定位文件位置
#locate libmysqlclient
//加入到環境變量
#echo "/usr/web/mysql/lib/" >> /etc/ld.so.conf #ldconfig
#/usr/web/sphinx/bin/indexer -c /usr/web/sphinx/etc/sphinx.conf --all //其中參數--all表示生成所有索引 也可以是所以的名字 #/usr/web/sphinx/bin/indexer -c /usr/web/sphinx/etc/sphinx.conf test1
--rotate 用于輪換索引,主要是再不停止服務的時候,增加索引
--merge 合并索引
//命令行測試搜索索引 #/usr/web/sphinx/bin/search -c /usr/web/sphinx/etc/sphinx.conf -i test1 -q test //啟動搜索 #/usr/web/sphinx/bin/searchd -c /usr/web/sphinx/etc/sphinx.conf //停止搜索 #/usr/web/sphinx/bin/searchd -c /usr/web/sphinx/etc/sphinx.conf --stop //開啟防火墻 9312 端口 #vi /etc/sysconfig/iptables