Running two clusters in a single node

Greetings,

I'm trying to set up the Cross Cluster Replication locally in a single node. I have been using one elasticsearch/kibana instance running as a service (version 7.9.3) with default settings and everything works fine. Now for the CCR I downloaded elasticsearch/kibana as tar.gz (version 7.10.0) and executed them with the following settings (I report only configurations different from the default one):
elasticsearch.yml

cluster.name: ClusterB 
http.port: 9201

kibana.yml

server.port: 5602
elasticsearch.hosts: ["http://localhost:9201"]

When I execute elasticsearch from the /bin directory this error is thrown
[WARN ][o.e.d.HandshakingTransportAddressConnector] [giacomo-ondesca-1] handshake failed for [connectToRemoteMasterNode[127.0.0.1:9300]]

Also seems that kibana tries to connect to the other elasticsearch instance (the one running as a service on port 9200).

What I'm doing wrong?

Thanks!

You probably need to set

node.name: giacomo-ondesca-1
discovery.seed_hosts: []
cluster.initial_master_nodes: [giacomo-ondesca-1]

and similarly for the other node (except I recommend replacing both instances of giacomo-ondesca-1 with something else to avoid confusion). Otherwise they'll be trying to automatically form a single cluster and will be getting confused because their cluster names don't match.

Remember to remove cluster.initial_master_nodes after the first startup too.

Hi David,
First of all thanks a lot for your answer. After you suggestions, I succeed starting the second elasticsearch instance, but it seems that the cluster cannot find a master node:

[WARN ][o.e.c.c.ClusterFormationFailureHelper] [giacomo-ondesca-2] master not discovered or elected yet, an election requires a node with id [cM2DKHgYTq-ZZwNMkfMqFA], have discovered [{giacomo-ondesca-2}{ZIcFDn9jQg2AMMJuZ7mlmg}{FsidkdaDTo-PSrjBPb1ACQ}{127.0.0.1}{127.0.0.1:9301}{cdhilmrstw}{ml.machine_memory=8348446720, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}] which is not a quorum; discovery will continue using [] from hosts providers and [{giacomo-ondesca-2}{ZIcFDn9jQg2AMMJuZ7mlmg}{FsidkdaDTo-PSrjBPb1ACQ}{127.0.0.1}{127.0.0.1:9301}{cdhilmrstw}{ml.machine_memory=8348446720, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}] from last-known cluster state; node term 15, last-accepted version 5532 in term 15

This says that the node already belonged to a cluster, but the rest of the cluster is no longer present, but that's not how you described things in your original post. I guess you've tried lots of different things and now your state is all messed up. If so, probably best to start again from scratch: shut everything down, wipe all the data paths and start the nodes up again.