elasticsearch (一): Centos7 RPM 方式安装最新单机版elasticsearch版本7.10.2 并配置中文(ik)、拼音(pinyin)插件

本文主要是介绍elasticsearch (一): Centos7 RPM 方式安装最新单机版elasticsearch版本7.10.2 并配置中文(ik)、拼音(pinyin)插件,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

目录

Centos7  RPM 安装 ES

操作系统介绍:

部署方式选择RPM包管理工具

修改远程访问和更改IP ,重启es常见问题

安装插件: ik  pinyin

中文分词插件地址:

安装中文分词插件

安装拼音分词插件

测试中文分词:

测试拼音分词

打开防火墙 端口




Centos7  RPM 安装 ES

互联网技术分享,正是推动互联网的力量

操作系统介绍:

[root@vcontroller limits.d]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
[root@vcontroller limits.d]# uname -r
3.10.0-1160.11.1.el7.x86_64
[root@vcontroller limits.d]# uname -a
Linux vcontroller 3.10.0-1160.11.1.el7.x86_64 #1 SMP Fri Dec 18 16:34:56 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

 

部署方式选择RPM包管理工具

参考链接:

https://blog.csdn.net/zhezhebie/article/details/105482149

资料我已上传,请下载:https://download.csdn.net/download/shunzi2016/14947537

 

[root@vcontroller ~]# ll
total 311396
-rw-------. 1 root root      1517 Oct 10 11:03 anaconda-ks.cfg
-rw-r--r--. 1 root root 318859205 Jan 26 17:37 elasticsearch-7.10.2-x86_64.rpm
-rwxr-xr-x. 1 root root      2830 Jan  6 18:42 sys_build.sh
[root@vcontroller ~]# rpm -Uvh elasticsearch-7.10.2-x86_64.rpm
warning: elasticsearch-7.10.2-x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID d88e42b4: NOKEY
Preparing...                          ################################# [100%]
Creating elasticsearch group... OK
Creating elasticsearch user... OK
Updating / installing...1:elasticsearch-0:7.10.2-1         ################################# [100%]
### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using systemdsudo systemctl daemon-reloadsudo systemctl enable elasticsearch.service
### You can start elasticsearch service by executingsudo systemctl start elasticsearch.service
Created elasticsearch keystore in /etc/elasticsearch/elasticsearch.keystore
[root@vcontroller ~]#

修改远程访问和更改IP ,重启es常见问题

遇见如下错误

