无法使用docker-compose文件运行elasticsearch

时间:2017-11-17 02:37:01

标签: elasticsearch docker-compose

创建目录Product_dir

mkdir Product_dir

cd Product_dir

docker-compose up

  • Iam将数据目录指向我主机上的路径:/ var / elasticsearch / data / product1 /
  • 获得目录的完全权限:chmod -R 777 / var / elasticsearch /
  • 将所有者更改为elasticsearch:chown -R elasticsearch:elasticsearch / var / elasticsearch /

docker-compose.yml file

    version: "2"
    services:
      elasticsearch-5-6:
        image: docker.elastic.co/elasticsearch/elasticsearch:5.6.3
        container_name: elasticsearch-5-6
        ports:
          - "9201:9200"
        volumes:
          - /var/elasticsearch/data/product1/:/usr/share/elasticsearc/data/
          #- /etc/elasticsearch/elasticsearch-5-6.yml:/usr/share/elasticsearch/config/elasticsearch.yml
          #- /etc/elasticsearch/logging.yml:/usr/share/elasticsearch/config/logging.yml
          #- /var/log/elasticsearch/:/usr/share/elasticsearch/logs/
        environment:
         - cluster.name=docker-cluster-elasticsearch-5-6
         #- bootstrap.memory_lock=true
         - "ES_JAVA_OPTS: -Xmx2048m -Xms2048m"

日志文件:

[root@localhost docker-elasticsearch-5-6]# docker-compose up
Starting elasticsearch-5-6 ...
Starting elasticsearch-5-6 ... done
Attaching to elasticsearch-5-6
elasticsearch-5-6    | [2017-11-17T01:55:09,017][INFO ][o.e.n.Node               ] [] initializing ...
elasticsearch-5-6    | [2017-11-17T01:55:09,035][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
elasticsearch-5-6    | org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: Failed to create node environment
elasticsearch-5-6    |  at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-5.6.3.jar:5.6.3]
elasticsearch-5-6    |  at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:123) ~[elasticsearch-5.6.3.jar:5.6.3]
elasticsearch-5-6    |  at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:70) ~[elasticsearch-5.6.3.jar:5.6.3]
elasticsearch-5-6    |  at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) ~[elasticsearch-5.6.3.jar:5.6.3]
elasticsearch-5-6    |  at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-5.6.3.jar:5.6.3]
elasticsearch-5-6    |  at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.6.3.jar:5.6.3]
elasticsearch-5-6    |  at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.6.3.jar:5.6.3]
elasticsearch-5-6    | Caused by: java.lang.IllegalStateException: Failed to create node environment
elasticsearch-5-6    |  at org.elasticsearch.node.Node.<init>(Node.java:268) ~[elasticsearch-5.6.3.jar:5.6.3]
elasticsearch-5-6    |  at org.elasticsearch.node.Node.<init>(Node.java:245) ~[elasticsearch-5.6.3.jar:5.6.3]
elasticsearch-5-6    |  at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:233) ~[elasticsearch-5.6.3.jar:5.6.3]
elasticsearch-5-6    |  at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:233) ~[elasticsearch-5.6.3.jar:5.6.3]
elasticsearch-5-6    |  at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) ~[elasticsearch-5.6.3.jar:5.6.3]
elasticsearch-5-6    |  at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) ~[elasticsearch-5.6.3.jar:5.6.3]
elasticsearch-5-6    |  ... 6 more
elasticsearch-5-6    | Caused by: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/nodes
elasticsearch-5-6    |  at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) ~[?:?]
elasticsearch-5-6    |  at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[?:?]
elasticsearch-5-6    |  at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[?:?]
elasticsearch-5-6    |  at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384) ~[?:?]
elasticsearch-5-6    |  at java.nio.file.Files.createDirectory(Files.java:674) ~[?:1.8.0_141]
elasticsearch-5-6    |  at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) ~[?:1.8.0_141]
elasticsearch-5-6    |  at java.nio.file.Files.createDirectories(Files.java:767) ~[?:1.8.0_141]
elasticsearch-5-6    |  at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:221) ~[elasticsearch-5.6.3.jar:5.6.3]
elasticsearch-5-6    |  at org.elasticsearch.node.Node.<init>(Node.java:265) ~[elasticsearch-5.6.3.jar:5.6.3]
elasticsearch-5-6    |  at org.elasticsearch.node.Node.<init>(Node.java:245) ~[elasticsearch-5.6.3.jar:5.6.3]
elasticsearch-5-6    |  at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:233) ~[elasticsearch-5.6.3.jar:5.6.3]
elasticsearch-5-6    |  at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:233) ~[elasticsearch-5.6.3.jar:5.6.3]
elasticsearch-5-6    |  at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) ~[elasticsearch-5.6.3.jar:5.6.3]
elasticsearch-5-6    |  at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) ~[elasticsearch-5.6.3.jar:5.6.3]
elasticsearch-5-6    |  ... 6 more
elasticsearch-5-6 exited with code 1

0 个答案:

没有答案