Elasticsearch是一个高度可伸缩的开源全文搜索和分析引擎。它允许您快速、实时地存储、搜索和分析大量数据。它通常用作底层引擎/技术,为具有复杂搜索特性和需求的应用程序提供动力。
JDK版本:必须1.8以上
yum install java-1.8.0-openjdk.x86_64
[root@VM_0_3_centos /]# mkdir software
ElasticSearch默认是不能使用root用户进行启动的,所以需要先添加一个用户,并使用用户身份安装ElasticSearch。
[root@VM_0_3_centos software]# adduser qianye
[root@VM_0_3_centos software]# passwd qianye
切换到创建的用户下
这里是使用wget下载Elasticsearch6.2.2安装包,也可以去Elaticsearch官网下载
[root@VM_0_3_centos /]# chown -R qianye:qianye software
[root@VM_0_3_centos /]# su qianye
[qianye@VM_0_3_centos /]$ cd software/
[qianye@VM_0_3_centos software]$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.2.tar.gz
[qianye@VM_0_3_centos software]$ tar -zxvf elasticsearch-6.2.2.tar.gz
解压后
[qianye@VM_0_3_centos software]$ ll
total 28408
drwxr-xr-x 8 qianye qianye 4096 Feb 17 2018 elasticsearch-6.2.2
-rw-rw-r-- 1 qianye qianye 29049540 May 15 2018 elasticsearch-6.2.2.tar.gz
[qianye@VM_0_3_centos software]$ cd elasticsearch-6.2.2/
[qianye@VM_0_3_centos elasticsearch-6.2.2]$ cd bin/
[qianye@VM_0_3_centos bin]$ ./elasticsearch
启动后,提示一下信息,则启动成功
[2019-07-17T16:58:08,178][INFO ][o.e.n.Node ] [SoRQUPp] starting ...
[2019-07-17T16:58:08,470][INFO ][o.e.t.TransportService ] [SoRQUPp] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}
[2019-07-17T16:58:08,495][WARN ][o.e.b.BootstrapChecks ] [SoRQUPp] max virtual memory areas vm.max_map_count [65530] is too low, increase to at le
ast [262144]
[2019-07-17T16:58:11,597][INFO ][o.e.c.s.MasterService ] [SoRQUPp] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {SoRQUPp}{So
RQUPpDQqqsqIAbrItF_Q}{d9xfGSLdRm2VFJxdlo1HIg}{127.0.0.1}{127.0.0.1:9300}
[2019-07-17T16:58:11,603][INFO ][o.e.c.s.ClusterApplierService] [SoRQUPp] new_master {SoRQUPp}{SoRQUPpDQqqsqIAbrItF_Q}{d9xfGSLdRm2VFJxdlo1HIg}{127.0.
0.1}{127.0.0.1:9300}, reason: apply cluster state (from master [master {SoRQUPp}{SoRQUPpDQqqsqIAbrItF_Q}{d9xfGSLdRm2VFJxdlo1HIg}{127.0.0.1}{127.0.0.1
:9300} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
[2019-07-17T16:58:11,631][INFO ][o.e.h.n.Netty4HttpServerTransport] [SoRQUPp] publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}
[2019-07-17T16:58:11,631][INFO ][o.e.n.Node ] [SoRQUPp] started
[2019-07-17T16:58:11,653][INFO ][o.e.g.GatewayService ] [SoRQUPp] recovered [0] indices into cluster_state
新开一个窗口,输入curl:localhost:9200
,出现一下信息,则说明启动成功。
在config/elasticsearch.yml添加如下内容:
network.host: 0.0.0.0
[qianye@VM_0_3_centos elasticsearch-6.2.2]$ nohup bin/elasticsearch &
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
问题:
最大虚拟内存区域vm.max_map_count[65530]太低,至少增加到[262144]
解决方法:
[root@localhost ~]# vim /etc/sysctl.conf
,添加一行配置vm.max_map_count=655360
执行:sysctl -p
使其生效
max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
问题:
用于elasticsearch进程的最大文件描述符[65535]过低,至少增加到[65536]
max number of threads [1024] for user [es] is too low, increase to at least [4096]
问题:
用户的最大线程数[1024]太低,至少增加到[4096]
对于第2个和第3个问题,可以通过编辑[root@localhost ~]# vi /etc/security/limits.conf
,添加如下内容:
* soft nofile 65536
* hard nofile 65536
* soft nproc 4096
* hard nproc 4096
solf是软限制的意思,hard是硬限制;软限制可以在程序的进程中自行改变(突破限制),而硬限制则不行(除非程序进程有root权限)
https://github.com/medcl/elasticsearch-analysis-ik/releases/tag/v6.2.2
将下载好的elasticsearch-analysis-ik-6.2.2分词器安装包,上传到elasticsearch-6.2.2
文件夹下的plugins
文件夹下
[qianye@VM_0_3_centos plugins]$ unzip elasticsearch-analysis-ik-6.2.2.zip
[qianye@VM_0_3_centos plugins]$ mv elasticsearch elasticsearch-ik
[qianye@VM_0_3_centos plugins]$ rm -rf elasticsearch-analysis-ik-6.2.2.zip
出现如下信息,则表示ik成功加入