ElasticSearch的完整安装教程

时间:2021-05-20

ElasticSearch安装

下载ElasticSearch

官网地址:

https://mon][2018-08-30T11:29:31,352][INFO ][o.e.p.PluginsService ] [cRjfMu5] loaded module [lang-expression][2018-08-30T11:29:31,352][INFO ][o.e.p.PluginsService ] [cRjfMu5] loaded module [lang-mustache][2018-08-30T11:29:31,353][INFO ][o.e.p.PluginsService ] [cRjfMu5] loaded module [lang-painless][2018-08-30T11:29:31,353][INFO ][o.e.p.PluginsService ] [cRjfMu5] loaded module [mapper-extras][2018-08-30T11:29:31,354][INFO ][o.e.p.PluginsService ] [cRjfMu5] loaded module [parent-join][2018-08-30T11:29:31,354][INFO ][o.e.p.PluginsService ] [cRjfMu5] loaded module [percolator][2018-08-30T11:29:31,354][INFO ][o.e.p.PluginsService ] [cRjfMu5] loaded module [rank-eval][2018-08-30T11:29:31,355][INFO ][o.e.p.PluginsService ] [cRjfMu5] loaded module [reindex][2018-08-30T11:29:31,355][INFO ][o.e.p.PluginsService ] [cRjfMu5] loaded module [repository-url][2018-08-30T11:29:31,356][INFO ][o.e.p.PluginsService ] [cRjfMu5] loaded module [transport-netty4][2018-08-30T11:29:31,356][INFO ][o.e.p.PluginsService ] [cRjfMu5] loaded module [tribe][2018-08-30T11:29:31,356][INFO ][o.e.p.PluginsService ] [cRjfMu5] loaded module [x-pack-core][2018-08-30T11:29:31,357][INFO ][o.e.p.PluginsService ] [cRjfMu5] loaded module [x-pack-deprecation][2018-08-30T11:29:31,357][INFO ][o.e.p.PluginsService ] [cRjfMu5] loaded module [x-pack-graph][2018-08-30T11:29:31,357][INFO ][o.e.p.PluginsService ] [cRjfMu5] loaded module [x-pack-logstash][2018-08-30T11:29:31,358][INFO ][o.e.p.PluginsService ] [cRjfMu5] loaded module [x-pack-ml][2018-08-30T11:29:31,358][INFO ][o.e.p.PluginsService ] [cRjfMu5] loaded module [x-pack-monitoring][2018-08-30T11:29:31,359][INFO ][o.e.p.PluginsService ] [cRjfMu5] loaded module [x-pack-rollup][2018-08-30T11:29:31,359][INFO ][o.e.p.PluginsService ] [cRjfMu5] loaded module [x-pack-security][2018-08-30T11:29:31,359][INFO ][o.e.p.PluginsService ] [cRjfMu5] loaded module [x-pack-sql][2018-08-30T11:29:31,370][INFO ][o.e.p.PluginsService ] [cRjfMu5] loaded module [x-pack-upgrade][2018-08-30T11:29:31,370][INFO ][o.e.p.PluginsService ] [cRjfMu5] loaded module [x-pack-watcher][2018-08-30T11:29:31,372][INFO ][o.e.p.PluginsService ] [cRjfMu5] no plugins loaded[2018-08-30T11:29:43,859][INFO ][o.e.x.s.a.s.FileRolesStore] [cRjfMu5] parsed [0] roles from file [/home/elasticsearch/elasticsearch-6.4.0/config/roles.yml][2018-08-30T11:29:45,757][INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [controller/1810] [Main.cc@109] controller (64 bit): Version 6.4.0 (Build cf8246175efff5) Copyright (c) 2018 Elasticsearch BV[2018-08-30T11:29:47,089][DEBUG][o.e.a.ActionModule ] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security[2018-08-30T11:29:47,915][INFO ][o.e.d.DiscoveryModule ] [cRjfMu5] using discovery type [zen][2018-08-30T11:29:50,345][INFO ][o.e.n.Node ] [cRjfMu5] initialized[2018-08-30T11:29:50,345][INFO ][o.e.n.Node ] [cRjfMu5] starting ...[2018-08-30T11:29:51,185][INFO ][o.e.t.TransportService ] [cRjfMu5] publish_address {192.168.145.129:9300}, bound_addresses {192.168.145.129:9300}[2018-08-30T11:29:51,351][INFO ][o.e.b.BootstrapChecks ] [cRjfMu5] bound or publishing to a non-loopback address, enforcing bootstrap checksERROR: [3] bootstrap checks failed[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536][2]: max number of threads [3802] for user [esyonghu] is too low, increase to at least [4096][3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144][2018-08-30T11:29:51,486][INFO ][o.e.n.Node ] [cRjfMu5] stopping ...[2018-08-30T11:29:51,570][INFO ][o.e.n.Node ] [cRjfMu5] stopped[2018-08-30T11:29:51,571][INFO ][o.e.n.Node ] [cRjfMu5] closing ...[2018-08-30T11:29:51,633][INFO ][o.e.n.Node ] [cRjfMu5] closed[2018-08-30T11:29:51,634][INFO ][o.e.x.m.j.p.NativeController] Native controller process has stopped - no new native processes can be started[esyonghu@localhost elasticsearch-6.4.0]$

