Sphinx--强大的开源全文检索引擎,Coreseek--免费开源的中文全文检索引擎

软件版本:coreseek-4.1

mmseg-3.2.14

autoconf-2.64

老版本的coreseek-3.2和mmseg-3.2.13安装过程一样。

一、安装前准备编译环境

1.1 yum安装编译环境和mysql开发包

# yum install   libtool gcc-c++

# yum install   mysql-devel libxml2-devel expat-devel

1.2 编译安装autoconf

autoconf automake手工编译安装(因aclocal.m4文件由autoconf 2.64生成)。

# tar xzvf autoconf-2.64.tar.gz

# ./configure

# make

# make install

1.3 编译安装automake

# tar xzvf automake-1.11.2.tar.gz

# cd automake-1.11.2

# ./configure

# make

# make install

二、安装mmseg

# cd coreseek-3.2.13

# cd mmseg-3.2.13

# ./bootstrap    #输出的warning信息可以忽略,如果出现error则需要解决

# ./configure --prefix=/usr/local/mmseg

# make

# make install

三、安装coreseek

# cd csft-3.2.13

检查系统环境

# sh buildconf.sh    #输出的warning信息可以忽略,如果出现error则需要解决

配置时要加上mysql数据源的支持

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

# make

# make install

# cd ..

四、mmseg中文分词测试,coreseek搜索测试

4.1 mmseg中文分词测试

# cd testpack

此时应该正确显示中文,需要预先设置好字符集为zh_CN.UTF-8,确保正确显示中文。

# cat var/test/test.xml

中文分词测试

# /usr/local/mmseg/bin/mmseg -d /usr/local/mmseg/etc/ /root/coreseek-3.2.13/mmseg-3.2.13/src/t1.txt

# /usr/local/mmseg/bin/mmseg -d /usr/local/mmseg/etc/ /root/coreseek-3.2.13/testpack/var/test/test.xml

配置测试,测试是否可以正确运行

# /usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/sphinx-min.conf.dist

csft-4.0版显示:ERROR: nothing to do.

4.2 coreseek中文全文检索测试

查看正常索引指定数据时的提示信息

# /usr/local/coreseek/bin/indexer -c /root/coreseek-4.1-beta/testpack/etc/csft.conf

# /usr/local/coreseek/bin/indexer -c /root/coreseek-3.2.13/testpack/etc/csft.conf

查看正常索引全部数据时的提示信息

# /usr/local/coreseek/bin/indexer -c /root/coreseek-3.2.13/testpack/etc/csft.conf  --all

查看正常测试搜索时的提示信息

# /usr/local/coreseek/bin/search  -c /root/coreseek-3.2.13/testpack/etc/csft.conf

# /usr/local/coreseek/bin/search  -c /root/coreseek-4.1-beta/testpack/etc/csft.conf

查看正常测试搜索关键词时的提示信息

# /usr/local/coreseek/bin/search  -c /root/coreseek-3.2.13/testpack/etc/csft.conf -a 提供了搜索服务

# /usr/local/coreseek/bin/search  -c /root/coreseek-4.1-beta/testpack/etc/csft.conf -a 提供了搜索服务

4.3 搜索服务的启动与关闭

开启搜索服务

# /usr/local/coreseek/bin/searchd  -c /root/coreseek-3.2.13/testpack/etc/csft.conf

# /usr/local/coreseek/bin/searchd -c /root/coreseek-4.1-beta/testpack/etc/csft.conf

停止搜索服务

# /usr/local/coreseek/bin/searchd  -c /root/coreseek-3.2.13/testpack/etc/csft.conf --stop

# /usr/local/coreseek/bin/searchd -c /root/coreseek-4.1-beta/testpack/etc/csft.conf --stop

五、配置、测试mysql数据源搜索

5.1 准备mysql环境

sql测试数据路径

/root/coreseek-4.1-beta/testpack/var/test/documents.sql

创建test数据库

mysql>create database test;

导入sql测试数据

mysql -uroot -p123456 test < /root/coreseek-4.1-beta/testpack/var/test/documents.sql

拷贝mysql示例配置文件到coreseek安装目录

# cp /root/coreseek-4.1-beta/testpack/etc/csft_mysql.conf /usr/local/coreseek/etc/

