0

我已按照本指南使用 gem 在 rspec 中运行集成测试elasticsearch-extensions,但在我运行Elasticsearch::Extensions::Test::Cluster.start(port: 9250, nodes: 1, timeout: 120)时,会引发以下错误:

Starting 2 Elasticsearch nodes...Exception in thread "main" ElasticsearchException[Failed to load logging configuration]; nested: NoSuchFileException[/usr/share/elasticsearch/config];
Likely root cause: java.nio.file.NoSuchFileException: /usr/share/elasticsearch/config
        at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
        at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
        at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:144)
        at sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99)
        at java.nio.file.Files.readAttributes(Files.java:1737)
        at java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:225)
        at java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276)
        at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:322)
        at java.nio.file.Files.walkFileTree(Files.java:2662)
        at org.elasticsearch.common.logging.log4j.LogConfigurator.resolveConfig(LogConfigurator.java:142)
        at org.elasticsearch.common.logging.log4j.LogConfigurator.configure(LogConfigurator.java:103)
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:259)
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.
Exception in thread "main" ElasticsearchException[Failed to load logging configuration]; nested: NoSuchFileException[/usr/share/elasticsearch/config];
Likely root cause: java.nio.file.NoSuchFileException: /usr/share/elasticsearch/config
        at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
        at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
        at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:144)
        at sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99)
        at java.nio.file.Files.readAttributes(Files.java:1737)
        at java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:225)
        at java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276)
        at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:322)
        at java.nio.file.Files.walkFileTree(Files.java:2662)
        at org.elasticsearch.common.logging.log4j.LogConfigurator.resolveConfig(LogConfigurator.java:142)
        at org.elasticsearch.common.logging.log4j.LogConfigurator.configure(LogConfigurator.java:103)
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:259)
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.

我猜是因为我在我的 Ubuntu 机器上安装了 ES,它将配置文件添加到其中/etc/elasticsearch/并且已经作为服务运行。我试图对文件夹进行符号链接,但文件夹权限是:

drwxr-x---  3 root elasticsearch 4,0K nov  8 17:32 elasticsearch

所以我试图将我的用户添加到elasticsearch组中,但我没有运气。有任何想法吗?

4

1 回答 1

0

我刚刚完成了文件的复制并更改了所有者:

sudo cp -r /etc/elasticsearch/ /usr/share/elasticsearch/config
sudo chown $(whoami):$(whoami) /usr/share/elasticsearch/config/*

也许不是最好的解决方案,但有效。

于 2016-11-14T14:16:41.833 回答