elasticsearch安装

1.国内下载地址:https://thans.cn/mirror/elasticsearch.html

2.下载后解压

elasticsearch安装

3.elasticsearch默认安装后设置的内存是1GB,如果内存不足可以修改为256M

vi config/jvm.options

elasticsearch安装

4.elasticsearch不允许使用root账户启动,新建用户xiaoniu

elasticsearch安装

登录xiaoniu账户,执行bin下的elasticsearch启动

elasticsearch安装

后台运行的命令是在后面加-d

./bin/elasticsearch -d

5.配置外网可访问,修改config/elasticsearch.yml

vim config/elasticsearch.yml

elasticsearch安装

启动可能出现的问题及解决方法

6.ERROR: [5] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2]: max number of threads [1024] for user [es] 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]
[4]:  failed to install; check the logs and fix your configuration or disable system call filters at your own risk
[5]: 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
[2019-04-09T09:51:29,228][INFO ][o.e.n.Node               ] [localhost.localdomain] stopping ...
[2019-04-09T09:51:29,264][INFO ][o.e.n.Node               ] [localhost.localdomain] stopped
[2019-04-09T09:51:29,265][INFO ][o.e.n.Node               ] [localhost.localdomain] closing ...
[2019-04-09T09:51:29,320][INFO ][o.e.n.Node               ] [localhost.localdomain] closed
[2019-04-09T09:51:29,323][INFO ][o.e.x.m.p.NativeController] [localhost.localdomain] Native controller process has stopped - no new native processes can be started
解决办法:

vi /etc/security/limits.conf 

添加内容

* soft nofile 65536
* hard nofile 65536

elasticsearch安装

7.[1]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
[2]: 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

vim /etc/sysctl.conf 

elasticsearch安装

vm.max_map_count=262144

在 elasticsearch.yml中添加配置项:bootstrap.system_call_filter为false:

bootstrap.memory_lock: false
bootstrap.system_call_filter: false

重启ES