docker启动elasticsearch异常Failed to create node environment(解决)

elasticsearch 同时被 2 个专栏收录
3 篇文章 0 订阅
9 篇文章 0 订阅

我自己编写了docker-compose文件用来启动elasticsearch,docker-compose文件如下:

version: '2'
services:
    hdback-elasticsearch:
        #自己生成的elasticsearch集成ik分词器镜像
        image: ***/elasticsearch-with-ik:6.4.3
        environment:
            - bootstrap.memory_lock=true
            - "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
        ulimits:
           memlock:
              soft: -1
              hard: -1
           nofile:
              soft: 65536
              hard: 65536
        volumes:
            - ./es/es-with-ik-data/:/usr/share/elasticsearch/data/
        ports:
            - 9200:9200
            - 9300:9300

elasticsearch集成IK分词器详解:https://blog.csdn.net/s1078229131/article/details/90036289

启动时elasticsearch却抛出如下异常:

hdback-elasticsearch_1  | 	org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: Failed to create node environment
hdback-elasticsearch_1  | 	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:140) ~[elasticsearch-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) ~[elasticsearch-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) ~[elasticsearch-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | Caused by: java.lang.IllegalStateException: Failed to create node environment
hdback-elasticsearch_1  | 	at org.elasticsearch.node.Node.<init>(Node.java:277) ~[elasticsearch-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	at org.elasticsearch.node.Node.<init>(Node.java:256) ~[elasticsearch-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:213) ~[elasticsearch-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:213) ~[elasticsearch-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:326) ~[elasticsearch-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	... 6 more
hdback-elasticsearch_1  | Caused by: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/nodes
hdback-elasticsearch_1  | 	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:90) ~[?:?]
hdback-elasticsearch_1  | 	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) ~[?:?]
hdback-elasticsearch_1  | 	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116) ~[?:?]
hdback-elasticsearch_1  | 	at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:385) ~[?:?]
hdback-elasticsearch_1  | 	at java.nio.file.Files.createDirectory(Files.java:682) ~[?:?]
hdback-elasticsearch_1  | 	at java.nio.file.Files.createAndCheckIsDirectory(Files.java:789) ~[?:?]
hdback-elasticsearch_1  | 	at java.nio.file.Files.createDirectories(Files.java:775) ~[?:?]
hdback-elasticsearch_1  | 	at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:207) ~[elasticsearch-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	at org.elasticsearch.node.Node.<init>(Node.java:274) ~[elasticsearch-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	at org.elasticsearch.node.Node.<init>(Node.java:256) ~[elasticsearch-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:213) ~[elasticsearch-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:213) ~[elasticsearch-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:326) ~[elasticsearch-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	... 6 more

异常说是创建节点环境失败,操作/usr/share/elasticsearch/data/nodes的IO错误,尝试给此目录添加读写权限后,依旧没什么**用,灵机一动是不是挂载目录没有权限导致的?

chmod 777 挂载目录路径

例如我的:chmod 777 es/es-with-ik-data/

再次docker-compose启动, OK!!!!问题解决☺

 

最后给各位看官来波福利!

阿里云服务器代金券和折扣免费领:https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=ypbt9nme

性能级主机2-5折:https://promotion.aliyun.com/ntms/act/enterprise-discount.html?userCode=ypbt9nme

新用户云通讯专享8折:https://www.aliyun.com/acts/alicomcloud/new-discount?userCode=ypbt9nme

新老用户云主机低4折专项地址:https://promotion.aliyun.com/ntms/act/qwbk.html?userCode=ypbt9nme

680元即可注册商标专项地址:https://tm.aliyun.com/?userCode=ypbt9nme

17元/月云主机:https://promotion.aliyun.com/ntms/act/qwbk.html?spm=5176.11533447.1097531.13.22805cfaiTv7SN&userCode=ypbt9nme

 

  • 5
    点赞
  • 1
    评论
  • 2
    收藏
  • 打赏
    打赏
  • 扫一扫,分享海报

©️2022 CSDN 皮肤主题:技术黑板 设计师:CSDN官方博客 返回首页

打赏作者

1-只小猴子

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值