Job for elasticsearch.service failed because the control process exited with error code. See "systemctl status elasticsearch.service" and "journalctl -xe" for details.[root@vcontroller ~]# systemctl status elasticsearch
?.elasticsearch.service - ElasticsearchLoaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)Active: failed (Result: exit-code) since Tue 2021-01-26 17:57:20 CST; 1min 41s agoDocs: https://www.elastic.coProcess: 9586 ExecStart=/usr/share/elasticsearch/bin/systemd-entrypoint -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=78)Main PID: 9586 (code=exited, status=78)Jan 26 17:57:02 vcontroller systemd[1]: Starting Elasticsearch..
Jan 26 17:57:19 vcontroller systemd-entrypoint[9586]: ERROR: [1] bootstrap checks failed
Jan 26 17:57:19 vcontroller systemd-entrypoint[9586]: [1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.see... configuredJan 26 17:57:19 vcontroller systemd-entrypoint[9586]: ERROR: Elasticsearch did not exit normally - check the logs at /var/log/elasticsearch/elasticsearch.logJan 26 17:57:20 vcontroller systemd[1]: elasticsearch.service: main process exited, code=exited, status=78/n/a
Jan 26 17:57:20 vcontroller systemd[1]: Failed to start Elasticsearch.
Jan 26 17:57:20 vcontroller systemd[1]: Unit elasticsearch.service entered failed state.
Jan 26 17:57:20 vcontroller systemd[1]: elasticsearch.service failed.Hint: Some lines were ellipsized, use -l to show in full.
[root@vcontroller ~]# systemctl start elasticsearch
Job for elasticsearch.service failed because the control process exited with error code. See "systemctl status elasticsearch.service" and "journalctl -xe" for details.
[root@vcontroller ~]# tail -f /var/log/elasticsearch/elasticsearch.log
[2021-01-26T17:59:30,249][INFO ][o.e.t.TransportService   ] [vcontroller] publish_address {172.18.46.90:9300}, bound_addresses {[::]:9300}
[2021-01-26T17:59:30,661][INFO ][o.e.b.BootstrapChecks    ] [vcontroller] bound or publishing to a non-loopback address, enforcing bootstrap checks
[2021-01-26T17:59:30,728][ERROR][o.e.b.Bootstrap          ] [vcontroller] node validation exception[1] bootstrap checks failed
[1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured[2021-01-26T17:59:30,732][INFO ][o.e.n.Node               ] [vcontroller] stopping ...
[2021-01-26T17:59:30,746][INFO ][o.e.n.Node               ] [vcontroller] stopped
[2021-01-26T17:59:30,747][INFO ][o.e.n.Node               ] [vcontroller] closing ...
[2021-01-26T17:59:30,767][INFO ][o.e.n.Node               ] [vcontroller] closed
[2021-01-26T17:59:30,769][INFO ][o.e.x.m.p.NativeController] [vcontroller] Native controller process has stopped - no new native processes can be started

解决此问题的链接:

https://blog.csdn.net/happyzxs/article/details/89156068

感谢此博主

解决上述问题的方式:

切换root用户

vi /etc/security/limits.conf

在倒数第二行

* soft nofile 65536

* hard nofile 65536

# End of file

vi /etc/sysctl.conf

添加

vm.max_map_count=655360

保存后执行

sysctl -p

需要说明的是可能不是90-nproc.conf  比如我的就是20-*开头,如果已经是4096则不用设置。

vi /etc/security/limits.d/90-nproc.conf

修改

*          soft    nproc     1024

*          soft    nproc     4096

修改

elasticsearch.yml

取消注释保留一个节点

cluster.initial_master_nodes: ["node-1"]

以下的操作暂时没用到

在 elasticsearch.yml中添加配置项:

bootstrap.system_call_filter为false:

bootstrap.memory_lock: false

bootstrap.system_call_filter: false

再次重启启动成功

安装插件: ik  pinyin

测试汉字分词:

[root@vcontroller limits.d]#curl -H 'Content-Type:application/json' -XGET 'http://localhost:9200/_analyze?pretty' -d '{"text":"顺子的技术博客"}'{"tokens" : [{"token" : "顺","start_offset" : 0,"end_offset" : 1,"type" : "<IDEOGRAPHIC>","position" : 0},{"token" : "子","start_offset" : 1,"end_offset" : 2,"type" : "<IDEOGRAPHIC>","position" : 1},{"token" : "的","start_offset" : 2,"end_offset" : 3,"type" : "<IDEOGRAPHIC>","position" : 2},{"token" : "技","start_offset" : 3,"end_offset" : 4,"type" : "<IDEOGRAPHIC>","position" : 3},{"token" : "术","start_offset" : 4,"end_offset" : 5,"type" : "<IDEOGRAPHIC>","position" : 4},{"token" : "博","start_offset" : 5,"end_offset" : 6,"type" : "<IDEOGRAPHIC>","position" : 5},{"token" : "客","start_offset" : 6,"end_offset" : 7,"type" : "<IDEOGRAPHIC>","position" : 6}]
}

中文分词插件地址:

https://github.com/medcl/elasticsearch-analysis-ik/releases

https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.10.2/elasticsearch-analysis-ik-7.10.2.zip

安装中文分词插件

[root@vcontroller ~]# /usr/share/elasticsearch/bin/elasticsearch-plugin install  https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.10.2/elasticsearch-analysis-ik-7.10.2.zip-> Installing https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.10.2/elasticsearch-analysis-ik-7.10.2.zip-> Downloading https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.10.2/elasticsearch-analysis-ik-7.10.2.zip[=================================================] 100%  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@     WARNING: plugin requires additional permissions     @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@* java.net.SocketPermission * connect,resolveSee http://docs.oracle.com/javase/8/docs/technotes/guides/security/permissions.htmlfor descriptions of what these permissions allow and the associated risks.Continue with installation? [y/N]y-> Installed analysis-ik[root@vcontroller ~]#

 

安装拼音分词插件

[root@vcontroller ~]# /usr/share/elasticsearch/bin/elasticsearch-plugin install https://hub.fastgit.org/medcl/elasticsearch-analysis-pinyin/releases/download/v7.10.2/elasticsearch-analysis-pinyin-7.10.2.zip-> Installing https://hub.fastgit.org/medcl/elasticsearch-analysis-pinyin/releases/download/v7.10.2/elasticsearch-analysis-pinyin-7.10.2.zip-> Downloading https://hub.fastgit.org/medcl/elasticsearch-analysis-pinyin/releases/download/v7.10.2/elasticsearch-analysis-pinyin-7.10.2.zip[=================================================] 100%  -> Installed analysis-pinyin[root@vcontroller ~]# curl http://localhost:9200/_cat/plugins
vcontroller analysis-ik     7.10.2
vcontroller analysis-pinyin 7.10.2

测试中文分词:

[root@vcontroller ~]# curl -H 'Content-Type:application/json' -XGET 'http://localhost:9200/_analyze?pretty=true'  -d '{"analyzer":"ik_smart", "text":"我的中国心"}'{"tokens" : [{"token" : "我","start_offset" : 0,"end_offset" : 1,"type" : "CN_CHAR","position" : 0},{"token" : "的","start_offset" : 1,"end_offset" : 2,"type" : "CN_CHAR","position" : 1},{"token" : "中国心","start_offset" : 2,"end_offset" : 5,"type" : "CN_WORD","position" : 2}]
}

 

