Coreseek为企业级搜索建立索引,linux中安装配置

作者: win10  发布:2019-09-11

Sphinx是二个基于SQL的全文字笔迹核实索引擎,能够组成MySQL,PostgreSQL做全文字笔迹查验索,它能够提供比数据库本人更规范的追寻效果,使得应用程序更易于达成职业化的全文字笔迹核实索。Sphinx非常为一些脚本语言设计搜索API接口,如PHP,Python,Perl,Ruby等,同一时候为MySQL也筹算了三个仓库储存引擎插件

cmake-2.8.3 mysql5.5.9 mmseg-3.2.14 csft-4.0.1生产条件中装置
 
注:该文书档案是Dell 2950 服务器上举行安装的,本文书档案只疏解安装的历程,给出测验的步调,但是不提啪啪啪置文件;
首先介绍一下coreseek:
Coreseek 是一款汉语全文检索/搜索软件,以GPLv2许可探究开源发表,基于Sphinx研究开发并独自宣布,专攻普通话寻找和消息管理领域,适用于行当/垂直搜索、论坛/站内找寻、数据库寻觅、文书档案/文献检索、新闻搜索、数据发现等接纳场景,顾客能够下载应用;同不常间针对有实际须求的客商,大家还提供规范的检索本事与本地化Sphinx本领援助服务(客商中,记录量最大已超越30亿条,文本体量最大已抢先5TB),官方网址。
 
一、环境:
1.连串版本:
[root@luowei01 bin]# lsb_release -a
LSB Version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 5.7 (Final)
Release: 5.7
Codename: Final
 
2.内核版本:
[root@luowei01 bin]# uname -r
2.6.18-274.7.1.el5
 
3.CPU个数
[root@luowei01 bin]# cat /proc/cpuinfo |grep -c processor
4
 
4.硬件创建商
[root@luowei01 bin]#  dmidecode -s system-product-name
PowerEdge 2950

# 安装sphinx 2.x

二、所需软件包:
wget
wget
wget
wget
wget

 代码如下

三、软件依类别安装:
1.编写翻译安装cmake
tar zxvf cmake-2.8.3.tar.gz
cd cmake-2.8.3
./bootstrap
make
make install
cd ../
tar zxvf coreseek-4.0.1-beta.tar.gz
tar zxvf sphinx-trunk.tar.gz
tar zxvf mysql-5.5.9.tar.gz
cd sphinx-trunk
patch -p0 < ../Sphinx_1.11-dev_sphinxse_mysql-5.5.8.diff  
cp -R mysqlse ../mysql-5.5.9/storage/sphinx
cd ../
 
