Need help in setting up Elasticsearch cluster

Hi there,
I am trying to run 2 nodes of elasticsearch and want them to form a cluster.
But while running i am getting:-

{"@timestamp":"2023-05-30T07:06:22.601Z", "log.level": "WARN", "message":"This node is a fully-formed single-node cluster with cluster UUID [8_n3fahoRiO0QBLqZHCBBw], but it is configured as if to discover other nodes and form a multi-node cluster via the [discovery.seed_hosts=[10.0.0.214:9300]] setting. Fully-formed clusters do not attempt to discover other nodes, and nodes with different cluster UUIDs cannot belong to the same cluster. The cluster UUID persists across restarts and can only be changed by deleting the contents of the node's data path(s). Remove the discovery configuration to suppress this message.", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[master][scheduler][T#1]","log.logger":"org.elasticsearch.cluster.coordination.Coordinator","elasticsearch.cluster.uuid":"8_n3fahoRiO0QBLqZHCBBw","elasticsearch.node.id":"jyX0GX8wT6uDXJ6WWp0BQQ","elasticsearch.node.name":"master","elasticsearch.cluster.name":"my-elasticsearch-cluster"}

Note: I am using docker to run these nodes in separate ec2 instances in different regions.

can you share elasticsearch.yml settings?

sure here it is:-

Node 1:- sudo docker run -it --pull=always --privileged --net elastic -p 9200:9200 -p 9300:9300 -e cluster.name=my-elasticsearch-cluster -e node.name=master -e discovery.seed_hosts=10.0.0.214:9300 -e xpack.security.enabled=false -e network.host=0.0.0.0 -e cluster.initial_master_nodes=master -e ES_JAVA_OPTS="-Xms1g -Xmx1g" docker.elastic.co/elasticsearch/elasticsearch:8.7.0
Node 2:- docker run -it --pull=always --privileged --net elastic -p 9200:9200 -p 9300:9300 -e cluster.name=my-elasticsearch-cluster -e node.name=node-1 -e discovery.seed_hosts=192.168.0.138:9300 -e xpack.security.enabled=false -e network.host=0.0.0.0 -e cluster.initial_master_nodes=master -e ES_JAVA_OPTS="-Xms1g -Xmx1g" docker.elastic.co/elasticsearch/elasticsearch:8.7.0

@canelia Can you help here?
I have shared the commands am using with env variables.

Note that it is not recommended to deploy Elasticsearch across different regions as it required good bandwidth and law latency networking within the cluster. 2 nodes will also not give you high availability if that is what you are trying to achieve. Please see the docs for further details on this.

It looks like you are using non-public IP addresses. As your nodes are in different regions I would expect that you would need to assign and use public IP addresses to both nodes in order to create a cluster.

Thanks for the response!

I get your point on deploying in different regions, but ideally it should get connected across regions as well if we leave latency for the time being.

Also, I am just trying with 2 nodes on trial basis, once I am able to form cluster will use more than 2 for sure.

Talking about the non-public ip address, for that I have already done the VPC peering due to which I can ping these EC2 instances with their private IPs address.

But, am still not able to form a cluster here is the updated commands that I am using:-

Node 1:- 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 node.roles="master" -e discovery.seed_hosts=["192.168.0.136","10.0.0.211","10.0.0.228"] -e xpack.security.enabled=false -e xpack.ml.enabled=false -e network.host="0.0.0.0" -e cluster.initial_master_nodes=["node-1","node-2","node-3"] -e ES_JAVA_OPTS="-Xms1g -Xmx1g" docker.elastic.co/elasticsearch/elasticsearch:8.7.0

{"@timestamp":"2023-06-01T12:01:15.741Z", "log.level": "WARN", "message":"completed handshake with [{node-3}{chP4VsW5Tf-CgF_vMXO37w}{gF53WQ38Tgu5PqbF9t01qg}{node-3}{172.19.0.2}{172.19.0.2:9300}{m}{8.7.0}] at [10.0.0.228:9300] but followup connection to [172.19.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-3][172.19.0.2:9300] connect_timeout[30s]","error.stack_trace":"org.elasticsearch.transport.ConnectTransportException: [node-3][172.19.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-06-01T12:01:15.741Z", "log.level": "WARN", "message":"address [10.0.0.228:9300], node [null], requesting [false] discovery result: [node-3][172.19.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"}

I think check your elasticsearch publish ip.
try network.publish_host="10.0.0.228"

It worked!
Thanks a lot buddy.

my pleasure :smiley:

maybe you can change this issue status like solved

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