Exception in thread "main" java.nio.file.FileSystemException: /usr/share/elasticsearch/config/elasticsearch.yml.Dym72YkCRZ-GMAliqWE2IA.tmp -> /usr/share/elasticsearch/config/elasticsearch.yml: Device or resource busy
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
at java.base/sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:416)
at java.base/sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:266)
at java.base/java.nio.file.Files.move(Files.java:1432)
at org.elasticsearch.xpack.security.cli.AutoConfigureNode.fullyWriteFile(AutoConfigureNode.java:1127)
at org.elasticsearch.xpack.security.cli.AutoConfigureNode.fullyWriteFile(AutoConfigureNode.java:1139)
at org.elasticsearch.xpack.security.cli.AutoConfigureNode.execute(AutoConfigureNode.java:687)
at org.elasticsearch.server.cli.ServerCli.autoConfigureSecurity(ServerCli.java:161)
at org.elasticsearch.server.cli.ServerCli.execute(ServerCli.java:85)
at org.elasticsearch.common.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:54)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:85)
at org.elasticsearch.cli.Command.main(Command.java:50)
at org.elasticsearch.launcher.CliToolLauncher.main(CliToolLauncher.java:64)
原因:估计是配置文件的挂载有问题
我的解决方法:docker 启动时先不加配置文件的挂载,就能成功运行
1、地址栏无法访问9200端口
需要在容器内的elasticsearch.yml中加入
http.host: 0.0.0.0
2、上述方法配置后,访问9200端口需要输入账号密码
查找了一些解决办法后,需要在容器内的配置文件内配置如下内容
xpack.secruity.enabled: false
这样重启容器之后便能成功运行es
注:编辑容器内文件时需要先安装vim
以上是我在安装过程中遇到的问题及相应的解决办法,如果有遇到同样问题的朋友,有更优雅的解决办法的话,欢迎留言~