2016-11-08 135 views
0

我已经按照this guide在与elasticsearch-extensions宝石RSpec的运行集成测试使用RSpec和elasticsearch的扩展测试,但在我运行Elasticsearch::Extensions::Test::Cluster.start(port: 9250, nodes: 1, timeout: 120)的那一刻,下面的错误被抛出:无法在Ubuntu

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组,但我没有运气。有任何想法吗?

回答

0

我刚刚完成复制文件和所有者更改:

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

也许不是最好的解决办法,但有效。