# Unable to form an ES cluster

**URL:** <https://discuss.elastic.co/t/unable-to-form-an-es-cluster/334795>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [May 31, 2023, 11:30am UTC](https://discuss.elastic.co/t/unable-to-form-an-es-cluster/334795 "2023-05-31T11:30:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ANUBHAV\_GUPTA](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@ANUBHAV\_GUPTA](https://discuss.elastic.co/u/ANUBHAV_GUPTA)\
**Post date:** [May 31, 2023, 11:30am UTC](https://discuss.elastic.co/t/unable-to-form-an-es-cluster/334795/1 "2023-05-31T11:30:30Z")

</div>

I am having 2 nodes having elasticsearch installed.

I am running first node as :- `sudo docker run -it --pull=always --net elastic -p 9200:9200 -p 9300:9300 -e discovery.type=multi-node -e cluster.name="my-elasticsearch-cluster" -e node.name="node-1" -e discovery.seed_hosts=["192.168.0.136","10.0.0.211"] -e xpack.security.enabled=false -e http.port=9200 -e network.host=0.0.0.0 -e cluster.initial_master_nodes=["node-1","node-2"] -e ES_JAVA_OPTS="-Xms1g -Xmx1g" docker.elastic.co/elasticsearch/elasticsearch:8.7.0`

Second node as :- `sudo docker run -it --pull=always --net elastic -p 9200:9200 -p 9300:9300 -e "cluster.name=my-elasticsearch-cluster" -e "discovery.type=multi-node" -e node.name="node-1" -e discovery.seed_hosts=["192.168.0.136","10.0.0.211"] -e xpack.security.enabled=false -e network.host="0.0.0.0" -e cluster.initial_master_nodes=["node-1","node-2"] -e ES_JAVA_OPTS="-Xms1g -Xmx1g" docker.elastic.co/elasticsearch/elasticsearch:8.7.0`

But getting similar warning/error in both instead of forming a cluster.

Node1 :- `{"@timestamp":"2023-05-31T11:17:05.552Z", "log.level": "WARN", "message":"master not discovered yet, this node has not previously joined a bootstrapped cluster, and this node must discover master-eligible nodes [node-1, node-2] to bootstrap a cluster: have discovered [{node-1}{NfHgB2J5Q8OZ4cZIbcIwXA}{myrHm5UaQCqemh1A1h7stA}{node-1}{172.20.0.2}{172.20.0.2:9300}{cdfhilmrstw}{8.7.0}]; discovery will continue using [192.168.0.136:9300, 10.0.0.211:9300] from hosts providers and [{node-1}{NfHgB2J5Q8OZ4cZIbcIwXA}{myrHm5UaQCqemh1A1h7stA}{node-1}{172.20.0.2}{172.20.0.2:9300}{cdfhilmrstw}{8.7.0}] from last-known cluster state; node term 0, last-accepted version 0 in term 0; for troubleshooting guidance, see https://www.elastic.co/guide/en/elasticsearch/reference/8.7/discovery-troubleshooting.html", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[node-1][cluster_coordination][T#1]","log.logger":"org.elasticsearch.cluster.coordination.ClusterFormationFailureHelper","elasticsearch.node.name":"node-1","elasticsearch.cluster.name":"my-elasticsearch-cluster"} {"@timestamp":"2023-05-31T11:17:08.782Z", "log.level": "WARN", "message":"completed handshake with [{node-1}{KLD5RpICRFGMOVHEKPS55Q}{bArxiLqnQCu1qb-LVQVtOg}{node-1}{172.21.0.2}{172.21.0.2:9300}{cdfhilmrstw}{8.7.0}] at [192.168.0.136:9300] but followup connection to [172.21.0.2:9300] failed", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[node-1][generic][T#4]","log.logger":"org.elasticsearch.discovery.HandshakingTransportAddressConnector","elasticsearch.node.name":"node-1","elasticsearch.cluster.name":"my-elasticsearch-cluster","error.type":"org.elasticsearch.transport.ConnectTransportException","error.message":"[node-1][172.21.0.2:9300] connect_timeout[30s]","error.stack_trace":"org.elasticsearch.transport.ConnectTransportException: [node-1][172.21.0.2:9300] connect_timeout[30s]\n\tat org.elasticsearch.server@8.7.0/org.elasticsearch.transport.TcpTransport$ChannelsConnectedListener.onTimeout(TcpTransport.java:1157)\n\tat org.elasticsearch.server@8.7.0/org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:891)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)\n\tat java.base/java.lang.Thread.run(Thread.java:1589)\n"} {"@timestamp":"2023-05-31T11:17:08.782Z", "log.level": "WARN", "message":"address [192.168.0.136:9300], node [null], requesting [false] discovery result: [node-1][172.21.0.2:9300] connect_timeout[30s]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[node-1][generic][T#4]","log.logger":"org.elasticsearch.discovery.PeerFinder","elasticsearch.node.name":"node-1","elasticsearch.cluster.name":"my-elasticsearch-cluster"}`

Node 2:- `{"@timestamp":"2023-05-31T11:17:07.750Z", "log.level": "WARN", "message":"master not discovered yet, this node has not previously joined a bootstrapped cluster, and this node must discover master-eligible nodes [node-1, node-2] to bootstrap a cluster: have discovered [{node-1}{KLD5RpICRFGMOVHEKPS55Q}{bArxiLqnQCu1qb-LVQVtOg}{node-1}{172.21.0.2}{172.21.0.2:9300}{cdfhilmrstw}{8.7.0}]; discovery will continue using [192.168.0.136:9300, 10.0.0.211:9300] from hosts providers and [{node-1}{KLD5RpICRFGMOVHEKPS55Q}{bArxiLqnQCu1qb-LVQVtOg}{node-1}{172.21.0.2}{172.21.0.2:9300}{cdfhilmrstw}{8.7.0}] from last-known cluster state; node term 0, last-accepted version 0 in term 0; for troubleshooting guidance, see https://www.elastic.co/guide/en/elasticsearch/reference/8.7/discovery-troubleshooting.html", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[node-1][cluster_coordination][T#1]","log.logger":"org.elasticsearch.cluster.coordination.ClusterFormationFailureHelper","elasticsearch.node.name":"node-1","elasticsearch.cluster.name":"my-elasticsearch-cluster"} {"@timestamp":"2023-05-31T11:17:07.959Z", "log.level": "WARN", "message":"completed handshake with [{node-1}{NfHgB2J5Q8OZ4cZIbcIwXA}{myrHm5UaQCqemh1A1h7stA}{node-1}{172.20.0.2}{172.20.0.2:9300}{cdfhilmrstw}{8.7.0}] at [10.0.0.211:9300] but followup connection to [172.20.0.2:9300] failed", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[node-1][generic][T#2]","log.logger":"org.elasticsearch.discovery.HandshakingTransportAddressConnector","elasticsearch.node.name":"node-1","elasticsearch.cluster.name":"my-elasticsearch-cluster","error.type":"org.elasticsearch.transport.ConnectTransportException","error.message":"[node-1][172.20.0.2:9300] connect_timeout[30s]","error.stack_trace":"org.elasticsearch.transport.ConnectTransportException: [node-1][172.20.0.2:9300] connect_timeout[30s]\n\tat org.elasticsearch.server@8.7.0/org.elasticsearch.transport.TcpTransport$ChannelsConnectedListener.onTimeout(TcpTransport.java:1157)\n\tat org.elasticsearch.server@8.7.0/org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:891)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)\n\tat java.base/java.lang.Thread.run(Thread.java:1589)\n"} {"@timestamp":"2023-05-31T11:17:07.960Z", "log.level": "WARN", "message":"address [10.0.0.211:9300], node [null], requesting [false] discovery result: [node-1][172.20.0.2:9300] connect_timeout[30s]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[node-1][generic][T#2]","log.logger":"org.elasticsearch.discovery.PeerFinder","elasticsearch.node.name":"node-1","elasticsearch.cluster.name":"my-elasticsearch-cluster"}`

What am I doing wrong here?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 31, 2023, 11:31am UTC](https://discuss.elastic.co/t/unable-to-form-an-es-cluster/334795/2 "2023-05-31T11:31:42Z")

</div>

This seems to be the same issue discussed in [this thread](https://discuss.elastic.co/t/need-help-in-setting-up-elasticsearch-cluster/334642). Please do not open multiple threads on the same issue. It would be better to add this additional information to the original topic.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [June 1, 2023, 1:43am UTC](https://discuss.elastic.co/t/unable-to-form-an-es-cluster/334795/3 "2023-06-01T01:43:17Z")

</div>