2.安装MySQL
cd mysql-5.5.9/
sh BUILD/autorun.sh
mkdir -p /var/lib/mysql
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/etc -DMYSQL_DATADIR=/data/mysql
-DDEFAULT_CHARSET=gbk -DEXTRA_CHARSETS=all -DWITH_SSL=system -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1
-DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DCMAKE_BUILD_TYPE=Release -DWITH_SPHINX_STORAGE_ENGINE=1
make
make install
/usr/local/useradd -M -o -r -d /var/lib/mysql -s /bin/bash -c "MySQL Server" -u 27 mysql
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql
chown -R mysql:mysql /data/mysql
chmod -R 755 /data/mysql
chmod w /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql
cp -rf support-files/my-medium.cnf /etc/my.cnf
cp -rf support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld
/sbin/chkconfig --add mysqld
/sbin/chkconfig mysqld on
cp -rf /usr/local/mysql/bin/* /usr/sbin
ln -s /usr/localmysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
cd ../
echo "/usr/local/mysql/lib" > /etc/ld.so.conf.d/mysql.conf
echo "/usr/local/lib" >> /etc/ld.so.conf.d/mysql.conf
ldconfig -v
service mysqld start
mysql -uroot -p
GRANT ALL PRIVILEGES ON *.* TO root@192.168.0.104 IDENTIFIED BY 'RedHat' WITH GRANT OPTION;
INSTALL PLUGIN sphinx SONAME "ha_sphinx.so";
SHOW ENGINES;
 
3.编译安装coreseek的mmseg分词
cd coreseek-4.0.1-beta/mmseg-3.2.14
./bootstrap
./configure --prefix=/usr/local/mmseg
make
make install
cd ../../
 
4.编写翻译安装csft
cd coreseek-4.0.1-beta/csft-4.0.1
sh buildconf.sh
./configure --prefix=/usr/local/sphinx --with-mysql=/usr/local/mysql --without-unixodbc --with-mmseg --with-mmseg-includes=/usr/local/mmseg/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg/lib/ --with-mysql
vim /opt/coreseek-4.0.1-beta/csft-4.0.1 文件

LIBS = -lm -lexpat -L/usr/local/lib
改成
LIBS = -lm -lexpat -liconv -L/usr/local/lib
make
make install
cd ../
 
5.导入测量试验sql并测验
cd /usr/local/sphinx/etc
cp sphinx.conf.dist csft.conf
mysql -uroot test < /usr/local/sphinx/etc/example.sql
ln -sv /usr/local/mysql/lib/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16
/usr/local/sphinx/bin/indexer --all
/usr/local/mmseg/bin/mmseg -d /usr/local/mmseg/etc var/test/test.xml
/usr/local/sphinx/bin/searchd --config /usr/local/sphinx/etc/sphinx.conf
/usr/local/sphinx/bin/search --config /usr/local/sphinx/etc/sphinx.conf  'abc'
 
安装进度中遇见的难点及缓慢解决办法:
1.在INSTALL PLUGIN sphinx SONAME "ha_sphinx.so";时候,找不到ha_sphinx.so的消除情势:
Q:Can't open shared library '/usr/local/mysql/lib/plugin/ha_sphinx.so'
A:
Download the patch file from

cd path_of_sphinx ; patch -p1 < /path/to/Sphinx_1.11-dev_sphinxse_mysql-5.5.8.diff
 
2.提示FATAL: no readable config file (looked in /usr/local/sphinx/etc/csft.conf, ./csft.conf).
焚林而猎办法:
2019篮球世界杯投注官网,cp /PATH_TO_SPHINX/etc/sphinx.conf.dist /PATH_TO_SPHINX/etc/csft.conf
 
3.提示error while loading shared libraries libmysqlclient.so.16
减轻情势:
echo "/usr/local/mysql/lib" > /etc/ld.so.conf.d/mysql.conf
ldconfig
ln -sv /usr/local/mysql/lib/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16
 
目的在于此文书档案能帮忙越来越多心爱开源职业的人!

复制代码

2019篮球世界杯投注官网 1

cd /home/addcn
wget
tar xvf sphinx-2.1.1-beta.tar.gz
cd sphinx-2.1.1-beta
make clean
./configure –prefix=/usr/local/sphinx –with-mysql=/usr/local/mysql
make && make install

# 配置
cd /usr/local/sphinx/etc/

# 错误
export LD_LIBRARY_PATH=”/usr/local/mysq/lib:/usr/lib:$LD_LIBRARY_PATH”

# 启动
/usr/local/sphinx/bin/searchd –config /usr/local/sphinx/etc/sphinx.conf

# 停止
/usr/local/sphinx/bin/searchd –stop

# 登入
/usr/local/mysql/bin/mysql -P9306 –protocol TCP

# 更新
/usr/local/sphinx/bin/indexer –config /usr/local/sphinx/etc/sphinx.conf –all –rotate

# 关联为实时索引
TRUNCATE RTINDEX rt;
ATTACH INDEX disk TO RTINDEX rt;

设置好今后大家的php mysql全文字笔迹核算索恐怕品质要增进几百倍或几万倍哦。

...

本文由篮球世界杯投注-2019篮球世界杯投注官网发布于win10,转载请注明出处:Coreseek为企业级搜索建立索引,linux中安装配置

关键词: 篮球世