Skip to content

Commit

Permalink
Use SNI connection strings for serverless docs (cockroachdb#15653)
Browse files Browse the repository at this point in the history
* Use SNI connection strings for serverless docs
  • Loading branch information
Ian Evans authored Dec 6, 2022
1 parent 8742d91 commit 81a9fdb
Show file tree
Hide file tree
Showing 41 changed files with 115 additions and 220 deletions.
2 changes: 1 addition & 1 deletion _includes/cockroachcloud/connect_to_crc.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ $ cockroach sql \

<!-- BEGIN CRC free sql -->
$ cockroach sql \
--url='postgres://<username>:<password>@<global host>:26257/<database>?sslmode=verify-full&sslrootcert=<path to the CA certificate>&options=--cluster=<cluster_name>'
--url='postgres://<username>:<password>@<global host>:26257/<database>?sslmode=verify-full&sslrootcert=<path to the CA certificate>'
<!-- END CRC free sql -->
7 changes: 3 additions & 4 deletions _includes/cockroachcloud/sql-connection-string-free.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% include_cached copy-clipboard.html %}
~~~ shell
cockroach sql --url 'postgresql://<username>:<password>@<serverless-host>:26257/defaultdb?sslmode=verify-full&sslrootcert='$HOME'/.postgresql/root.crt&options=--cluster=<routing-id>'
cockroach sql --url 'postgresql://<username>:<password>@<serverless-host>:26257/defaultdb?sslmode=verify-full&sslrootcert='$HOME'/.postgresql/root.crt'
~~~

</section>
Expand All @@ -11,7 +11,7 @@

{% include_cached copy-clipboard.html %}
~~~ shell
cockroach sql --url 'postgresql://<username>:<password>@<serverless-host>:26257/defaultdb?sslmode=verify-full&sslrootcert='$HOME'/.postgresql/root.crt&options=--cluster=<routing-id>'
cockroach sql --url 'postgresql://<username>:<password>@<serverless-host>:26257/defaultdb?sslmode=verify-full&sslrootcert='$HOME'/.postgresql/root.crt'
~~~

</section>
Expand All @@ -20,7 +20,7 @@

{% include_cached copy-clipboard.html %}
~~~ shell
cockroach sql --url "postgresql://<username>:<password>@<serverless-host>:26257/defaultdb?sslmode=verify-full&sslrootcert=$env:appdata/.postgresql/root.crt&options=--cluster=<routing-id>"
cockroach sql --url "postgresql://<username>:<password>@<serverless-host>:26257/defaultdb?sslmode=verify-full&sslrootcert=$env:appdata/.postgresql/root.crt"
~~~

