cockroachdbmulti-master-replication

cockroachdb data not replicating


I am testing multi-master region setup in cockroach db (version v22.1.0 / Ubuntu 20.04):

cockroach start --insecure --store=server1 ...
cockroach start --insecure --store=server2 ...

cockroach init --insecure --host=server1

cockroach sql --insecure --host=server1:26257

When i insert data in node 1, and try to do a select on the same table in node 2, result in error "ERROR: no inbound stream connection" but select works from node 1

Additional error message from admin console for node 2:

failed to dial into node 2 (NODE_STATUS_LIVE): initial connection heartbeat failed: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial tcp x.x.x.x:26258: i/o timeout"
failed to dial into node 2 (NODE_STATUS_LIVE): initial connection heartbeat failed: operation "rpc heartbeat" timed out after 6s (took 6.001s): rpc error: code = DeadlineExceeded desc = context deadline exceeded 

can someone please advise what i am missing here ?

enter image description here


Solution

  • It looks like that before you insert data, the cluster is not set up correctly. I believe you need to start a minimum of 3 nodes and check the console to make sure that all 3 are receiving heartbeats from each other.

    There's more information about starting a cluster here:

    Make sure the --listen-addr, --http-addr, and --join arguments are correct.