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

我自己编写了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.(Node.java:277) ~[elasticsearch-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	at org.elasticsearch.node.Node.(Node.java:256) ~[elasticsearch-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	at org.elasticsearch.bootstrap.Bootstrap$5.(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.(NodeEnvironment.java:207) ~[elasticsearch-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	at org.elasticsearch.node.Node.(Node.java:274) ~[elasticsearch-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	at org.elasticsearch.node.Node.(Node.java:256) ~[elasticsearch-6.4.3.jar:6.4.3]
hdback-elasticsearch_1  | 	at org.elasticsearch.bootstrap.Bootstrap$5.(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

 

你可能感兴趣的:(elasticsearch,小海豚Docker)