Elasticsearch 5.4.3 安装

  • Elasticsearch版本确定

        Elasticsearch会使用ik中文分词,ansj中文分词,拼音分词。这样需要查看这些插件版本支持情况。

            ik分词版本支持情况:https://github.com/medcl/elasticsearch-analysis-ik

            拼音分词版本支付情况:https://github.com/medcl/elasticsearch-analysis-pinyin

            ansj分词版本支持情况:https://github.com/NLPchina/elasticsearch-analysis-ansj

        ik分词器,很久未更新了,后期考虑会使用到ansj。ansj支持到最新版本为5.4.3,最后确定Elasticsearch版本为5.4.3

  • 安装Elasticsearch

        安装命令:

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.4.3.tar.gz
tar -xzf elasticsearch-5.4.3.tar.gz
cd elasticsearch-5.4.3
  • 运行Elasticsearch
bin/elasticsearch
##后台运行
bin/elasticsearch -d

 

  • 启动中遇到的问题
        问题一 外网访问Elasticsearch 9200 9300服务

可以访问curl 'http://localhost:9200/?pretty',但是不能访问curl 'http://{外网ip}:9200/?pretty'

切换到root用户,修改配置文件elasticsearch.yml。

vi ${es_home}/elasticsearch-5.4.3/config/elasticsearch.yml

修改如下参数。

 ## 默认注释状态,打开注释状态,前面保持一个空格
 network.host: 0.0.0.0

 

        问题二 root启动报错

用root账号启动,会报以下错误

Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root. ...

创建elsearch用户组及elsearch用户

groupadd elsearch
useradd elsearch -g elsearch -p elasticsearch

更改elasticsearch-5.4.3文件夹及内部文件的所属用户及组为elsearch:elsearch

chown -R elsearch:elsearch  elasticsearch-5.4.3

切换到elsearch用户再启动

su elsearch 
cd elasticsearch-5.4.3/bin
./elasticsearch

 

        问题三 ERROR: bootstrap checks failed

报错信息如下:

max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
max number of threads [1024] for user [lishang] likely too low, increase to at least [2048]

切换到root用户,修改配置文件limits.conf 

vi /etc/security/limits.conf 

添加类似如下内容[如果参数存在则修改]

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

 

        问题四 线程数设置

报错信息如下:

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

切换到root用户,修改配置文件limits.d。

vi /etc/security/limits.d/90-nproc.conf 

修改如下内容:

* soft nproc 2048

 

        问题五 max_map_count参数错误

报错信息如下:

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

切换到root用户,修改配置文件limits.d。

vi /etc/sysctl.conf 

添加下面配置:

vm.max_map_count=655360

执行命令:

sysctl -p

 

        问题六 bootstrap checks failed

报错信息如下:

ERROR: bootstrap checks failed
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.0默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。

切换到root用户,修改配置文件elasticsearch.yml。

vi ${es_home}/elasticsearch-5.4.3/config/elasticsearch.yml

修改如下参数[没有则添加]

## system_call_filter在memory_lock下面
bootstrap.memory_lock: false
bootstrap.system_call_filter: false

 

转载于:https://my.oschina.net/panswforlldx/blog/1492694

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值