ElasticsearchException未能绑定服务错误

时间:2019-03-21 11:32:25

标签: elasticsearch

我真的想开始对opencart进行Elasticsearch。 我已经设置了network.host:0.0.0.0(也尝试使用我的本地IP),http.port:9200,并将执行权限授予了我的新帐户。我使用centOs6,Java 1.8,并且不使用root帐户。 我想在服务器上使用elasticsearch,但是我遇到了一些问题。

我的错误日志是

[2019-03-21T18:12:27,970][INFO ][o.e.p.PluginsService     ] [gxhuK_x] loaded module [x-pack-watcher]
[2019-03-21T18:12:27,971][INFO ][o.e.p.PluginsService     ] [gxhuK_x] no plugins loaded
[2019-03-21T18:12:32,061][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [gxhuK_x] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: ElasticsearchException[failed to bind service]; nested: AccessDeniedException[/etc/system-release];
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.6.2.jar:6.6.2]
        at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.6.2.jar:6.6.2]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.6.2.jar:6.6.2]
Caused by: org.elasticsearch.ElasticsearchException: failed to bind service
        at org.elasticsearch.node.Node.<init>(Node.java:626) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.node.Node.<init>(Node.java:265) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:212) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:212) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-6.6.2.jar:6.6.2]
        ... 6 more
Caused by: java.nio.file.AccessDeniedException: /etc/system-release
        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) ~[?:1.8.0_131]
        at java.nio.file.Files.newByteChannel(Files.java:407) ~[?:1.8.0_131]
        at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384) ~[?:1.8.0_131]
        at java.nio.file.Files.newInputStream(Files.java:152) ~[?:1.8.0_131]
        at java.nio.file.Files.newBufferedReader(Files.java:2784) ~[?:1.8.0_131]
        at java.nio.file.Files.readAllLines(Files.java:3202) ~[?:1.8.0_131]
        at java.nio.file.Files.readAllLines(Files.java:3242) ~[?:1.8.0_131]
        at org.elasticsearch.monitor.os.OsProbe.readOsRelease(OsProbe.java:591) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.monitor.os.OsProbe.getPrettyName(OsProbe.java:546) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.monitor.os.OsProbe.osInfo(OsProbe.java:533) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.monitor.os.OsService.<init>(OsService.java:48) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.monitor.MonitorService.<init>(MonitorService.java:47) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.node.Node.<init>(Node.java:397) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.node.Node.<init>(Node.java:265) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:212) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:212) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-6.6.2.jar:6.6.2]
        ... 6 more

我已经由tar.gz安装。 我更改了config / elasticsearch.yml 我什么都没改变 有人知道这个错误吗?请帮助我。

# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /var/data/elasticsearch
#
# Path to log files:
#
path.logs: /var/logs/elasticsearch
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 0.0.0.0
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#
bootstrap.system_call_filter: false

3 个答案:

答案 0 :(得分:1)

您需要确保主机上的目录归1000:1000所有。运行以下命令。

sudo chown 1000:1000 <directory you wish to mount>

Source

答案 1 :(得分:1)

在我的变体中,麻烦在于数据目录的权限。数据目录不是默认目录,而是更改为/ elk-data /

为解决此问题,我进行了“ chmod -R elasticsearch:wheel / elk-data

答案 2 :(得分:0)

请检查以下内容:

  1. 您是否在文件系统中创建了/var/data/elasticsearch/var/logs/elasticsearch目录?
  2. 您是否已将以上目录设置为在您的用户权限下可写?

更新

在Github中阅读elasticsearch的源代码。 Link Here 代码尝试访问/etc/system-release时似乎出现了一些问题。您可能要看一下该文件。它还提到它是fallback for older Red Hat-like OS。因此,如果可能,您可能希望使用其他操作系统。