ElasticSearch常见启动异常及解决方案

/ 前言 /

       记录一下我在启动ElasticSearch时遇见的一些异常及解决方案
       感兴趣的朋友可以看一下搭建我的另一篇博文ElasticSearch集群搭建图文解析

/ 异常 /

  • 不能使用root账户启动
    org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
            at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-7.4.2.jar:7.4.2]
            at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.4.2.jar:7.4.2]
            at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.4.2.jar:7.4.2]
            at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:125) ~[elasticsearch-cli-7.4.2.jar:7.4.2]
            at org.elasticsearch.cli.Comman
    

    这是因为ElasticSearch5.x版本更新的安全相关内容, 会导致我们无法以root账户启动, 你需要新建一个用户, 并将ElasticSearch安装目录的权限赋予该用户, 然后用新用户启动即可

  • max file descriptors [4096] for elasticsearch process is too low

    每个进程可打开文件数量太小
    修改/etc/security/limits.conf配置文件

    # 这里的es就是你为ElasticSearch新建的用户, 也可使用*代替
    es        hard  nofile   65536
    es        soft  nofile   65536
    
  • max number of threads [3795] for user [es] is too low

    最大线程数太小
    修改/etc/security/limits.conf配置文件

    # 这里的es就是你为ElasticSearch新建的用户, 也可使用*代替
    es        hard  nproc    4096
    es        soft  nproc    4096
    
  • max virtual memory areas vm.max_map_count [65530] is too low

    ElasticSearch运行的虚拟内存区域太小
    修改/etc/sysctl.conf配置文件并设置数据

    vm.max_map_count = 262144
    

    修改完后执行sysctl -p命令

  • OpenJDK 64-Bit Server VM warning: INFO: error=‘Not enough space’ (errno=12)

    这是因为ElasticSearch内嵌的JVM启动参数堆内存太小
    修改ElasticSearch部署目录下/config/jvm.options配置文件

    ## JVM configuration
    
    ################################################################
    ## IMPORTANT: JVM heap size
    ################################################################
    ##
    ## You should always set the min and max JVM heap
    ## size to the same value. For example, to set
    ## the heap to 4 GB, set:
    ##
    ## -Xms4g
    ## -Xmx4g
    -Xms1g
    -Xmx1g
    
  • with the same id but is a different node instance

    在搭建ElasticSearch进群时, 如果直接将已部署好的ElasticSearch文件直接复制到其它主机就会触发这个问题
    删除ElasticSearch部署文件下/data文件

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值