记录XunSearch(讯搜)的使用教程步骤(CentOS7下)

记录XunSearch(讯搜)的使用教程步骤(CentOS7下),第1张

记录XunSearch(讯搜)的使用教程步骤(CentOS7下)


一、安装编译工具

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

补充:安装wget / bzip2
参考:https://blog.csdn.net/cs23405/article/details/82019881


二、下载安装xunsearch

cd /usr/local/
wget http://www.xunsearch.com/download/xunsearch-full-latest.tar.bz2
tar -xjf xunsearch-full-latest.tar.bz2


三、执行安装脚本

根据提示进行 *** 作,主要是输入 xunsearch 软件包的安装目录,强烈建议单独 规划一个目录,而不是混到别的软件目录中。


cd xunsearch-full-1.4.13
sh setup.sh

第一次安装的话,过程可能会稍显漫长,请不必着急,您大可泡杯茶一边喝一边等待即可。



四、启动服务

/usr/local/xunsearch/bin/xs-ctl.sh start

~~~~

防火墙设置(没有则跳过)

如果您的 SDK 调用和 xunsearch 服务端不在同一服务器,请使用 -b inet 方式启动脚本, 并注意借助类似 iptables 的防火墙来控制 xunsearch 的 8383/8384 两个端口的访问权限。


启动脚本用法举例如下,以下均为合法使用方式:
bin/xs-ctl.sh -b local start // 监听在本地回环地址 127.0.0.1 上
bin/xs-ctl.sh -b inet start // 监听在所有本地 IP 地址上
bin/xs-ctl.sh -b a.b.c.d start // 监听在指定 IP 上 我是不在同一服务器上,因此我选择这一种(bin/xs-ctl.sh -b 195.241.23.32 start)
bin/xs-ctl.sh -b unix start // 分别监听在 tmp/indexd.sock 和 tmp/searchd.sock
配置防火墙,开启8383端口、8384端口
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8383 -j ACCEPT #允许8383端口通过防火墙
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8484 -j ACCEPT #允许8384端口通过防火墙
/etc/init.d/iptables restart #重启防火墙使配置生效

使用 netstat -anlpt 查看端口 (杀掉占用端口的进程 kill -9 进程id)
检测 PHP-SDK 的运行条件


五、创建配置文件

vi /usr/local/xunsearch/sdk/php/app seo.ini

示例:

project.name = xiangmu
project.default_charset = utf-8
server.index = 8383
server.search = 8384

[id]
type = id

[title]
type = title

[content]
tpye = content

参考:https://www.jianshu.com/p/882f003ca71c


六、建索引

util/Indexer.php --rebuild --source=mysql://你的数据库用户名:你的数据库密码@你的数据库IP/你的数据库名 --sql="你要执行的SQL语句" --filter=debug --project=你的项目名 >日志文件名

示例

cd /usr/local/xunsearch/sdk/php

util/Indexer.php --rebuild --source=mysql://root:[email protected]/news1 --sql="select id,title,content FROM news_content" --project=xiangmu

其他参考:https://www.cnblogs.com/zsxfbj/p/php_env_error.html
https://blog.csdn.net/wuxing164/article/details/50764878


七、测试搜索

cd xunsearch/sdk/php
util/Quset.php 项目 测试

参考搜索测试文档:http://www.xunsearch.com/doc/php/guide/util.quest


八、在web目录下创建xunsearch前端搜索页面骨架

sudo xunsearch/sdk/php/util/SearchSkel.php xiangmu /library/WebServer/Documents

参考生成搜索代码文档:http://www.xunsearch.com/doc/php/guide/util.skel

九、本地开启PHP环境

十、浏览器打开本地localhost下生成的xunsearch前端搜索页面

http://localhost/xiangmu/search.php

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/588240.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-12
下一篇 2022-04-12

发表评论

登录后才能评论

评论列表(0条)

保存