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=[]] 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","":"ES_ECS","event.dataset":"elasticsearch.server","":"elasticsearch[master][scheduler][T#1]","log.logger":"org.elasticsearch.cluster.coordination.Coordinator","elasticsearch.cluster.uuid":"8_n3fahoRiO0QBLqZHCBBw","":"jyX0GX8wT6uDXJ6WWp0BQQ","":"master","":"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 -e -e discovery.seed_hosts= -e -e -e cluster.initial_master_nodes=master -e ES_JAVA_OPTS="-Xms1g -Xmx1g"
Node 2:- docker run -it --pull=always --privileged --net elastic -p 9200:9200 -p 9300:9300 -e -e -e discovery.seed_hosts= -e -e -e cluster.initial_master_nodes=master -e ES_JAVA_OPTS="-Xms1g -Xmx1g"

@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"my-elasticsearch-cluster" -e"node-1" -e node.roles="master" -e discovery.seed_hosts=["","",""] -e -e -e"" -e cluster.initial_master_nodes=["node-1","node-2","node-3"] -e ES_JAVA_OPTS="-Xms1g -Xmx1g"

{"@timestamp":"2023-06-01T12:01:15.741Z", "log.level": "WARN", "message":"completed handshake with [{node-3}{chP4VsW5Tf-CgF_vMXO37w}{gF53WQ38Tgu5PqbF9t01qg}{node-3}{}{}{m}{8.7.0}] at [] but followup connection to [] failed", "ecs.version": "1.2.0","":"ES_ECS","event.dataset":"elasticsearch.server","":"elasticsearch[node-1][generic][T#4]","log.logger":"org.elasticsearch.discovery.HandshakingTransportAddressConnector","":"node-1","":"my-elasticsearch-cluster","error.type":"org.elasticsearch.transport.ConnectTransportException","error.message":"[node-3][] connect_timeout[30s]","error.stack_trace":"org.elasticsearch.transport.ConnectTransportException: [node-3][] connect_timeout[30s]\n\tat org.elasticsearch.server@8.7.0/org.elasticsearch.transport.TcpTransport$ChannelsConnectedListener.onTimeout(\n\tat org.elasticsearch.server@8.7.0/org.elasticsearch.common.util.concurrent.ThreadContext$\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$\n\tat java.base/\n"}
{"@timestamp":"2023-06-01T12:01:15.741Z", "log.level": "WARN", "message":"address [], node [null], requesting [false] discovery result: [node-3][] connect_timeout[30s]", "ecs.version": "1.2.0","":"ES_ECS","event.dataset":"elasticsearch.server","":"elasticsearch[node-1][generic][T#4]","log.logger":"org.elasticsearch.discovery.PeerFinder","":"node-1","":"my-elasticsearch-cluster"}

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

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.