测试拼音分词

[root@vcontroller ~]# curl -H 'Content-Type:application/json' -XGET 'http://localhost:9200/_analyze?pretty=true'  -d '{"analyzer":"pinyin", "text":"我的中国心"}'{"tokens" : [{"token" : "wo","start_offset" : 0,"end_offset" : 0,"type" : "word","position" : 0},{"token" : "wdzgx","start_offset" : 0,"end_offset" : 0,"type" : "word","position" : 0},{"token" : "de","start_offset" : 0,"end_offset" : 0,"type" : "word","position" : 1},{"token" : "zhong","start_offset" : 0,"end_offset" : 0,"type" : "word","position" : 2},{"token" : "guo","start_offset" : 0,"end_offset" : 0,"type" : "word","position" : 3},{"token" : "xin","start_offset" : 0,"end_offset" : 0,"type" : "word","position" : 4}]
}

打开防火墙 端口

[root@vcontroller ~]# sudo firewall-cmd --zone=public --add-port=9200/tcp --permanent
success
[root@vcontroller ~]# firewall-cmd --reload
success

这篇关于elasticsearch (一): Centos7 RPM 方式安装最新单机版elasticsearch版本7.10.2 并配置中文(ik)、拼音(pinyin)插件的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/485069

相关文章

基于MySQL Binlog的Elasticsearch数据同步实践

一、为什么要做 随着马蜂窝的逐渐发展,我们的业务数据越来越多,单纯使用 MySQL 已经不能满足我们的数据查询需求,例如对于商品、订单等数据的多维度检索。 使用 Elasticsearch 存储业务数据可以很好的解决我们业务中的搜索需求。而数据进行异构存储后,随之而来的就是数据同步的问题。 二、现有方法及问题 对于数据同步,我们目前的解决方案是建立数据中间表。把需要检索的业务数据,统一放到一张M

Zookeeper安装和配置说明

