NextCloud17 Elasticsearch7.4 全文检索

一、安装 full text 相关的几个 app 插件,可以直接在nextcloud中设置→应用中搜索安装

二、安装Elasticsearch(yum安装参考下面两个文档)

https://blog.csdn.net/smxalong/article/details/103568418

https://blog.csdn.net/smxalong/article/details/103568146

三、安装ES插件和ik分词

参考文档:https://github.com/nextcloud/fulltextsearch/wiki/Basic-Installation

# ingest-attachment
/usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-attachment

#安装IK分词
/usr/share/elasticsearch/bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.5.0/elasticsearch-analysis-ik-7.5.0.zip

如果要删除重新安装

/usr/share/elasticsearch/bin/elasticsearch-plugin remove ingest-attachment
/usr/share/elasticsearch/bin/elasticsearch-plugin remove analysis-ik

四、在NextCloud设置管理页面配置全文搜索设置(确保full text相关插件都已经启用)

五、初始化索引,确保ES服务器正常启动

[root@bogon ~]# curl -X GET localhost:9200
{
  "name" : "bogon",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "ZReKMkitQ5CgpjTsz6HMIQ",
  "version" : {
    "number" : "7.4.2",
    "build_flavor" : "default",
    "build_type" : "rpm",
    "build_hash" : "2f90bbf7b93631e52bafb59b3b049cb44ec25e96",
    "build_date" : "2019-10-28T20:40:44.881551Z",
    "build_snapshot" : false,
    "lucene_version" : "8.2.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

进入nextcloud目录:

cd /www/wwwroot/test.wxlcloud.com/nextcloud

初始化索引(需要安装 php-readline php-pcntl 两个扩展):

sudo -u www php ./occ fulltextsearch:index

六、创建并启动持续索引服务

由于全文索引需要不停的进行(因为有新的文件进来),做成centos服务

/etc/systemd/system/ 目录下创建 nextcloud-fulltext-elasticsearch-worker.service 文件,文件内容如下(用到MySql服务):

[Unit]
Description=Elasticsearch Worker for Nextcloud Fulltext Search
After=network.target mysql.service
Requires=mysql.service

[Service]
User=www
Group=www
WorkingDirectory=/www/wwwroot/test.wxlcloud.com/nextcloud
ExecStart=/usr/bin/php /www/wwwroot/test.wxlcloud.com/nextcloud/occ fulltextsearch:live -q
ExecStop=/usr/bin/php /www/wwwroot/test.wxlcloud.com/nextcloud/occ fulltextsearch:stop
Nice=19
Restart=always

[Install]
WantedBy=multi-user.target

开机启动:

systemctl enable nextcloud-fulltext-elasticsearch-worker.service
systemctl start nextcloud-fulltext-elasticsearch-worker.service

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值