linux环境sphinx搭建,sphinx3.2.1 搭建

sphinx官网下载页面(点这里)cd /usr/local/src/

wget http://sphinxsearch.com/files/sphinx-3.2.1-f152e0b-linux-amd64-glibc2.12.tar.gz

//解压

tar sphinx-3.2.1-f152e0b-linux-amd64-glibc2.12.tar.gz

//建立软链

$ ln -s /usr/local/sphinx-3.2.1 /app/sphinx

//复制一个配置文件

cp /app/sphinx/etc/sphinx-mini.conf.dist /application/sphinx/etc/test.conf

//编辑配置文件

vim /app/sphinx/etc/test.conf

导入示例数据> mysql -h127.0.0.1 -uroot -p < example.sql

> 输入数据库密码

mysql> use test

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

+----------------+

| Tables_in_test |

+----------------+

| documents |

| tags |

+----------------+

mysql> select * from documents;

+----+----------+-----------+---------------------+-----------------+--------------------------------------------------------+

| id | group_id | group_id2 | date_added | title | content |

+----+----------+-----------+---------------------+-----------------+--------------------------------------------------------+

| 1 | 1 | 5 | 2020-06-29 17:03:39 | test one | this is my test document number one. also phrases. |

| 2 | 1 | 6 | 2020-06-29 17:03:39 | test two | this is my test document number two |

| 3 | 2 | 7 | 2020-06-29 17:03:39 | another doc | this is another group |

| 4 | 2 | 8 | 2020-06-29 17:03:39 | doc number four | this is to test groups |

+----+----------+-----------+---------------------+-----------------+--------------------------------------------------------+

测试配置> ./bin/indexer --config etc/sphinx.conf

Sphinx 3.2.1 (commit f152e0b)

Copyright (c) 2001-2020, Andrew Aksyonoff

Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)

ERROR: nothing to do.

如未成功或提示此段错误ERROR: index 'test1': sql_connect: failed to load libmysqlclient (or libmariadb) (DSN=mysql://root:***@localhost:3306/test).

安装(仅适用于centos)yum install mysql-devel.x86_64

生成索引数据./bin/searchd --config etc/sphinx.conf

停止服务killall searchd

重新生成testindex索引数据$./bin/indexer testindex --config etc/sphinx.conf --rotate

//重新生成全部索引

./bin/indexer --all --config etc/sphinx.conf --rotate

搜狗词库(点这里)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值