启动Elasticsearh中遇到的各种错误

使用elsearch启动ES后 又会遇到以下问题

技术分享

ERROR: bootstrap checks failed
max file descriptors [10240] for elasticsearch process likely too low, increase to at least [65536]
max number of threads [1024] for user [elsearch] likely too low, increase to at least [2048]
max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
[2016-11-14T10:22:17,569][INFO ][o.e.n.Node               ] [mysteel-node1] stopping ...
[2016-11-14T10:22:17,615][INFO ][o.e.n.Node               ] [mysteel-node1] stopped
[2016-11-14T10:22:17,615][INFO ][o.e.n.Node               ] [mysteel-node1] closing ...
[2016-11-14T10:22:17,638][INFO ][o.e.n.Node               ] [mysteel-node1] closed

解决方法参考 :http://www.cnblogs.com/sloveling/p/elasticsearch.html

切换到root用户

vi /etc/security/limits.conf

添加如下内容:

* soft nofile 65536
  • hard nofile 131072

  • soft nproc 2048

  • hard nproc 4096


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

修改如下内容:

* soft nproc 1024

#修改为

* soft nproc 2048

 

vi /etc/sysctl.conf 

添加下面配置:

vm.max_map_count=655360

并执行命令:

sysctl -p

然后,重新启动elasticsearch,即可启动成功。

技术分享

Elasticsearch5.0 安装问题集锦

标签:limit   安全   execute   roc   cau   sha   nproc   root   for   

原文:http://www.cnblogs.com/woxpp/p/6061073.html

在配置.Elasticsearch时报这个错误,在网上查了下,发现是用户权限不是root的原因

Exception in thread "main" java.nio.file.AccessDeniedException: /root/home/searchengine/elasticsearch-6.2.4/config/jvm.options
    at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
    at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
    at java.nio.file.Files.newByteChannel(Files.java:361)
    at java.nio.file.Files.newByteChannel(Files.java:407)
    at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
    at java.nio.file.Files.newInputStream(Files.java:152)
    at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:58)

错误原因:使用非 root用户启动ES,而该用户的文件权限不足而被拒绝执行。

2:

使用root账号启动es后 会遇到以下问题

技术分享

[2016-11-14T10:05:29,358][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread 
[main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:116) ~[elasticsearch- 
5.0.0.jar:5.0.0]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:103) ~[elasticsearch- 
5.0.0.jar:5.0.0]
at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54) ~[elasticsearch- 
5.0.0.jar:5.0.0]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:96) ~[elasticsearch- 
5.0.0.jar:5.0.0]
at org.elasticsearch.cli.Command.main(Command.java:62) ~[elasticsearch-5.0.0.jar:5.0.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) ~[elasticsearch- 
5.0.0.jar:5.0.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:73) ~[elasticsearch- 
5.0.0.jar:5.0.0] 

解决方法: chown -R 用户名:用户名  文件(目录)名

这里注意事项使用root用户进行修改。

例如: chown -R abc:abc searchengine
或chown ABC:ABC . -R 再使用这个用户登录

创建用户方法:
创建一个单独的用户用来运行ElasticSearch

  • 创建elsearch用户组及elsearch用户

  • groupadd elsearch
    useradd elsearch -g elsearch -p elasticsearch
    然后输入命令:
    ./elasticsearch
    

    发现报错了,启动失败:

    1.3.1.错误1:内核过低

    在这里插入图片描述
    我们使用的是centos6,其linux内核版本为2.6。而Elasticsearch的插件要求至少3.5以上版本。不过没关系,我们禁用这个插件即可。

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

    bootstrap.system_call_filter: false
    

    然后重启

    1.3.2.错误2:文件权限不足

    再次启动,又出错了:
    在这里插入图片描述
    [1]: max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]

    
    我们用的是leyou用户,而不是root,所以文件权限不足。
    
    **首先用root用户登录。**
    
    然后修改配置文件:
    
    

    vim /etc/security/limits.conf

    
    添加下面的内容:
    
    
    • soft nofile 65536

    • hard nofile 131072

    • soft nproc 4096

    • hard nproc 4096

    
    
    
    ### 1.3.3.错误3:线程数不够
    刚才报错中,还有一行:
    [1]: max number of threads [1024] for user [leyou] is too low, increase to at least [4096]
    这是线程数不够。
    继续修改配置:
    vim /etc/security/limits.d/90-nproc.conf 
    修改下面的内容:
    * soft nproc 1024
    改为:
    * soft nproc 4096
    
    ### 1.3.4.错误4:进程虚拟内存
    [3]: max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
    

    vm.max_map_count:限制一个进程可以拥有的VMA(虚拟内存区域)的数量,继续修改配置文件, :
    vim /etc/sysctl.conf
    添加下面内容:
    vm.max_map_count=655360
    然后执行命令:
    sysctl -p

    1.3.5.重启终端窗口

    所有错误修改完毕,一定要重启你的 Xshell终端,否则配置无效。
    在这里插入图片描述
    打开浏览器进行测试192.168.60.130:9200
    在这里插入图片描述
    即Elasticsearch启动成功

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值