Why elasticsearch on docker swarm requires a transport.host=localhost setting?

635 views Asked by At

I'm trying to run Elasticsearch on an docker swarm. It works as a single node cluster for now, but only when the transport.host=localhost setting is included. Here is main part of docker-compose.yml:

version: "3"

services:
    elasticsearch:
        image: "elasticsearch:7.4.1"                                          #(base version)
        hostname: elasticsearch
        ports:
            - "9200:9200"
        environment:
            - cluster.name=elasticsearch
            - bootstrap.memory_lock=true
            - ES_JAVA_OPTS=-Xms512m -Xmx512m
            - transport.host=localhost
        volumes:
            - "./elasticsearch/volumes:/usr/share/elasticsearch/data"
        networks:
            - logger_net

volumes:
    logging:

networks:
    logger_net:
        external: true

Above configuration results in the yellow cluster state (because some indexes require additional replica).

Elasticsearch status page is unavailable when I'm using IP of the elasticsearch docker container in a transport.host setting or without a transport.host=localhost setting.

I think that using a transport.host=localhost setting is wrong. Is proper configuration of Elasticsearch in docker swarm available?

0

There are 0 answers