</section>
Expand All @@ -29,7 +29,6 @@
- `<username>` is the SQL user. By default, this is your {{ site.data.products.db }} account username.
- `<password>` is the password for the SQL user. The password will be shown only once in the **Connection info** dialog after creating the cluster.
- `<serverless-host>` is the hostname of the {{ site.data.products.serverless }} cluster.
- `<routing-id>` identifies your tenant cluster on a [multi-tenant host](https://www.cockroachlabs.com/docs/cockroachcloud/architecture.html#architecture). For example, `funny-skunk-123`.
- `<cluster-id>` is a unique string used to identify your cluster when downloading the CA certificate. For example, `12a3bcde-4fa5-6789-1234-56bc7890d123`.

You can find these settings in the **Connection parameters** tab of the **Connection info** dialog.
2 changes: 1 addition & 1 deletion _includes/v22.1/setup/sample-setup-certs.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Select **General connection string**, then copy the connection string displayed
? How would you like to connect? General connection string
Retrieving cluster info: succeeded
Downloading cluster cert to /Users/maxroach/.postgresql/root.crt: succeeded
postgresql://maxroach:ThisIsNotAGoodPassword@free-tier4.aws-us-west-2.cockroachlabs.cloud:26257/defaultdb?options=--cluster%3Ddim-dog-147&sslmode=verify-full&sslrootcert=%2FUsers%2Fmaxroach%2F.postgresql%2Froot.crt
postgresql://maxroach:ThisIsNotAGoodPassword@dim-dog-147.6wr.cockroachlabs.cloud:26257/defaultdb?sslmode=verify-full&sslrootcert=%2FUsers%2Fmaxroach%2F.postgresql%2Froot.crt
~~~
</div>

Expand Down
2 changes: 1 addition & 1 deletion _includes/v22.1/setup/sample-setup-jdbc.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Select **General connection string**, then copy the connection string displayed
? How would you like to connect? General connection string
Retrieving cluster info: succeeded
Downloading cluster cert to /Users/maxroach/.postgresql/root.crt: succeeded
postgresql://maxroach:ThisIsNotAGoodPassword@free-tier4.aws-us-west-2.cockroachlabs.cloud:26257/defaultdb?options=--cluster%3Ddim-dog-147&sslmode=verify-full&sslrootcert=%2FUsers%2Fmaxroach%2F.postgresql%2Froot.crt
postgresql://maxroach:ThisIsNotAGoodPassword@dim-dog-147.6wr.cockroachlabs.cloud:26257/defaultdb?sslmode=verify-full&sslrootcert=%2FUsers%2Fmaxroach%2F.postgresql%2Froot.crt
~~~
</div>

Expand Down
3 changes: 1 addition & 2 deletions _includes/v22.1/setup/sample-setup-parameters-certs.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ Success! Created SQL user
Retrieving cluster info: succeeded
Connection parameters
Database: defaultdb
Host: free-tier4.aws-us-west-2.cockroachlabs.cloud
Options: --cluster=dim-dog-147
Host: dim-dog-147.6wr.cockroachlabs.cloud
Password: ThisIsNotAGoodPassword
Port: 26257
Username: maxroach
Expand Down
3 changes: 1 addition & 2 deletions _includes/v22.1/setup/sample-setup-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ Success! Created SQL user
Retrieving cluster info: succeeded
Connection parameters
Database: defaultdb
Host: free-tier4.aws-us-west-2.cockroachlabs.cloud
Options: --cluster=dim-dog-147
Host: dim-dog-147.6wr.cockroachlabs.cloud
Password: ThisIsNotAGoodPassword
Port: 26257
Username: maxroach
Expand Down
2 changes: 1 addition & 1 deletion _includes/v22.1/setup/sample-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Select **General connection string**, then copy the connection string displayed
? How would you like to connect? General connection string
Retrieving cluster info: succeeded
Downloading cluster cert to /Users/maxroach/.postgresql/root.crt: succeeded
postgresql://maxroach:ThisIsNotAGoodPassword@free-tier4.aws-us-west-2.cockroachlabs.cloud:26257/defaultdb?options=--cluster%3Ddim-dog-147&sslmode=verify-full&sslrootcert=%2FUsers%2Fmaxroach%2F.postgresql%2Froot.crt
postgresql://maxroach:ThisIsNotAGoodPassword@dim-dog-147.6wr.cockroachlabs.cloud:26257/defaultdb?sslmode=verify-full&sslrootcert=%2FUsers%2Fmaxroach%2F.postgresql%2Froot.crt
~~~
</div>

Expand Down
2 changes: 1 addition & 1 deletion _includes/v22.2/setup/sample-setup-certs.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Select **General connection string**, then copy the connection string displayed
? How would you like to connect? General connection string
Retrieving cluster info: succeeded
Downloading cluster cert to /Users/maxroach/.postgresql/root.crt: succeeded
postgresql://maxroach:ThisIsNotAGoodPassword@free-tier4.aws-us-west-2.cockroachlabs.cloud:26257/defaultdb?options=--cluster%3Ddim-dog-147&sslmode=verify-full&sslrootcert=%2FUsers%2Fmaxroach%2F.postgresql%2Froot.crt
postgresql://maxroach:ThisIsNotAGoodPassword@dim-dog-147.6wr.cockroachlabs.cloud:26257/defaultdb?sslmode=verify-full&sslrootcert=%2FUsers%2Fmaxroach%2F.postgresql%2Froot.crt
~~~
</div>

Expand Down
2 changes: 1 addition & 1 deletion _includes/v22.2/setup/sample-setup-jdbc.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Select **General connection string**, then copy the connection string displayed
? How would you like to connect? General connection string
Retrieving cluster info: succeeded
Downloading cluster cert to /Users/maxroach/.postgresql/root.crt: succeeded
postgresql://maxroach:ThisIsNotAGoodPassword@free-tier4.aws-us-west-2.cockroachlabs.cloud:26257/defaultdb?options=--cluster%3Ddim-dog-147&sslmode=verify-full&sslrootcert=%2FUsers%2Fmaxroach%2F.postgresql%2Froot.crt
postgresql://maxroach:ThisIsNotAGoodPassword@dim-dog-147.6wr.cockroachlabs.cloud:26257/defaultdb?sslmode=verify-full&sslrootcert=%2FUsers%2Fmaxroach%2F.postgresql%2Froot.crt
~~~
</div>

Expand Down
3 changes: 1 addition & 2 deletions _includes/v22.2/setup/sample-setup-parameters-certs.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ Success! Created SQL user
Retrieving cluster info: succeeded
Connection parameters
Database: defaultdb
Host: free-tier4.aws-us-west-2.cockroachlabs.cloud
Options: --cluster=dim-dog-147
Host: dim-dog-147.6wr.cockroachlabs.cloud
Password: ThisIsNotAGoodPassword
Port: 26257
Username: maxroach
Expand Down
3 changes: 1 addition & 2 deletions _includes/v22.2/setup/sample-setup-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ Success! Created SQL user
Retrieving cluster info: succeeded
Connection parameters
Database: defaultdb
Host: free-tier4.aws-us-west-2.cockroachlabs.cloud
Options: --cluster=dim-dog-147
Host: dim-dog-147.6wr.cockroachlabs.cloud
Password: ThisIsNotAGoodPassword
Port: 26257
Username: maxroach
Expand Down
2 changes: 1 addition & 1 deletion _includes/v22.2/setup/sample-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Select **General connection string**, then copy the connection string displayed
? How would you like to connect? General connection string
Retrieving cluster info: succeeded
Downloading cluster cert to /Users/maxroach/.postgresql/root.crt: succeeded
postgresql://maxroach:ThisIsNotAGoodPassword@free-tier4.aws-us-west-2.cockroachlabs.cloud:26257/defaultdb?options=--cluster%3Ddim-dog-147&sslmode=verify-full&sslrootcert=%2FUsers%2Fmaxroach%2F.postgresql%2Froot.crt
postgresql://maxroach:ThisIsNotAGoodPassword@dim-dog-147.6wr.cockroachlabs.cloud:26257/defaultdb?sslmode=verify-full&sslrootcert=%2FUsers%2Fmaxroach%2F.postgresql%2Froot.crt
~~~
</div>

Expand Down
11 changes: 5 additions & 6 deletions cockroachcloud/ccloud-get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The `ccloud quickstart` command will open a browser window to log you in to Cock

In order to use the `ccloud` commands to configure and manage your clusters, you first need to log in to CockroachDB Cloud. Use the `ccloud auth login` command to open a browser window to log in to CockroachDB Cloud.

1. Run the `ccloud auth login` command and hit **Enter** to open a browser window:
1. Run the `ccloud auth login` command and press **Enter** to open a browser window:

{% include_cached copy-clipboard.html %}
~~~ shell
Expand Down Expand Up @@ -332,7 +332,7 @@ ccloud cluster sql --connection-url dim-dog

~~~
∙∙∙ Retrieving cluster info...
postgresql://free-tier7.gcp-us-central1.crdb.io:26257/defaultdb?options=--cluster%3Ddim-dog-1567&sslmode=verify-full&sslrootcert=%2FUsers%2Fuser%2F.postgresql%2Froot.crt
postgresql://dim-dog-147.6wr.cockroachlabs.cloud:26257/defaultdb?sslmode=verify-full&sslrootcert=%2FUsers%2Fuser%2F.postgresql%2Froot.crt
~~~

</section>
Expand All @@ -341,7 +341,7 @@ postgresql://free-tier7.gcp-us-central1.crdb.io:26257/defaultdb?options=--cluste

~~~
∙∙∙ Retrieving cluster info...
postgresql://dim-dog-5bct.gcp-us-east4.crdb.io:26257/defaultdb?sslmode=verify-full&sslrootcert=%2FUsers%2Fuser%2FLibrary%2FCockroachCloud%2Fcerts%2Fdim-dog-ca.crt
postgresql://dim-dog-5bct.gcp-us-east4.cockroachlabs.cloud:26257/defaultdb?sslmode=verify-full&sslrootcert=%2FUsers%2Fuser%2FLibrary%2FCockroachCloud%2Fcerts%2Fdim-dog-ca.crt
~~~

</section>
Expand All @@ -358,8 +358,7 @@ ccloud cluster sql --connection-params dim-dog
~~~
Connection parameters
Database: defaultdb
Host: free-tier7.gcp-us-central1.crdb.io
Options: --cluster=dim-dog-1567
Host: dim-dog-147.6wr.cockroachlabs.cloud
Port: 26257
~~~

Expand All @@ -371,7 +370,7 @@ Connection parameters
∙∙∙ Retrieving cluster info...
Connection parameters
Database: defaultdb
Host: dim-dog-5bct.gcp-us-east4.crdb.io
Host: dim-dog-5bct.gcp-us-east4.cockroachlabs.cloud
Port: 26257
~~~

Expand Down
1 change: 0 additions & 1 deletion cockroachcloud/connect-to-a-serverless-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ For connection examples and code snippets in your language, see the following:
`{host}` | The host on which the CockroachDB node is running.
`{port}` | The port at which the CockroachDB node is listening.
`{database}` | The name of the (existing) database.
`{routing-id}` | Your cluster's routing ID (e.g., `funky-skunk-123`). The routing ID identifies your tenant cluster on a [multi-tenant host](architecture.html).

</section>
<section class="filter-content" markdown="1" data-scope="cockroachdb-client">
Expand Down
4 changes: 2 additions & 2 deletions cockroachcloud/migrate-from-serverless-to-dedicated.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ In {{ site.data.products.serverless }} clusters, all external service integratio
{% include copy-clipboard.html %}
~~~ shell
$ cockroach sql \
--url 'postgres://<username>:<password>@free-tier.<region>.cockroachlabs.cloud:26257?sslmode=verify-full&sslrootcert=<path/to/certs_dir>/cc-ca.crt&options=--cluster=<cluster_name>' \
--url 'postgres://<username>:<password>@<host>:26257?sslmode=verify-full&sslrootcert=<path/to/certs_dir>/cc-ca.crt' \
--execute "SELECT * FROM tpcc.warehouse" --format=csv > /Users/<username>/<path/to/file>/warehouse.csv
~~~

Expand All @@ -43,7 +43,7 @@ Repeat this step for each table you want to migrate. For example, let's export o
{% include copy-clipboard.html %}
~~~ shell
$ cockroach sql \
--url 'postgres://<username>:<password>@free-tier.<region>.cockroachlabs.cloud:26257?sslmode=verify-full&sslrootcert=<path/to/certs_dir>/cc-ca.crt&options=--cluster=<cluster_name>' \
--url 'postgres://<username>:<password>@<cluster-name>.<region code>.cockroachlabs.cloud:26257?sslmode=verify-full&sslrootcert=<path/to/certs_dir>/cc-ca.crt' \
--execute "SELECT * FROM tpcc.district" --format=csv > /Users/<username>/<path/to/file>/district.csv
~~~

Expand Down
4 changes: 2 additions & 2 deletions cockroachcloud/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Select **General connection string**, then copy the connection string displayed
? How would you like to connect? General connection string
Retrieving cluster info: succeeded
Downloading cluster cert to /Users/maxroach/.postgresql/root.crt: succeeded
postgresql://maxroach:ThisIsNotAGoodPassword@free-tier4.aws-us-west-2.cockroachlabs.cloud:26257/defaultdb?options=--cluster%3Ddim-dog-147&sslmode=verify-full&sslrootcert=%2FUsers%2Fmaxroach%2F.postgresql%2Froot.crt
postgresql://maxroach:ThisIsNotAGoodPassword@dim-dog-147.6wr.cockroachlabs.cloud:26257/defaultdb?sslmode=verify-full&sslrootcert=%2FUsers%2Fmaxroach%2F.postgresql%2Froot.crt
~~~

</section>
Expand Down Expand Up @@ -239,7 +239,7 @@ cockroach convert-url --url "<connection-string>"
~~~
...
# Connection URL for JDBC (Java and JVM-based languages):
jdbc:postgresql://{host}:{port}/{database}?options=--cluster%3D{routing-id}&password={password}&sslmode=verify-full&user={username}
jdbc:postgresql://{host}:{port}/{database}?password={password}&sslmode=verify-full&user={username}
~~~

</section>
Expand Down
10 changes: 2 additions & 8 deletions cockroachcloud/troubleshooting-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ Error: x509: certificate signed by unknown authority
Failed running "sql"
~~~

There are two possible causes of this error: incorrect [routing ID](../{{site.versions["cloud"]}}/connect-to-the-database.html#connection-parameters) in the connection string, and CA certificate conflicts in the `cockroach` certificate search path.

<h4>Solution: incorrect routing ID in the connection string</h4>

Check if you are using the right routing ID in the [connection method](connect-to-your-cluster.html#step-3-connect-to-your-cluster). You can find your routing ID in the {{ site.data.products.db }} Console by navigating to **Cluster Overview** > **Connect** > **Select option/language** and select **General connection string**, and then locating the parameter `cluster={routing-id}` in your connection string.

<h4>Solution: CA certificate conflicts</h4>

If you have existing certificates in `~/.cockroach-certs` used to connect to {{ site.data.products.core }} or {{ site.data.products.dedicated }} clusters and are trying to connect to a {{ site.data.products.serverless }} cluster using [`cockroach sql`](../{{site.versions["cloud"]}}/cockroach-sql.html), you need download the CA cert by running the command from the **Cluster Overview** > **Connect** dialog if you have not already done so, and then set the `sslrootcert` parameter in the connection string you use when running `cockroach sql`.
Expand All @@ -52,7 +46,7 @@ For example, on Linux and Mac, set the `sslrootcert` parameter to `$HOME/.postgr

{% include_cached copy-clipboard.html %}
~~~ shell
cockroach sql --url "postgresql://maxroach@free-tier4.aws-us-west-2.cockroachlabs.cloud:26257/defaultdb?sslmode=verify-full&sslrootcert=$HOME/.postgresql/root.crt&options=--cluster%3Ddim-dog-2114"
cockroach sql --url "postgresql://maxroach@dim-dog-147.6wr.cockroachlabs.cloud:26257/defaultdb?sslmode=verify-full&sslrootcert=$HOME/.postgresql/root.crt"
~~~

### Invalid cluster name in a third-party tool
Expand All @@ -65,7 +59,7 @@ FATAL: CodeParamsRoutingFailed: rejected by BackendConfigFromParams: Invalid clu

<h4>Solution</h4>

Check that you are using the correct cluster and database names. You can find these parameters in the {{ site.data.products.db }} Console by navigating to **Cluster Overview** > **Connect** > **Step 2. Connect** > **Connection parameters**. For most tools, the full name of your database should be in the format `<routing-id>.<database>` for {{ site.data.products.serverless }} clusters.
Check that you are using the correct cluster and database names. You can find these parameters in the {{ site.data.products.db }} Console by navigating to **Cluster Overview** > **Connect** > **Step 2. Connect** > **Connection parameters**.

For connection examples with your tool, see [these examples](../stable/third-party-database-tools.html).

Expand Down
Loading

0 comments on commit 81a9fdb

Please sign in to comment.