I’m just testing out CRDB for the first time. I have this question about a behavior.
First of all I have 2 machines, A and B. I start A with:
cockroach start --http-port=8084 --host=0.0.0.0 --advertise-host=10.48.19.20 --background --insecure
(The reason for 0.0.0.0 is that I want the DB to serve request from localhost, as well as from external clients. For purpose of clustering, the host is 10.48.19.20)
I then start B with:
cockroach start --http-port=8084 --host=0.0.0.0 --join=10.48.19.20 --insecure --background
(This is mostly the same as before, but I use “join” instead of “advertise-host” so that B can join A in one cluster).
At first everything looks good. They’re in a cluster (the Admin UI confirms that). I can create a DB, or a table in one node, and “show tables” in the other node will show it.
- If I insert a row in A, I can see it in A (“select * from …”)
- If I insert a row in B, I can also see it in A. So “INSERT” and “SHOW” work on both nodes.
However I cannot do “SELECT” in B. It will throw this error: " pq: no inbound stream connection". I also get this error when I type “\q” to quit the SQL shell in B.
The only way I can avoid this error and make things fully work is by binding B to a particular IP address:
cockroach start --http-port=8084 --host=10.48.19.16 --join=10.48.19.20 --insecure --background
However this means when connect from locally, I still have to specify the IP as if coming in from outside. I can no longer use “localhost” or loopback address.
I know it is a small price to pay. But I’m still interested in knowing why. A apparently had no problem binding to “0.0.0.0”, so why can’t B?