Cluster_uuidが_na_となる

現在、Docker swarmモードで3台のマシン上にElasticsearchクラスタを構築しております。(ホスト名はnode1, node2, node3、Elasticsearchのバージョンは7.8.1)

es@node1:~$ sudo docker node ls
ID                            HOSTNAME            STATUS              AVAILABILITY        MANAGER STATUS      ENGINE VERSION
mqjpjux7clfft9rwvw232728e *   node1             Ready               Active              Leader              19.03.13
crdw0q6a19vbvzjh5nlw7fafy     node2              Ready               Active                                  19.03.11
76igdygrikkyr6ep0hm7biko0     node3              Ready               Active                                  19.03.11

IPアドレスは
・node1: 172.19.100.11
・node2: 172.19.100.13
・node3: 172.19.100.15
としています。

node1上で起動しているMasterノードで以下のようなログが出力され、クラスタに参加されない問題が発生しています。

es_master1.1.kgrjxkob9fut@node1 | {"type": "server", "timestamp": "2020-11-24T04:41:49,245Z", "level": "WARN", "component": "o.e.c.c.ClusterFormationFailureHelper", "cluster.name": "docker-swarm", "node.name": "master1", "message": "master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster, and this node must discover master-eligible nodes [master1, master2, master3] to bootstrap a cluster: have discovered [{master1}{S5AQ1rE9QZ6ig0JKNDwpCQ}{aVUqFOUeRxuQx3eX1IVGZA}{10.0.3.11}{10.0.3.11:9300}{lmr}{ml.machine_memory=9663676416, xpack.installed=true, transform.node=false, ml.max_open_jobs=20}]; discovery will continue using [10.0.3.16:9300, 10.0.3.8:9300] from hosts providers and [{master1}{S5AQ1rE9QZ6ig0JKNDwpCQ}{aVUqFOUeRxuQx3eX1IVGZA}{10.0.3.11}{10.0.3.11:9300}{lmr}{ml.machine_memory=9663676416, xpack.installed=true, transform.node=false, ml.max_open_jobs=20}] from last-known cluster state; node term 0, last-accepted version 0 in term 0" }

curlコマンドを実行すると、他2つのIPではcluster_uuidが認識されていますが、node1のIPで実行した場合はcluster_uuidが_na_となってしまいます。

