ElasticSearch 的安装以及设置ElasticSearch外网访问以及过程中遇到的问题

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

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

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

adduser normaluser
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下添加一下内容

bootstrap.memory_lock: false
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

 

 

  • 3
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值