一、Zookeeper的搭建方式 Zookeeper安装方式有三种,单机模式和集群模式以及伪集群模式。 ■ 单机模式:Zookeeper只运行在一台服务器上,适合测试环境; ■ 伪集群模式:就是在一台物理机上运行多个Zookeeper 实例; ■ 集群模式:Zookeeper运行于一个集群上,适合生产环境,这个计算机集群被称为一个“集合体”(ensemble) Zookeeper通过复制来实现

CentOS7安装配置mysql5.7 tar免安装版

一、CentOS7.4系统自带mariadb # 查看系统自带的Mariadb[root@localhost~]# rpm -qa|grep mariadbmariadb-libs-5.5.44-2.el7.centos.x86_64# 卸载系统自带的Mariadb[root@localhost ~]# rpm -e --nodeps mariadb-libs-5.5.44-2.el7

Centos7安装Mongodb4

1、下载源码包 curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.2.1.tgz 2、解压 放到 /usr/local/ 目录下 tar -zxvf mongodb-linux-x86_64-rhel70-4.2.1.tgzmv mongodb-linux-x86_64-rhel70-4.2.1/

中文分词jieba库的使用与实景应用(一)

知识星球:https://articles.zsxq.com/id_fxvgc803qmr2.html 目录 一.定义: 精确模式(默认模式): 全模式: 搜索引擎模式: paddle 模式(基于深度学习的分词模式): 二 自定义词典 三.文本解析   调整词出现的频率 四. 关键词提取 A. 基于TF-IDF算法的关键词提取 B. 基于TextRank算法的关键词提取

hadoop开启回收站配置

开启回收站功能,可以将删除的文件在不超时的情况下,恢复原数据,起到防止误删除、备份等作用。 开启回收站功能参数说明 (1)默认值fs.trash.interval = 0,0表示禁用回收站;其他值表示设置文件的存活时间。 (2)默认值fs.trash.checkpoint.interval = 0,检查回收站的间隔时间。如果该值为0,则该值设置和fs.trash.interval的参数值相等。

NameNode内存生产配置

Hadoop2.x 系列,配置 NameNode 内存 NameNode 内存默认 2000m ,如果服务器内存 4G , NameNode 内存可以配置 3g 。在 hadoop-env.sh 文件中配置如下。 HADOOP_NAMENODE_OPTS=-Xmx3072m Hadoop3.x 系列,配置 Nam

wolfSSL参数设置或配置项解释

1. wolfCrypt Only 解释:wolfCrypt是一个开源的、轻量级的、可移植的加密库,支持多种加密算法和协议。选择“wolfCrypt Only”意味着系统或应用将仅使用wolfCrypt库进行加密操作,而不依赖其他加密库。 2. DTLS Support 解释:DTLS(Datagram Transport Layer Security)是一种基于UDP的安全协议,提供类似于

Andrej Karpathy最新采访:认知核心模型10亿参数就够了,AI会打破教育不公的僵局

夕小瑶科技说 原创  作者 | 海野 AI圈子的红人,AI大神Andrej Karpathy,曾是OpenAI联合创始人之一,特斯拉AI总监。上一次的动态是官宣创办一家名为 Eureka Labs 的人工智能+教育公司 ,宣布将长期致力于AI原生教育。 近日,Andrej Karpathy接受了No Priors(投资博客)的采访,与硅谷知名投资人 Sara Guo 和 Elad G

Centos7安装JDK1.8保姆版

工欲善其事,必先利其器。这句话同样适用于学习Java编程。在开始Java的学习旅程之前,我们必须首先配置好适合的开发环境。 通过事先准备好这些工具和配置,我们可以避免在学习过程中遇到因环境问题导致的代码异常或错误。一个稳定、高效的开发环境能够让我们更加专注于代码的学习和编写,提升学习效率,减少不必要的困扰和挫折感。因此,在学习Java之初,投入一些时间和精力来配置好开发环境是非常值得的。这将为我