es@node1:~$ curl -XGET http://172.19.100.11:9200/
{
  "name" : "coordination",
  "cluster_name" : "docker-swarm",
  "cluster_uuid" : "_na_",
  "version" : {
    "number" : "7.8.1",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "b5ca9c58fb664ca8bf9e4057fc229b3396bf3a89",
    "build_date" : "2020-07-21T16:40:44.668009Z",
    "build_snapshot" : false,
    "lucene_version" : "8.5.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}
es@node2:~$ curl -XGET http://172.19.100.13:9200/
{
  "name" : "coordination",
  "cluster_name" : "docker-swarm",
  "cluster_uuid" : "KEjmmraHS5CDqM-gg9y_Ng",
  "version" : {
    "number" : "7.8.1",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "b5ca9c58fb664ca8bf9e4057fc229b3396bf3a89",
    "build_date" : "2020-07-21T16:40:44.668009Z",
    "build_snapshot" : false,
    "lucene_version" : "8.5.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}
es@node3:~$ curl -XGET http://172.19.100.15:9200/
{
  "name" : "coordination",
  "cluster_name" : "docker-swarm",
  "cluster_uuid" : "KEjmmraHS5CDqM-gg9y_Ng",
  "version" : {
    "number" : "7.8.1",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "b5ca9c58fb664ca8bf9e4057fc229b3396bf3a89",
    "build_date" : "2020-07-21T16:40:44.668009Z",
    "build_snapshot" : false,
    "lucene_version" : "8.5.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

クラスタを構成するためのdocker-compose.ymlは以下のように設定しています。

version: "3.7"
services:
  coordination:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.8.1
    environment:
      - network.host=0.0.0.0
      - node.name=coordination
      - cluster.name=docker-swarm
      - node.master=false
      - node.data=false
      - node.ingest=true
      - cluster.initial_master_nodes=master1,master2,master3
      - discovery.seed_hosts=master1,master2,master3
      - xpack.monitoring.collection.enabled=true
      - xpack.security.enabled=false
      - bootstrap.memory_lock=false
      - "ES_JAVA_OPTS=-Xms8g -Xmx8g"
      - "MAX_LOCKED_MEMORY=unlimited"
    networks:
      - esnet
    ports:
      - target: 9200
        published: 9200
        protocol: tcp
        mode: host
    deploy:
      endpoint_mode: dnsrr
      mode: 'global'
      resources:
        limits:
          memory: 9G
        reservations:
          memory: 8G

  master1:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.8.1
    environment:
      - network.host=0.0.0.0
      - discovery.zen.minimum_master_nodes=2
      - node.name=master1
      - cluster.name=docker-swarm
      - node.master=true
      - node.data=false
      - node.ingest=false
      - cluster.initial_master_nodes=master1,master2,master3
      - discovery.seed_hosts=master2,master3
      - xpack.monitoring.collection.enabled=true
      - xpack.security.enabled=false
      - bootstrap.memory_lock=false
      - "ES_JAVA_OPTS=-Xms8g -Xmx8g"
      - "MAX_LOCKED_MEMORY=unlimited"
    networks:
      - esnet
    deploy:
      placement:
        constraints: [node.hostname == node1]
      endpoint_mode: dnsrr
      mode: 'replicated'
      replicas: 1
      resources:
        limits:
          memory: 9G
        reservations:
          memory: 8G
    volumes:
      - /home/master:/usr/share/elasticsearch/data

  master2:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.8.1
    environment:
      - network.host=0.0.0.0
      - discovery.zen.minimum_master_nodes=2
      - node.name=master2
      - cluster.name=docker-swarm
      - node.master=true
      - node.data=false
      - node.ingest=false
      - cluster.initial_master_nodes=master1,master2,master3
      - discovery.seed_hosts=master1,master3
      - xpack.monitoring.collection.enabled=true
      - xpack.security.enabled=false
      - bootstrap.memory_lock=false
      - "ES_JAVA_OPTS=-Xms8g -Xmx8g"
      - "MAX_LOCKED_MEMORY=unlimited"
    networks:
      - esnet
    deploy:
      placement:
        constraints: [node.hostname == node2]
      endpoint_mode: dnsrr
      mode: 'replicated'
      replicas: 1
      resources:
        limits:
          memory: 9G
        reservations:
          memory: 8G
    volumes:
      - /mnt/esdata1/master:/usr/share/elasticsearch/data

  master3:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.8.1
    environment:
      - network.host=0.0.0.0
      - discovery.zen.minimum_master_nodes=2
      - node.name=master3
      - cluster.name=docker-swarm
      - node.master=true
      - node.data=false
      - node.ingest=false
      - cluster.initial_master_nodes=master1,master2,master3
      - discovery.seed_hosts=master1,master2
      - xpack.monitoring.collection.enabled=true
      - xpack.security.enabled=false
      - bootstrap.memory_lock=false
      - "ES_JAVA_OPTS=-Xms8g -Xmx8g"
      - "MAX_LOCKED_MEMORY=unlimited"
    networks:
      - esnet
    deploy:
      placement:
        constraints: [node.hostname == node3]
      endpoint_mode: dnsrr
      mode: 'replicated'
      replicas: 1
      resources:
        limits:
          memory: 9G
        reservations:
          memory: 8G
    volumes:
      - /mnt/esdata1/master:/usr/share/elasticsearch/data

  data1:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.8.1
    environment:
      - network.host=0.0.0.0
      - node.name=data1
      - cluster.name=docker-swarm
      - node.master=false
      - node.data=true
      - node.ingest=false
      - cluster.initial_master_nodes=master1,master2,master3
      - discovery.seed_hosts=master1,master2,master3
      - xpack.monitoring.collection.enabled=true
      - xpack.security.enabled=false
      - bootstrap.memory_lock=false
      - "ES_JAVA_OPTS=-Xms24g -Xmx24g"
      - "MAX_LOCKED_MEMORY=unlimited"
    networks:
      - esnet
    volumes:
      # パーミションを 777 にしたディレクトリを指定
      - /mnt/esdata1/data:/usr/share/elasticsearch/data
    deploy:
      placement:
        # ノードを動かすホスト名を指定
        constraints: [node.hostname == node2]
      endpoint_mode: dnsrr
      mode: 'replicated'
      replicas: 1
      resources:
        limits:
          memory: 30G
        reservations:
          memory: 24G

  data2:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.8.1
    environment:
      - network.host=0.0.0.0
      - node.name=data2
      - cluster.name=docker-swarm
      - node.master=false
      - node.data=true
      - node.ingest=false
      - cluster.initial_master_nodes=master1,master2,master3
      - discovery.seed_hosts=master1,master2,master3
      - xpack.monitoring.collection.enabled=true
      - xpack.security.enabled=false
      - bootstrap.memory_lock=false
      - "ES_JAVA_OPTS=-Xms24g -Xmx24g"
      - "MAX_LOCKED_MEMORY=unlimited"
    networks:
      - esnet
    volumes:
      - /mnt/esdata2/data:/usr/share/elasticsearch/data
    deploy:
      placement:
        constraints: [node.hostname == node2]
      endpoint_mode: dnsrr
      mode: 'replicated'
      replicas: 1
      resources:
        limits:
          memory: 30G
        reservations:
          memory: 24G

  data3:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.8.1
    environment:
      - network.host=0.0.0.0
      - node.name=data3
      - cluster.name=docker-swarm
      - node.master=false
      - node.data=true
      - node.ingest=false
      - cluster.initial_master_nodes=master1,master2,master3
      - discovery.seed_hosts=master1,master2,master3
      - xpack.monitoring.collection.enabled=true
      - xpack.security.enabled=false
      - bootstrap.memory_lock=false
      - "ES_JAVA_OPTS=-Xms24g -Xmx24g"
      - "MAX_LOCKED_MEMORY=unlimited"
    networks:
      - esnet
    volumes:
      - /mnt/esdata1/data:/usr/share/elasticsearch/data
    deploy:
      placement:
        constraints: [node.hostname == node3]
      endpoint_mode: dnsrr
      mode: 'replicated'
      replicas: 1
      resources:
        limits:
          memory: 30G
        reservations:
          memory: 24G

  data4:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.8.1
    environment:
      - network.host=0.0.0.0
      - node.name=data4
      - cluster.name=docker-swarm
      - node.master=false
      - node.data=true
      - node.ingest=false
      - cluster.initial_master_nodes=master1,master2,master3
      - discovery.seed_hosts=master1,master2,master3
      - bootstrap.memory_lock=false
      - xpack.monitoring.collection.enabled=true
      - xpack.security.enabled=false
      - "ES_JAVA_OPTS=-Xms24g -Xmx24g"
      - "MAX_LOCKED_MEMORY=unlimited"
    networks:
      - esnet
    volumes:
      - /mnt/esdata2/data:/usr/share/elasticsearch/data
    deploy:
      placement:
        constraints: [node.hostname == node3]
      endpoint_mode: dnsrr
      mode: 'replicated'
      replicas: 1
      resources:
        limits:
          memory: 30G
        reservations:
          memory: 24G

  kibana:
    image: docker.elastic.co/kibana/kibana:7.8.1
    hostname: kibana
    environment:
      - elasticsearch.requestTimeout=60000
      - elasticsearch.shardTimeout=60000
      - "ELASTICSEARCH_HOSTS=http://coordination:9200"
      - xpack.monitoring.collection.enabled=true
    ports:
      - target: 5601
        published: 5601
        protocol: tcp
        mode: host
    networks:
      - esnet
    deploy:
      placement:
        constraints: [node.hostname == node1]

networks:
  esnet:
    driver: overlay

長くなりましたが、こちらの対処法をご教示いただけますと幸いです。

クラスタ作成時は「na」になるらしいので、作成できてないから_uuidがこうなっているのだと思います

 While the cluster is still forming, it is possible for the `cluster_uuid` to be `_na_` as well as the cluster state’s version to be `-1` .

余りしっかり読んでいなく、環境など作ってないので分からないのですが、IPでcurlが問題なくできているのであれば「cluster.initial_master_nodes」や「discovery.seed_hosts」にhost(master1,master2,master3)ではなく、ip(172.19.100.11~)を設定すれば動くような気がします。

それで動いたならば、ホスト名の解決ができてないのでその対処をすれば良いかなと思います。

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