【运维笔记】Llinux 安装Elasticsearch6.5.1 单机版

今天在自己的Linux系统搭建了一套单机版的ElasticSearch,过程遇到很多坑,以此作为总结,以便日后快速部署:


版本信息及下载:

  • 1、Java版本:jdk1.8.0_191(必须是1.8以上)
    官网下载:点击链接进入>>安装教程<<
  • 2、ElasticSearch版本:6.5.1(以下简称ES或es)
    官网下载地址:https://www.elastic.co/downloads/elasticsearch (自行上传Linux系统)
    指定下载版本:https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.5.1.tar.gz (修改版本号即可)
    在这里插入图片描述

一、ES安装:

1、将下载好的tar包上传到服务器/opt/seesun2012目录下,执行如下命令(#号后面的才是可执行命令,下文雷同):

[root@localhost /]#             mkdir /opt/seesun2012        //  新建管理目录(打在//后面的是注释,不用复制)
[root@localhost /]#             cd /opt/seesun2012           //  进入seesun2012
[root@localhost seesun2012]#    rz                           // 上传ES安装文件

2、解压安装包及修改文件名称,命令如下:

[root@localhost seesun2012]#    tar  -zxvf elasticsearch-6.5.1.tar.gz    // 解压安装包
[root@localhost seesun2012]#    ll                                       // 查看目录文件
[root@localhost elastic]#       mv  elasticsearch-6.5.1  elastic         // 修改文件名

3、创建ES用户和组(因为ES不允许使用root用户执行),命令如下:

[root@localhost /]#    groupadd es                                       // 添加用户组,组名:es
[root@localhost /]#    useradd es -g es                                  // 添加用户,格式: 用户名 -g 组名
[root@localhost /]#    chown -R es:es  /opt/seesun2012/elastic           // 设置目录权限
[root@localhost /]#    passwd es                                         // 设置es用户登陆密码(提示过于简单继续确认)

4、修改ES配置文件,执行vi /opt/seesun2012/elastic/config/elasticsearch.yml命令,修改内容如下:

#network.host: 192.168.0.1
network.host: 192.168.2.71

5、启动ES文件,cd 进入到 /opt/seesun2012/elastic/ 目录执行如下命令:

[root@localhost seesun2012]#    ./bin/elasticsearch -d                   //  启动ES服务,-d 代表后台启动

6、查看ES动态日志(Linux面试必问):

[root@localhost elastic]#    tailf /opt/seesun2012/elastic/logs/elasticsearch.log

7、启动成功示例图(内网访问),失败解决方案在底部:
在这里插入图片描述

二、错误&解决方案:

1、max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
原因: 意思是说你的进程不够用了
解决方案: 切到root 用户:进入到security目录下的limits.conf;执行命令 vim /etc/security/limits.conf 在文件的末尾添加下面的参数值:

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

2、max number of threads [3803] for user [es] is too low, increase to at least [4096]
原因:意思就是说你的线程数不够用了
解决方案: 切到root 用户:执行命令 vi /etc/security/limits.d/20-nproc.conf 修改3803为4096:

*          soft    nproc     4096
root       soft    nproc     unlimited

如果还是失败(大多出现在 Centos7 以上),换下面这种:

* hard nproc 4096
* soft nproc 4096
elk soft nproc 4096
root soft nproc unlimited

3、max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
原因: 需要修改系统变量的最大值
解决方案:切换到 root 用户修改配置 /etc/sysctl.conf 增加配置值:vm.max_map_count=655360

执行命令 sysctl -p 这样就可以了,会显示如下信息

[root@localhost ~]#    sysctl -p
vm.max_map_count = 262144

4、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不能启动。详见 :https://github.com/elastic/elasticsearch/issues/22899

解决方法:在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:

bootstrap.memory_lock: false
bootstrap.system_call_filter: false


























注:以上内容仅提供参考和交流,请勿用于商业用途,如有侵权联系本人删除!


持续更新中…

如有对思路不清晰或有更好的解决思路,欢迎与本人交流,QQ群:273557553,个人微信:
你遇到的问题是小编创作灵感的来源!


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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值