Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 6125

Only on EC2 Ubuntu, elasticsearch by docker doesn't work

$
0
0

Error log

{"@timestamp":"2024-03-19T14:25:08.633Z", "log.level":"ERROR", "message":"fatal exception while booting Elasticsearch", "ecs.version":"1.2.0", "service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.bootstrap.Elasticsearch","elasticsearch.node.name":"ella","elasticsearch.cluster.name":"es","error.type":"java.lang.IllegalStateException","error.message":"failed to obtain node locks, tried [/usr/share/elasticsearch/data]; maybe these locations are not writable or multiple nodes were started on the same data path?","error.stack_trace":"java.lang.IllegalStateException: failed to obtain node locks, tried [/usr/share/elasticsearch/data]; maybe these locations are not writable or multiple nodes were started on the same data path?\n\tat org.elasticsearch.server@8.12.2/org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:296)\n\tat org.elasticsearch.server@8.12.2/org.elasticsearch.node.NodeConstruction.validateSettings(NodeConstruction.java:484)\n\tat org.elasticsearch.server@8.12.2/org.elasticsearch.node.NodeConstruction.prepareConstruction(NodeConstruction.java:246)\n\tat org.elasticsearch.server@8.12.2/org.elasticsearch.node.Node.<init>(Node.java:181)\n\tat org.elasticsearch.server@8.12.2/org.elasticsearch.bootstrap.Elasticsearch$2.<init>(Elasticsearch.java:236)\n\tat org.elasticsearch.server@8.12.2/org.elasticsearch.bootstrap.Elasticsearch.initPhase3(Elasticsearch.java:236)\n\tat org.elasticsearch.server@8.12.2/org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:73)\nCaused by: java.io.IOException: failed to obtain lock on /usr/share/elasticsearch/data\n\tat org.elasticsearch.server@8.12.2/org.elasticsearch.env.NodeEnvironment$NodeLock.<init>(NodeEnvironment.java:241)\n\tat org.elasticsearch.server@8.12.2/org.elasticsearch.env.NodeEnvironment$NodeLock.<init>(NodeEnvironment.java:209)\n\tat org.elasticsearch.server@8.12.2/org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:288)\n\t... 6 more\n Caused by: java.nio.file.NoSuchFileException: /usr/share/elasticsearch/data/node.lock\n\tat java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)\n\tat java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)\n\tat java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)\n\tat java.base/sun.nio.fs.UnixPath.toRealPath(UnixPath.java:834)\n\tat org.apache.lucene.core@9.9.2/org.apache.lucene.store.NativeFSLockFactory.obtainFSLock(NativeFSLockFactory.java:94)\n\tat org.apache.lucene.core@9.9.2/org.apache.lucene.store.FSLockFactory.obtainLock(FSLockFactory.java:43)\n\tat org.apache.lucene.core@9.9.2/org.apache.lucene.store.BaseDirectory.obtainLock(BaseDirectory.java:44)\n\tat org.elasticsearch.server@8.12.2/org.elasticsearch.env.NodeEnvironment$NodeLock.<init>(NodeEnvironment.java:234)\n\t... 8 more\n\t Suppressed: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/node.lock\n\t\tat java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)\n\t\tat java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)\n\t\tat java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)\n\t\tat java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:261)\n\t\tat java.base/java.nio.file.Files.newByteChannel(Files.java:379)\n\t\tat java.base/java.nio.file.Files.createFile(Files.java:657)\n\t\tat org.apache.lucene.core@9.9.2/org.apache.lucene.store.NativeFSLockFactory.obtainFSLock(NativeFSLockFactory.java:84)\n\t\t... 11 more\n"}

Note

I use docker compose, and below the yaml file.

Docker-compose.yml

version: "3.8"networks:  netwrk:    driver: bridgeservices:  elastic:      container_name: elastic_db      build: ./elastic      environment:        LC_ALL: C.UTF-8        node.name: ella        discovery.type: single-node        cluster.name: es        ES_JAVA_OPTS: -Xms512m -Xmx512m        ELASITC_USERNAME: elastic        ELASTIC_PASSWORD: ${ELASTIC_PASSWORD}        bootstrap.memory_lock: true        xpack.security.enabled: false      ulimits:        memlock:          soft: -1          hard: -1      volumes:        - ~/Docker/volume/elastic:/usr/share/elasticsearch/data      healthcheck:        test: curl -u elastic:${ELASTIC_PASSWORD} http://localhost:9200/_cluster/health        interval: 5s        timeout: 5s        retries: 30        start_period: 30s      expose:        - 9200        - 9300      networks:        - netwrk  (and other containers)
  • Docker compose works well on my local desktop.
  • I run command sudo docker compose up --build -d on EC2 ubuntu, but error invoked.

Docker, docker-compose version

  • Local:
    • Docker: 25.0.3
    • docker-compose: 2.24.6
  • EC2 Ubuntu:
    • Docker: 26.0.0
    • docker-compose: 2.25.0

PS

The volume file ~/Docker/volume/... is not on /home/ubuntu/Docker/volume....
They are created on /root/Docker/volume/....

Why it happens? (I guess because docker-compose run by sudo...)And Is there any solution to make volume file on /home/ubuntu/ (~ of host) directory?

I wish Elastic goes to work well


Viewing all articles
Browse latest Browse all 6125

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>