美文网首页
elasticsearch6.3.*(错误解决)

elasticsearch6.3.*(错误解决)

作者: 五岁小孩 | 来源:发表于2021-02-28 11:18 被阅读0次

elasticsearch6.3.*(错误解决)

error-01

  • 问题

    ==原因==:es5以后安全级别提高,root用户无法启动elasticsearch,

    [root@localhost bin]# ./elasticsearch
    [2020-04-06T05:47:15,604][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:140) ~[elasticsearch-6.3.0.jar:6.3.0]
            at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) ~[elasticsearch-6.3.0.jar:6.3.0]
            at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.3.0.jar:6.3.0]
            at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.3.0.jar:6.3.0]
            at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.3.0.jar:6.3.0]
            at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.3.0.jar:6.3.0]
            at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) ~[elasticsearch-6.3.0.jar:6.3.0]
    ....................
    
    Exception in thread "main" java.nio.file.AccessDeniedException: /home/soft/elasticsearch-6.3.0/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)
    

==解决==:切换新用户,且该用户原因es的启动目录

添加用户 #设置密码 #授权

adduser [用户名] passwd [用户名] chown -R esuser:esuser elasticsearch-6.3.0

error-02

  • 问题

    ==原因==:elasticsearch.yml文件中的key/value值写错了,

    ​ 请重新检查或者 将其他可以正常启动的机器中的文件发送到报错机器,重新配置---除非迫不得已

    ==解决==:本文主要是日志目录的配置出现问题

    ​ path.logs:/home/soft/esdata/logs

    ​ path.logs: /home/soft/esdata/logs

    ​ key/value之间需要空格隔开

    [esuser@localhost bin]$ ./elasticsearch
    Exception in thread "main" 2020-04-06 06:49:25,402 main ERROR No log4j2 configuration file found. Using default configuration: logging only errors to the console. Set system property 'log4j2.debug' to show Log4j2 internal initialization logging.
    SettingsException[Failed to load settings from [elasticsearch.yml]]; nested: ParsingException[Failed to parse object: expecting token of type [START_OBJECT] but found [VALUE_STRING]];
            at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:1192)
            at org.elasticsearch.common.settings.Settings$Builder.loadFromPath(Settings.java:1165)
            at org.elasticsearch.node.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:100)
            at org.elasticsearch.cli.EnvironmentAwareCommand.createEnv(EnvironmentAwareCommand.java:95)
            at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
            at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
            at org.elasticsearch.cli.Command.main(Command.java:90)
            at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93)
            at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86)
    Caused by: ParsingException[Failed to parse object: expecting token of type [START_OBJECT] but found [VALUE_STRING]]
            at org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken(XContentParserUtils.java:78)
            at org.elasticsearch.common.settings.Settings.fromXContent(Settings.java:672)
            at org.elasticsearch.common.settings.Settings.access$500(Settings.java:84)
            at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:1188)
            ... 8 more
    
  • error-03

    ==问题==:ERROR: [2] bootstrap checks failed
    [1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

    这是由于每个进程最大同时打开文件数太小,需重新配置

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

    elasticsearch用户拥有的内存权限太小,至少需要262144;

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

    #解决[1]
    #需在root用户下操作
    [root@localhost bin]# vi /etc/security/limits.conf (文件后添加以下配置 esuser替换为你的es用户)
    esuser hard nofile 65536
    esuser soft nofile 65536
    esuser soft memlock unlimited
    esuser hard memlock unlimited
    
    #解决[2]
    [root@localhost bin]# vi /etc/sysctl.conf (文件后添加以下配置)
    vm.max_map_count=262144
    [root@localhost bin]# sysctl -p
    vm.max_map_count = 262144
    

相关文章

网友评论

      本文标题:elasticsearch6.3.*(错误解决)

      本文链接:https://www.haomeiwen.com/subject/xgihrktx.html