当前位置:   article > 正文

ElasticSearch 的安装以及设置ElasticSearch外网访问以及过程中遇到的问题_elasticsearch.yml配置外界可访问

elasticsearch.yml配置外界可访问

一  ElasticSearch需要安装在普通用户下,安装在root用户下会报如下错误

Caused by: java.lang.RuntimeException: can not run elasticsearch as root

1.创建普通用户并设置密码

  1. adduser normaluser
  2. passwd normaluser

 如下密码设置成功

 2.进入normaluser用户中

su normaluser

 3.进入elasticsearch下载页面,进行对应平台下载es,271M,网速慢的需要耐心等待

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.3.0-linux-x86_64.tar.gz

4.解压安装包

tar -zxvf elasticsearch-7.3.0-linux-x86_64.tar.gz

 5.进入到bin目录下

cd elasticsearch-7.3.0/bin/

6.启动

./elasticsearch

出现以下报错信息 

error:
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c5330000, 986513408, 0) failed; error='Not enough space' (errno=12)

报错原因:说明内存空间不够,需要将占用内存空间改小一点

vi ../config/jvm.options

 原先1G改为现在的400M即可

 

 重新启动,启动成功

7.验证是否启动成功

curl 127.0.0.1:9200

出现以下,代表启动成功

8.守护进程启动

./elasticsearch -d

二 设置elasticsearch可以外网访问

1.elasticsearch默认端口9200,需要开启服务器端口可以外网访问

2. 修改配置文件,将ip改为0.0.0.0,如果需要特定ip可以访问,可以设定为固定的ip

vi ../config/elasticsearch.yml

3.启动elasticsearch,发现无法启动会出现报错信息

报错信息

ERROR: [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

原因没有发现host  需要至少保留一个,取消注释,保留host1

vi ../config/elasticsearch.yml

 

4.重新启动后在vindows本地通过外网ip:9200打开是否可以访问

如下启动成功

 

三 ElasticSearch设置外网启动的其他错误信息汇总

1.system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

原因 因为Centos6不支持SecComp,而ES5.2.1默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动

解决方案:

vi ../config/elasticsearch.yml

 在Memory下添加一下内容

  1. bootstrap.memory_lock: false
  2. bootstrap.system_call_filter: false

 

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

原因:虚拟内存不够

解决方案,从65530增加到655360

退出普通用户,切换到root用户,打开配置文件进行修改

vim /etc/sysctl.conf

 

3.

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

问题2:max number of threads [1024] for user [lishang] likely too low, increase to at least [2048]

在root用户下修改配置文件

vim /etc/security/limits.conf

 在文件末尾进行文件配置

4.max number of threads [1024] for user [lish] likely too low, increase to at least [2048]

修改配置文件

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

 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/501801
推荐阅读
相关标签
  

闽ICP备14008679号