gpt4 book ai didi

ubuntu - 重启elasticsearch失败

转载 作者:行者123 更新时间:2023-11-29 02:56:53 24 4
gpt4 key购买 nike

我在 ubuntu 版本 14.04 的虚拟机上安装了 elasticsearch 版本 2.3.3。我试图重新启动 elasticsearch 服务,但在重新启动后,我使用 sudo service elasticsearch status 检查了状态,它返回了 * elasticsearch is not running。当我尝试使用 sudo service elasticsearch start 启动它时,它返回 * Starting Elasticsearch Server 但检查状态时发现它没有运行。

我尝试通过输入 /usr/share/elasticsearch/bin/elasticsearch(这是二进制文件的路径)来手动启动它,但一开始我收到以下错误:

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:97)
at java.nio.file.Files.readAttributes(Files.java:1686)
at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:109)
at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:69)
at java.nio.file.Files.walkFileTree(Files.java:2602)
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:243)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.

错误告诉它无法找到日志记录配置,所以我遵循了 https://github.com/elastic/ansible-elasticsearch/issues/58 中的建议通过创建符号链接(symbolic link):sudo ln -s/etc/elasticsearch//usr/share/elasticsearch/config

之后,通过 /usr/share/elasticsearch/bin/elasticsearch 运行 Elasticsearch 时出现以下错误:

Exception in thread "main" ElasticsearchException[Failed to load logging configuration]; nested: AccessDeniedException[/usr/share/elasticsearch/config];
Likely root cause: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/config
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.newDirectoryStream(UnixFileSystemProvider.java:426)
at java.nio.file.Files.newDirectoryStream(Files.java:413)
at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:179)
at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:69)
at java.nio.file.Files.walkFileTree(Files.java:2602)
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:243)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.

当以 root (sudo/usr/share/elasticsearch/bin/elasticsearch) 身份尝试时,我收到以下错误:

Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root.
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:93)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:144)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:270)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.

这不是我第一次遇到这个问题。我在另一台虚拟机上遇到了完全相同的问题(第一个异常(exception) - 未找到日志记录配置)并尝试通过创建路径 /usr/share/elasticsearch/config 并复制配置文件来解决它(elasticsearch.yml 和 logging.yml)。之后我又遇到了第二个问题(以普通用户身份运行 - 访问被拒绝并且不允许以 root 身份运行)。

有人知道这个问题吗?我们将不胜感激!

最佳答案

就我而言,以下链接有帮助:

ln -s /etc/elasticsearch/ /usr/share/elasticsearch/config

关于ubuntu - 重启elasticsearch失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39268182/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com