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/* 

也許不是最好的解決辦法,但有效。