Docker ELK Stack, changed compose, now shards missing

(Brandon Martin) #1

I'm using elasticsearch docker containers for my nodes.
I began experimenting with Scripts, and needed to add a volume. Here's what my docker-compose now contains

    build: elasticsearch/
    container_name: elasticsearch
      - ./elasticsearch/config/elasticsearch.yml:/conf/elasticsearch.yml
      - ./elasticsearch/config/scripts:/conf/scripts
      - /data/elasticsearch:/usr/share/elasticsearch/data:rw
      ES_JAVA_OPTS: "-Xmx4g -Xms4g"
      UNICAST_HOSTS: elasticsearch,elasticsearch_3,elasticsearch_2,elasticsearch_4,elasticsearch_1
      MIN_MASTERS: 1
      PLUGINS: x-pack
      - elk
    restart: always

Using data volumes, my belief was I could update the docker containers without losing data. After adding the scripts folder, compose re-created the containers, and now my shards have gone missing.
I can still see the data in the folder (/data/elasticsearch1/nodes/0/, 130gb), but my shards have reset and elasticsearch is not using my previous data.
Is there a way to tell elasticsearch to rescan the data directory and re-allocate those shards from before? Or am I using the data volume incorrectly?

(Brandon Martin) #2

I'm reading here, "Upon startup, Elasticsearch will check to see if the cluster folder exists and has data, and will read from it if necessary."
It doesn't seem my elasticsearch nodes are doing as such.

(Brandon Martin) #3

More reading here
Most probable cause is the node IDs changed. I've added the parameter in my elasticsearch.yml files. This way they won't change.

I still am not sure how to force elasticsearch to check existing data. I tried renaming the _state folder, a new was created and still didn't see old data.

(Brandon Martin) #4

Problem was my Dockerfile set elasticsearch to use /data for the volume and data directory. Changing my volume to /data:/data solved the issue.
I was able to collect all indices from failed container volumes, re-assigning shards now.

(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.