最全ElasticSearch启动失败问题(附解决方案)

1.内核过低

unable to install syscall filter: requires kernel 3.5+ with CONFIG SECCOM

原因:因为我们使用的是centos6,其linux内核版本为2.6。而Elasticsearch的插件要求至少3.5以上版本。不过没关系,我们禁 用这个插件即可。

解决方法:

  • 修改elasticsearch.yml文件,在最下面添加如下配置
  • bootstrap.system_call_filter: false 

2.文件权限不足

原因:我们用的是es用户,而不是root,所以文件权限不足

解决方法:

方案1:

  • sudo chmod -R 777 /usr/local/elasticsearch(直接给足权限,路径替换成你自己es安装目录)

方案2:

  • 首先用root用户登录,然后修改配置文件:
  • vim /etc/security/limits.conf 
  • 添加下面的内容:

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

3.线程数不够

max number of threads [1024] for user [es] is too low, increase to at least [4096] 

解决方法:

  • vim /etc/security/limits.d/20-nproc.conf
  • 修改下面的内容:

  •  soft nproc 1024 改为 soft nproc 4096 
  • 执行 vim /etc/security/limits.conf,在文件最后添加:
  • * soft nproc 65535
    * hard nproc 65535

4.不能以root账户进行启动

can not run elasticsearch as root

原因:意思是不能使用root账户启动,我们可以创建普通用户来进行Es的启动,操作指令如下,可根据自己实际情况而定

解决方法:

  • 创建非root用户
[root@localhost ~]# useradd es
[root@localhost ~]# passwd es
Changing password for user es.
New password:    【Wahaha123】
Retype new password: 
[root@localhost ~]# chmod 777 /usr/local   【授予es用户/usr/local目录  可读可写可执行权限】
[root@localhost ~]# su es
[es@localhost ~]$ 

5.进程虚拟内存不足

max virtual memory areas vm.max map count [65530l is too low,increase to at least [262144]

通过设置 vm.max_map_count:限制一个进程可以拥有的VMA(虚拟内存区域)的数量

  • 使用root用户,修改配置文件, vim /etc/sysctl.conf 添加下面内容:

  • vm.max_map_count=655360 
  • 修改完成之后在终端执行

  • ##然后执行命令
    sysctl -p 

6.未设置节点

the default discovery settings are unsuitable for production use; at least one of [discovery.seed_ho...]

解决方法:
  • 修改elasticsearch.yml
  • cluster.name: my-application
    node.name: node-1
    cluster.initial_master_nodes: ["node-1"]