zoukankan      html  css  js  c++  java
  • sphinx-2.1.9的安装使用

    1.下载/编译安装

    1 cd /usr/local/src
    2 wget http://sphinxsearch.com/files/sphinx-2.1.9-release.tar.gz
    3 tar -xf sphinx-****.tar.gz
    4 cd sphinx-****
    5 ./configure -prefix=/usr/local/sphinx  --with-mysql=/usr/local/mysql8(mysql的安装目录)
    6 make && make install

    2.配置sphinx

    1 cd /usr/local/sphinx/etc 
    2 cp sphinx-min.conf.dist  sphinx.conf  // 编辑配置

    配置文件如下:
     1 source main
     2 {
     3     type            = mysql
     4 
     5     sql_host        = localhost
     6     sql_user        = root
     7     sql_pass        = root
     8     sql_db            = post
     9     sql_port        = 3306    # optional, default is 3306
    10 
    11     sql_query        = 
    12         SELECT id, title, content 
    13         FROM post_article
    14 
    15     #sql_attr_uint        = group_id
    16     #sql_attr_timestamp    = date_added
    17 
    18     sql_query_info        = SELECT * FROM post_article WHERE id=$id
    19 }
    20 
    21 
    22 index main
    23 {
    24     source            = main
    25     path            = /usr/local/sphinx/var/data/main
    26     docinfo            = none
    27     charset_type        = sbcs
    28 }
    29 
    30 indexer
    31 {
    32     mem_limit        = 128M
    33 }
    34 
    35 
    36 searchd
    37 {
    38     listen            = 9312
    39     listen            = 9306:mysql41
    40     log            = /usr/local/sphinx/var/log/searchd.log
    41     query_log        = /usr/local/sphinx/var/log/query.log
    42     read_timeout        = 5
    43     max_children        = 30
    44     pid_file        = /usr/local/sphinx/var/log/searchd.pid
    45     max_matches        = 1000
    46     seamless_rotate        = 1
    47     preopen_indexes        = 1
    48     unlink_old        = 1
    49     workers            = threads # for RT to work
    50     binlog_path        = /usr/local/sphinx/var/data
    51 }

     3.测试

    1 cd /usr/local/sphinx
    2 ./bin/indexer --all
    3 会有报错,报错信息如下: 4 error while loading shared libraries: libmysqlclient.so.21: cannot open shared object file: No such file or directory 5 解决办法: 6 ln -s /usr/local/mysql8/lib/libmysqlclient.so.21 /usr/lib/libmysqlclient.so.21

    从新 ./bin/index.....
  • 相关阅读:
    Go视频教程
    Mysql常用
    同步Redux
    React跨组件通讯
    React组件通讯
    React
    git生成公钥和私钥
    常用经典算法---希尔排序
    string和c_str()使用时的坑
    腾讯云python网站开发环境搭建
  • 原文地址:https://www.cnblogs.com/baikaishui-liang/p/10155818.html
Copyright © 2011-2022 走看看