修改上述配置文件的数据库主机地址,账号,密码等。

5.2 启动搜索服务

启动搜索服务,这里选择后台运行的方式

# /usr/local/coreseek/bin/searchd -c /usr/local/coreseek/etc/csft_mysql.conf

以在log中记录每个查询的io和cpu状态的方式启动搜索服务

# /usr/local/coreseek/bin/searchd  --iostats --cpustats -c /usr/local/coreseek/etc/csft_mysql.conf

停止搜索服务

# /usr/local/coreseek/bin/searchd -c /usr/local/coreseek/etc/csft_mysql.conf --stop

查看搜索服务状态

# /usr/local/coreseek/bin/searchd -c /usr/local/coreseek/etc/csft_mysql.conf --status

5.3 本机搜索测试

# /usr/local/coreseek/bin/search -c /usr/local/coreseek/etc/csft_mysql.conf -a 百度成立

停止mysql,观察以上本机搜索测试是否正常

# /etc/init.d/mysqld stop

启动mysql,观察以上本机搜索测试是否正常

# /etc/init.d/mysqld start

5.4 异机php客户端api调用测试

API路径:/root/coreseek-4.1-beta/testpack/api

拷贝test.php 和sphinxapi.php到支持php环境的机器,然后修改数据库地址,账号,密码等配置,测试如下:

# php test.php  中国

PHP Warning:  Module 'redis' already loaded in Unknown on line 0

Query '中国 ' retrieved 1 of 1 matches in 0.016 sec.

Query stats:

'中国' found 17 times in 1 documents

六、后期根据需求自定义返回数据格式

七、安装配置过程可能遇到的问题及解决方法

7.1 编译问题及解决方法

# sh buildconf.sh

aclocal.m4:20: warning: this file was generated for autoconf 2.64.

You have another version of autoconf.  It may work, but is not guaranteed to.

If you have problems, you may need to regenerate the build system entirely.

To do so, use the procedure documented by the package, typically `autoreconf'.

configure.ac:13: error: Autoconf version 2.62 or higher is required

aclocal.m4:518: AM_INIT_AUTOMAKE is expanded from...

configure.ac:13: the top level

autom4te: /usr/bin/m4 failed with exit status: 63

autoheader: /usr/bin/autom4te failed with exit status: 63

我的autoconf版本2.59

# yum list installed|grep autoconf

autoconf.noarch                          2.59-12                       i

解决方法:

手工编译安装autoconf-2.64 ,automake-1.11.2,(因aclocal.m4文件由autoconf 2.64生成)。

7.2 版本3.2.13生成索引的问题及解决方法

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

Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]

Copyright (c) 2007-2010,

Beijing Choice Software Technologies Inc (http://www.coreseek.com)

using config file 'etc/csft.conf'...

indexing index 'xml'...

Unigram dictionary load Error

Segmentation fault

解决办法:

# more /root/coreseek-3.2.13/testpack/etc/csft.conf

词典路径不对,修改实际安装字典路径,默认使用相对路径,建议使用绝对路径。

7.3 版本4.1生成索引的问题及解决方法

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

Coreseek Fulltext 4.1 [ Sphinx 2.0.2-dev (r2922)]

Copyright (c) 2007-2011,

Beijing Choice Software Technologies Inc (http://www.coreseek.com)

using config file 'etc/csft.conf'...

indexing index 'xml'...

Unigram dictionary load Error

FATAL:  Tokenizer initialization failure.

解决办法:

# more /root/coreseek-3.2.13/testpack/etc/csft.conf

词典路径不对,修改实际安装字典路径,默认使用相对路径,建议使用绝对路径。

7.4 编译安装软件的小建议:编译安装完成后,不要删除源代码,不然无法unnistall

make的原理是执行一个叫Makefile文件里的指令,make的基本用处是自动根据makefile里的指令来编译源文件。它还可以用来做比 如安装软件,卸载软件等事情,但前提是作者在makefile里写了。然后用make install的话,make程序就会按照上面install:后 面的指令< commands >执行安装,uninstall也是一样的道理,大部分的作者会写有卸载的部分,这时只要简单地执行 make unistall就可以,如果作者懒没有写,那就只有根据make install中的步骤,看它把什么文件拷到哪去了,然后分别手动删除。

还有关键的一点是,编译安装完成后,不要删除源代码,不然就算作者写了unnistall目标,你也没有makefile可以执行了。

7.5 make: Nothing to be done for `all' 解决方法