修改错误,可以看到控制台打印的信息里面有3个错误

[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536][2]: max number of threads [3802] for user [esyonghu] is too low, increase to at least [4096][3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

第一个错误需要将当前用户的软硬调用限制调大

[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

切换到root用户,然后执行vim /etc/security/limits.conf

[root@localhost elasticsearch-6.4.0]# vim /etc/security/limits.conf

在文件末尾加上

esyonghu soft nofile 65536esyonghu hard nofile 131072esyonghu soft nproc 2048esyonghu hard nproc 4096

第二个错误需要修改/etc/security/limits.d/20-nproc.conf 文件

[2]: max number of threads [3802] for user [esyonghu] is too low, increase to at least [4096]

修改/etc/security/limits.d/20-nproc.conf 文件,这里需要注意一下,可能不叫20-nproc.conf 也可能是90-nproc.conf

vim /etc/security/limits.d/20-nproc.conf

在文件中添加

esyonghu soft nproc 4096

第三个错误需要修改/etc/sysctl.conf

[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

使用命令 vim /etc/sysctl.conf来编辑该文件,在文件中加入如下内容

加上vm.max_map_count=262144

需要使改文件生效,执行sysctl -p

[root@localhost etc]# sysctl -pvm.max_map_count = 262144

再次切换到esyonghu去elasticsearch文件目录启动elasticsearch

[root@localhost elasticsearch-6.4.0]# su esyonghu[esyonghu@localhost elasticsearch-6.4.0]$ [esyonghu@localhost elasticsearch-6.4.0]$ cd /home/elasticsearch/elasticsearch-6.4.0[esyonghu@localhost elasticsearch-6.4.0]$ ./bin/elasticsearch现在启动成功了,使用浏览器访问试一下

关闭防火墙

再次访问的时候发现还是不行,这时候需要关闭防火墙检查防火墙状态先切换到root用户[esyonghu@localhost elasticsearch-6.4.0]$ su root密码:[root@localhost elasticsearch-6.4.0]# 查看防火墙状态[root@localhost elasticsearch-6.4.0]# firewall-cmd --staterunning[root@localhost elasticsearch-6.4.0]# 状态是running,需要关闭防火墙执行systemctl stop firewalld.service[root@localhost elasticsearch-6.4.0]# systemctl stop firewalld.service再次检查防火墙状态,就是为运行了[root@localhost elasticsearch-6.4.0]# firewall-cmd --statenot running[root@localhost elasticsearch-6.4.0]#

切换到esyonghu再次启动

[root@localhost elasticsearch-6.4.0]# su esyonghu[esyonghu@localhost elasticsearch-6.4.0]$ [esyonghu@localhost elasticsearch-6.4.0]$ ./bin/elasticsearch[2018-08-30T12:09:59,267][INFO ][o.e.n.Node ] [] initializing ...启动成功,使用浏览器访问就可以了

以后台方式启动elasticsearch

./bin/elasticsearch -d[esyonghu@localhost elasticsearch-6.4.0]$ ./bin/elasticsearch -d[esyonghu@localhost elasticsearch-6.4.0]$

结束elastsearch

输入jps命令杀死elasticsearch进程

如果绑定本地ip失败,那么在elasticsearch.yml里面加上

bootstrap.memory_lock: falsebootstrap.system_call_filter: false

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对的支持。

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章