• centos安装coreseek


    介绍

        coreseek是一款基于sphinx开源的搜索引擎,专门为用户提供免费的中文全文检索系统,coreseek被称为带有中文分词的sphinx,与sphinx不同的是coreseek增加了一个带有中文分司的词库。

    1.依赖包的安装(包名可能不正确,可以yum search 一下)

    yum install glibc make gcc g++ gcc-c++ libtool autoconf automake imake mysql-devel libxml2-devel expat-devel

    2.编码保证为utf-8
    运行locale保证如下设置
    LANG=zh_CN.UTF-8
    LC_ALL="zh_CN.UTF-8"

    3.先清除以往autoconf

    yum erase autoconf 
     
     
    卸载后会发现libtool也被卸载了,会出现如下错误
    configure.in:26: error: possibly undefined macro: AM_PROG_LIBTOOL
          If this token and others are legitimate, please use m4_pattern_allow.
          See the Autoconf documentation.
    解决办法:     
    wget http://mirror.bjtu.edu.cn/gnu/libtool/libtool-2.4.2.tar.gz
     ./configure
    make
    make install


    4.autoconf、automake安装
    tar xzvf autoconf-2.64.tar.gz
    cd autoconf-2.64
    ./configure
    make
    make install

    tar xzvf automake-1.11.2.tar.gz
    cd automake-1.11.2
    ./configure
    make
    make install

    5.下载coreseek

    wget http://www.coreseek.cn/uploads/csft/3.2/coreseek-4.1-beta.tar.gz
    tar zxvf coreseek-4.1-beta.tar.gz
    cd coreseek-4.1-beta

    6.安装mmseg

    cd mmseg-3.2.14
    ./bootstrap    #输出的warning信息可以忽略,如果出现error则需要解决
    ./configure --prefix=/usr/local/mmseg
    make && make install

    7.安装coreseek

    cd csft-4.1
    sh buildconf.sh
    ./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

    此时先修改文件
    vim src/Makefile

    LIBS = -ldl -lm -lz -lexpat  -L/usr/local/lib -lrt  -lpthread
    变成
    LIBS = -ldl -lm -lz -lexpat -liconv  -L/usr/local/lib -lrt  -lpthread

    make && make install

    8.##测试mmseg分词,coreseek搜索(需要预先设置好字符集为zh_CN.UTF-8,确保正确显示中文)

    cd testpack
    cat var/test/test.xml    #此时应该正确显示中文
    /usr/local/mmseg/bin/mmseg -d /usr/local/mmseg/etc/  /home/software/server/coreseek-4.1-beta/mmseg-3.2.14/src/t1.txt
    /usr/local/mmseg/bin/mmseg -d /usr/local/mmseg/etc/ /home/software/server/coreseek-4.1-beta/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.

    若发现错误
     error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory
    解决方式
    cd /etc
    ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2
    ldconfig

    9.配置mysql,导入测试数据

    create database test;
    mysql -uroot -proot test < /home/software/server/coreseek-4.1-beta/testpack/var/test/documents.sql
    quit

    cp /home/software/server/coreseek-4.1-beta/testpack/etc/csft_mysql.conf /usr/local/coreseek/etc/

    10.配置csft_mysql.conf文件

    mkdir /usr/local/coreseek/var/data/
    配置csft_mysql.conf文件
    vim /usr/local/coreseek/etc/csft_mysql.conf
       sql_user                = root
       sql_pass                =
       path             = /usr/local/coreseek/var/data/mysql
       charset_dictpath = /usr/local/mmseg/etc/
       
    pid_file = /usr/local/coreseek/var/log/searchd_mysql.pid
    log = /usr/local/coreseek/var/log/searchd_mysql.log
    query_log = /usr/local/coreseek/var/log/query_mysql.log

    11.启动sphinx搜索
    /usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/csft_mysql.conf --all
    /usr/local/coreseek/bin/searchd -c /usr/local/coreseek/etc/csft_mysql.conf

    如果报错
    WARNING: index 'mysql': preload: failed to open var/data/mysql.sph: No such file or directory; NOT SERVING
    FATAL: no valid indexes to serve
    解决
    新建立索引
    /usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/csft_mysql.conf --all

    更改
    mysql的问题 stock路径问题,需要在my.cnf更改 /var/lib/mysql/mysql.sock
    vim /etc/my.cnf
    #socket         = /tmp/mysql.sock
    socket          = /var/lib/mysql/mysql.sock


    防火墙问题  关闭防火墙


    12.命令
    启动
    /usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/csft_mysql.conf --all
    /usr/local/coreseek/bin/searchd -c /usr/local/coreseek/etc/csft_mysql.conf

    coreseek重新索引(数据有变动时需要重新索引)
    /usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/csft_mysql.conf --all --rotate


    13.保证跨机器访问,关闭防火墙
    service iptables stop

  • 相关阅读:
    [转载] 淘宝千万级并发分布式架构的14次演进
    [转载] 分布式锁用Redis还是Zookeeper?
    .Net面试题收集
    List,set,Map 的用法和区别
    android 布局中 layout_gravity、gravity、orientation、layout_weight
    Android getWindow().setFlags方法
    android动画之Interpolator和AnimationSet
    Android中Animation详解
    android ImageView scaleType属性
    tools:context=".MainActivity的作用
  • 原文地址:https://www.cnblogs.com/zuikeol/p/6807989.html
Copyright © 2020-2023  润新知