1.这句提示是说明你已经编译好了,而且没有对代码进行任何改动。
若想重新编译,可以先删除以前编译产生的目标文件:
make clean
然后再
make
2.出现这种情况解决方法:
a.make clean 清除安装时留下的文件
b.在运行一下ldconfig
c.再make 可运行出结果

7.6  error while loading shared libraries: xxx.so.x"错误的原因和解决办法

一般我们在Linux下执行某些外部程序的时候可能会提示找不到共享库的错误, 比如:
tmux: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory
原因一般有两个, 一个是操作系统里确实没有包含该共享库(lib*.so.*文件)或者共享库版本不对, 遇到这种情况那就去网上下载并安装上即可.
另外一个原因就是已经安装了该共享库, 但执行需要调用该共享库的程序的时候, 程序按照默认共享库路径找不到该共享库文件.
所以安装共享库后要注意共享库路径设置问题, 如下:
1) 如果共享库文件安装到了/lib或/usr/lib目录下, 那么需执行一下ldconfig命令
ldconfig命令的用途, 主要是在默认搜寻目录(/lib和/usr/lib)以及动态库配置文件/etc/ld.so.conf内所列的目录下,
搜索出可共享的动态链接库(格式如lib*.so*), 进而创建出动态装入程序(ld.so)所需的连接和缓存文件.
缓存文件默认为/etc/ld.so.cache, 此文件保存已排好序的动态链接库名字列表.

2)
如果共享库文件安装到了/usr/local/lib(很多开源的共享库都会安装到该目录下)或其它"非/lib或/usr/lib"目录下,
那么在执行ldconfig命令前, 还要把新共享库目录加入到共享库配置文件/etc/ld.so.conf中, 如下:

# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
# echo "/usr/local/lib" >> /etc/ld.so.conf
# ldconfig

3) 如果共享库文件安装到了其它"非/lib或/usr/lib" 目录下,
但是又不想在/etc/ld.so.conf中加路径(或者是没有权限加路径). 那可以export一个全局变量LD_LIBRARY_PATH,
然后运行程序的时候就会去这个目录中找共享库.

LD_LIBRARY_PATH的意思是告诉loader在哪些目录中可以找到共享库. 可以设置多个搜索目录, 这些目录之间用冒号分隔开.
比如安装了一个mysql到/usr/local/mysql目录下, 其中有一大堆库文件在/usr/local/mysql/lib下面,
则可以在.bashrc或.bash_profile或shell里加入以下语句即可:

export LD_LIBRARY_PATH=/usr/local/mysql/lib:$LD_LIBRARY_PATH

一般来讲这只是一种临时的解决方案, 在没有权限或临时需要的时候使用.

4)如果程序需要的库文件比系统目前存在的村文件版本低,可以做一个链接
比如:
error while loading shared libraries: libncurses.so.4: cannot open shared
object file: No such file or directory

ls /usr/lib/libncu*
/usr/lib/libncurses.a /usr/lib/libncurses.so.5
/usr/lib/libncurses.so /usr/lib/libncurses.so.5.3

可见虽然没有libncurses.so.4,但有libncurses.so.5,是可以向下兼容的
建一个链接就好了
ln -s /usr/lib/libncurses.so.5.3 /usr/lib/libncurses.so.4

