cockroach icon indicating copy to clipboard operation
cockroach copied to clipboard

roachprod: pgurl should return publicly accessible IP/host

Open shermanCRL opened this issue 6 years ago • 3 comments

Describe the problem

When using roachprod purl $CLUSTER on GCP, the resulting URI seems to use an internal IP address, inaccessible to me.

To Reproduce

  • Set up 3-node cluster on GCP as normal
  • roachprod pgsql $CLUSTER, which returns 'postgres://[email protected]:26257?sslmode=disable' 'postgres://[email protected]:26257?sslmode=disable' 'postgres://[email protected]:26257?sslmode=disable'
  • Attempt to connect using cockroach sql --url 'postgres://[email protected]:26257?sslmode=disable'
  • In the SQL shell, type show databases;
  • Returned error is:
ERROR: cannot dial server.
Is the server running?

You can ping the above IP address as well to see inability to connect.

Expected behavior

cockroach sql would connect to the instance, and successfully issue commands, using a pg connection string.

I believe the issue is the IP address. The roachprod pgurl command could instead use the public IP address for the cluster nodes, or better yet, host names.

I was able to successfully connect using cockroach sql --url 'postgres://[email protected]:26257?sslmode=disable', for example. I got this host name from roachprod adminurl.

Question: is there a simple command to show internal IP, external IP and host names for $CLUSTER? Simply being able to retrieve these things would be a partial solution.

Environment: Cockroach built locally using make. cockroach version:

Build Tag: v20.2.0-alpha.1-2478-g4e563b35bc Build Time: 2020/08/20 15:07:38 Distribution: CCL Platform: darwin amd64 (x86_64-apple-darwin19.6.0) Go Version: go1.13.15 C Compiler: Apple LLVM 12.0.0 (clang-1200.0.26.2) Build Commit ID: 4e563b35bc336419a233ec6daf0593341ddab068 Build Type: development

Additional context My goal in this case is to use non-root SQL users, for testing.

Jira issue: CRDB-3896

shermanCRL avatar Aug 20 '20 16:08 shermanCRL

Hi @shermanCRL, please add a C-ategory label to your issue. Check out the label system docs.

While you're here, please consider adding an A- label to help keep our repository tidy.

:owl: Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

blathers-crl avatar Aug 20 '20 16:08 blathers-crl

I just found that you can use roachprod pgurl --external $CLUSTER and get the external IP.

rail avatar Mar 11 '21 23:03 rail

We have marked this issue as stale because it has been inactive for 18 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to CockroachDB!

github-actions[bot] avatar Sep 07 '23 11:09 github-actions[bot]