1

I am connecting from elasticsearch client running in docker container to elasticsearch cluster (i.e. non dockerized). I am able to do this by having settings in the client as:

Settings settings = ImmutableSettings.settingsBuilder()
                .put("node.name", "HelloESClient")
                .put("discovery.zen.ping.multicast.enabled", false)
                .put("discovery.zen.ping.unicast.hosts", "172.16.11.50")
                .put("transport.publish_port", "9300")
                .put("transport.publish_host", "192.168.17.131");

where 192.168.17.131:9300 is the host ip: port exposed for elasticsearch cluster to connect to the node client.

I cannot expose any other port in the host machine since 9300 port is the one set in elasticsearch config yml as tcp transport port.

The issue with this is that I am unable to start more than one docker container having elasticsearch client connecting to the same elasticsearch cluster since each container cannot expose the same port in the same machine.

1 Answer 1

1
docker run -d -p 9300:9300 --name es1 elasticsearch
docker run -d -p 9301:9300 --name es2 elasticsearch
docker run -d -p 9302:9300 --name es3 elasticsearch
docker run -d -p 9303:9300 --name es4 elasticsearch

Now you have 4 elasticsearch containers

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.