ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Sphinx的介绍与安装

Sphinx的介绍与安装

原创 Linux操作系统 作者:a3zi 时间:2015-01-08 15:05:50 0 删除 编辑

 

Sphinx是什么

Sphinx由俄罗斯人Andrew Aksyonoff 开发的高性能全文搜索软件,是一个基于SQL的全文搜索引擎,可以结合MySQL,PostgreSQL做全文搜索,它可以提供比数据库本身更专业的搜索功能,使得应用程序更容易实现专业化的全文检索。

为什么要用Sphinx

当你的数据库已经达到几百万,很多用户都反映网页搜索的速度非常慢的时候,那么你就可以考虑用Sphinx。Sphinx单一索引最大可包含1亿条记录,在1千万条记录情况下的查询速度为0.x秒(毫秒级)。Sphinx创建索引的速度为:创建100万条记录的索引只需 3~4分钟,创建1000万条记录的索引可以在50分钟内完成,而只包含最新10万条记录的增量索引,重建一次只需几十秒。

Sphinx的安装部署

我在/root/install下放了3个安装文件mmseg-3.2.14.tar.gz,coreseek-4.1-beta.tar.gz,sphinx-2.0.8-release.tar.gz

我之前已经用yum安装了mysql.

tar -zxvf sphinx-2.0.8-release.tar.gz

tar -zxvf coreseek-4.1-beta.tar.gz

tar -zxvf mmseg-3.2.14.tar.gz

cd sphinx-2.0.8-release

yum -y install libxml2-devel expat-devel

yum -y install gcc-c++

./configure --prefix=/usr/local/sphinx   --with-mysql-includes=/usr/include/mysql/ --with-mysql-libs=/usr/lib64/mysql/

 

make && make install

cd ../mmseg-3.2.14

yum -y install autoconf

yum -y install automake

yum -y install libtool

./bootstrap

./configure --prefix=/usr/local/mmseg3

make && make install

cd ../coreseek-4.1-beta/csft-4.1/

sh buildconf.sh

./configure --prefix=/usr/local/coreseek  --without-unixodbc --with-mmseg --with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg3/lib/ --with-mysql  --with-mysql-includes=/usr/include/mysql/ --with-mysql-libs=/usr/lib64/mysql/

 

make && make install

配置sphinx

cp  /usr/local/coreseek/etc/ sphinx-min.conf.dist  /usr/local/coreseek/etc/sphinx.conf

修改sphinx.conf文件中的数据库参数配置

sql_host                = localhost
sql_user                = root
sql_pass               =
sql_db                  = test

体验数据:/usr/local/coreseek/etc/example.sql 导入到数据库

source   /usr/local/coreseek/etc/example.sql

新建索引:

/usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/sphinx.conf --all

测试搜索:

/usr/local/coreseek/bin/search test  -c /usr/local/coreseek/etc/sphinx.conf


如果测试有返回,恭喜你的sphinx全文索引服务器配置成功

 

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29806344/viewspace-1394712/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-08-15

  • 博文量
    45
  • 访问量
    228899