Coreseek安装测试配置指南(转)的更多相关文章

  1. P6 EPPM 安装与配置指南 16 R1 2016.4

       关于安装和 配置P6 EPPM 本指南告诉你如何自动 安装和配置您的应用程序. 在您开始之前,阅读 先决条件 P6 EPPM配置 (7页). 安装P6 EPPM 您将使用 安装程序 (窗口) . ...

  2. P6 EPPM 16.1 安装和配置指南 1

    安装和配置指南下一topiccontents这些指南解释如何安装和配置数据库服务器,和P6 EPPM,模块:他们还提供在P6 EPPM能够解决所有模块的概述.标准指南帮助您配置和部署应用程序向导P6 ...

  3. P6 EPPM R16.1安装与配置指南(三)

    P6 EPPM R16.1安装与配置指南(三) 解压:V137390-01.zip 修改 D:\P6_R161\p6suite\database\dbsetup.bat   的行 SET JAR_FI ...

  4. P6 EPPM R16.1安装与配置指南(二)

    P6 EPPM R16.1安装与配置指南(一) http://www.cnblogs.com/endv/p/5634620.html P6 EPPM R16.1安装与配置指南(二) 环境变量配置 新建 ...

  5. P6 EPPM R16.1安装与配置指南(一)

    标题 http://www.cnblogs.com/endv/p/5634620.html 安装与配置指南安装与配置指南(数据库)说明哪些How to set up the P6专业数据库和服务器.a ...

  6. Linux下安装mantis配置指南【转】

    转自:http://blog.csdn.net/xabc3000/article/details/6858229 目录(?)[-] Linux下安装mantis配置指南 配置Linux下的Apache ...

  7. P6 EPPM 安装和配置指南

    In This Section Installation and Configuration Guide Manual Installation Guides P6 Professional Inst ...

  8. Sphinx(Coreseek)安装和使用指南

    1.安装 1.1安装mmseg ./bootstrap # 必须执行,不然安装会失败 ./configure --prefix=/usr/local/mmseg- #指定安装目录 make make ...

  9. PostgreSQL9.2安装和配置指南

    本文只介绍PostgreSQL9.2在centos上的安装和配置过程 1.执行yum 命令安装PostgreSQL yum install postgresql-server 2.初始化Postgre ...

随机推荐

  1. linux基础命令学习 (十)Vi

    1.vi的基本概念 基本上vi可以分为三种状态,分别是命令模式(command mode).插入模式(Insert mode)和底行模式(last line mode),各模式的功能区分如下:    ...

  2. mybatis源码分析(8)-----事务(mybatis管理、spring管理)

    写在前面 接口:MyBatis的事务Transaction的接口有一下实现类 JdbcTransaction 由jdbc管理的事务(即利用Connection对象完成对事务的提交(commit()). ...

  3. 使MySQL对表名不区分大小写

    今天郁闷死了,在LINUX下调一个程序老说找不到表,但是我明明是建了表的,在MYSQL的命令行下也可以查到,为什么程序就找不到表呢? 后来请教了一个老师才搞定,原来是LINUX下的MYSQL默认是要区 ...

  4. Unity 国际化 多语言设置

    很多游戏中都有语言设置选项,NGUI插件中自带了国际化脚本,但是灵活性较低,而且目前项目是UGUI,以下是修改后,以便记录. Localization和NGUI中用法一样,挂在在一个不销毁的游戏物体上 ...

  5. 【多线程】java多线程Completablefuture 详解【在spring cloud微服务之间调用,防止接口超时的应用】【未完成】

    参考地址:https://www.jianshu.com/p/6f3ee90ab7d3 示例: public static void main(String[] args) throws Interr ...

  6. FIS3配置fis-conf.js

    设置规则的配置接口: fis.match(selector, props); 1.添加md5戳:对 js.css.png 图片引用 URL 添加 md5 戳: fis.match('*.{js,css ...

  7. android NDK编程:使用posix多线程与mutex相互排斥同步

    MainActivity.java 调用原生方法 posixThreads(int threads, int iterations) 启动线程 package com.apress.threads; ...

  8. 神经网络可以拟合任意函数的视觉证明A visual proof that neural nets can compute any function

    One of the most striking facts about neural networks is that they can compute any function at all. T ...

  9. php 验证身份证号码

    身份证号码的结构 身份证号码是特征组合码,由17位数字本体码和一位校验码组成. 排列顺序从左至右依此为:六位数字地址码,八位数字出生日期码,三位数字顺序码和一位数字校验码. 地址码(前六位数) 表示编 ...

  10. 与多线程结合使用的消息处理类Handler、Message

    1. 消息处理类——Handler 消息处理类(Handler)允许发送和处理Message或Runnable对象到其所在线程的MessageQueue中.Handerl有以下两个主要作用: 将Mes ...