diff --git a/src/current/_includes/v22.1/connect/connection-url.md b/src/current/_includes/v22.1/connect/connection-url.md new file mode 100644 index 00000000000..ae994bb3047 --- /dev/null +++ b/src/current/_includes/v22.1/connect/connection-url.md @@ -0,0 +1,19 @@ +
+Set a `DATABASE_URL` environment variable to your connection string. + +{% include_cached copy-clipboard.html %} +~~~ shell +export DATABASE_URL="{connection string}" +~~~ + +
+ +
+Set a `DATABASE_URL` environment variable to your connection string. + +{% include_cached copy-clipboard.html %} +~~~ shell +$env:DATABASE_URL = "{connection string}" +~~~ + +
\ No newline at end of file diff --git a/src/current/_includes/v22.1/connect/core-note.md b/src/current/_includes/v22.1/connect/core-note.md new file mode 100644 index 00000000000..7b701cafb80 --- /dev/null +++ b/src/current/_includes/v22.1/connect/core-note.md @@ -0,0 +1,7 @@ +{{site.data.alerts.callout_info}} +The connection information shown on this page uses [client certificate and key authentication]({% link {{ page.version.version }}/authentication.md %}#client-authentication) to connect to a secure, CockroachDB {{ site.data.products.core }} cluster. + +To connect to a CockroachDB {{ site.data.products.core }} cluster with client certificate and key authentication, you must first [generate server and client certificates]({% link {{ page.version.version }}/authentication.md %}#using-digital-certificates-with-cockroachdb). + +For instructions on starting a secure cluster, see [Start a Local Cluster (Secure)]({% link {{ page.version.version }}/secure-a-cluster.md %}). +{{site.data.alerts.end}} diff --git a/src/current/_includes/v22.1/connect/jdbc-connection-url.md b/src/current/_includes/v22.1/connect/jdbc-connection-url.md new file mode 100644 index 00000000000..c055a390b4e --- /dev/null +++ b/src/current/_includes/v22.1/connect/jdbc-connection-url.md @@ -0,0 +1,19 @@ +Set a `JDBC_DATABASE_URL` environment variable to your JDBC connection string. + +
+ +{% include_cached copy-clipboard.html %} +~~~ shell +export JDBC_DATABASE_URL="{connection string}" +~~~ + +
+ +
+ +{% include_cached copy-clipboard.html %} +~~~ shell +$env:JDBC_DATABASE_URL = "{connection string}" +~~~ + +
diff --git a/src/current/_includes/v22.1/core-note.md b/src/current/_includes/v22.1/core-note.md new file mode 100644 index 00000000000..7b701cafb80 --- /dev/null +++ b/src/current/_includes/v22.1/core-note.md @@ -0,0 +1,7 @@ +{{site.data.alerts.callout_info}} +The connection information shown on this page uses [client certificate and key authentication]({% link {{ page.version.version }}/authentication.md %}#client-authentication) to connect to a secure, CockroachDB {{ site.data.products.core }} cluster. + +To connect to a CockroachDB {{ site.data.products.core }} cluster with client certificate and key authentication, you must first [generate server and client certificates]({% link {{ page.version.version }}/authentication.md %}#using-digital-certificates-with-cockroachdb). + +For instructions on starting a secure cluster, see [Start a Local Cluster (Secure)]({% link {{ page.version.version }}/secure-a-cluster.md %}). +{{site.data.alerts.end}} diff --git a/src/current/_includes/v22.1/faq/what-is-crdb.md b/src/current/_includes/v22.1/faq/what-is-crdb.md new file mode 100644 index 00000000000..28857ed61fa --- /dev/null +++ b/src/current/_includes/v22.1/faq/what-is-crdb.md @@ -0,0 +1,7 @@ +CockroachDB is a [distributed SQL](https://www.cockroachlabs.com/blog/what-is-distributed-sql/) database built on a transactional and strongly-consistent key-value store. It **scales** horizontally; **survives** disk, machine, rack, and even datacenter failures with minimal latency disruption and no manual intervention; supports **strongly-consistent** ACID transactions; and provides a familiar **SQL** API for structuring, manipulating, and querying data. + +CockroachDB is inspired by Google's [Spanner](http://research.google.com/archive/spanner.html) and [F1](http://research.google.com/pubs/pub38125.html) technologies, and the [source code](https://github.com/cockroachdb/cockroach) is freely available. + +{{site.data.alerts.callout_success}} +For a deeper dive into CockroachDB's capabilities and how it fits into the database landscape, take the free [**Intro to Distributed SQL and CockroachDB**](https://university.cockroachlabs.com/courses/course-v1:crl+intro-to-distributed-sql-and-cockroachdb+self-paced/about) course on Cockroach University. +{{site.data.alerts.end}} \ No newline at end of file diff --git a/src/current/_includes/v22.1/jdbc-connection-url.md b/src/current/_includes/v22.1/jdbc-connection-url.md new file mode 100644 index 00000000000..c055a390b4e --- /dev/null +++ b/src/current/_includes/v22.1/jdbc-connection-url.md @@ -0,0 +1,19 @@ +Set a `JDBC_DATABASE_URL` environment variable to your JDBC connection string. + +
+ +{% include_cached copy-clipboard.html %} +~~~ shell +export JDBC_DATABASE_URL="{connection string}" +~~~ + +
+ +
+ +{% include_cached copy-clipboard.html %} +~~~ shell +$env:JDBC_DATABASE_URL = "{connection string}" +~~~ + +
diff --git a/src/current/v22.1/connect-to-the-database.md b/src/current/v22.1/connect-to-the-database.md index 29d085f32ad..7f16cbfd273 100644 --- a/src/current/v22.1/connect-to-the-database.md +++ b/src/current/v22.1/connect-to-the-database.md @@ -5,30 +5,40 @@ toc: true docs_area: develop --- -This page documents the required connection configuration for [fully-supported third-party tools](third-party-database-tools.html). +This page documents the required connection configuration for [fully-supported third-party tools]({% link {{ page.version.version }}/third-party-database-tools.md %}). -For a list of all supported cluster connection parameters, see the [`cockroach` Connection Parameters](connection-parameters.html). +For a list of all supported cluster connection parameters, see the [`cockroach` Connection Parameters]({% link {{ page.version.version }}/connection-parameters.md %}). -For a list of community-supported third-party tools, see [Third-Party Tools Supported by the Community](community-tooling.html). CockroachDB supports both native drivers and the PostgreSQL wire protocol. Most client drivers and ORM frameworks connect to CockroachDB like they connect to PostgreSQL. +For a list of community-supported third-party tools, see [Third-Party Tools Supported by the Community]({% link {{ page.version.version }}/community-tooling.md %}). CockroachDB supports both native drivers and the PostgreSQL wire protocol. Most client drivers and ORM frameworks connect to CockroachDB like they connect to PostgreSQL. -
+## Step 1. Select your deployment -{{site.data.alerts.callout_info}} -The connection information shown on this page uses [client certificate and key authentication](authentication.html#client-authentication) to connect to a secure, CockroachDB {{ site.data.products.core }} cluster. +
+ + + +
-To connect to a CockroachDB {{ site.data.products.core }} cluster with client certificate and key authentication, you must first [generate server and client certificates](authentication.html#using-digital-certificates-with-cockroachdb). +
+To connect to a CockroachDB {{ site.data.products.cloud }} cluster, you need a general connection string or connection parameters, which include the username, host, database, and port. To find these, open the **Connect** dialog for your cluster in the [CockroachDB {{ site.data.products.cloud }} Console](https://cockroachlabs.cloud) and select either **General connection string** or **Parameters only** as the option. +
-For instructions on starting a secure cluster, see [Start a Local Cluster (Secure)](secure-a-cluster.html). -{{site.data.alerts.end}} +
+To connect to a CockroachDB {{ site.data.products.core }} cluster, you need the [general connection string]({% link {{ page.version.version }}/connection-parameters.md %}#connect-using-a-url) or [connection parameters]({% link {{ page.version.version }}/connection-parameters.md %}#connect-using-discrete-parameters) for your cluster. +The connection strings and parameters for your cluster are output when you [start the cluster]({% link {{ page.version.version }}/cockroach-start.md %}#standard-output).
+## Step 2. Select your OS +
- - - + + +
+## Step 3. Select your language +
@@ -37,14 +47,100 @@ For instructions on starting a secure cluster, see [Start a Local Cluster (Secur
-
+## Step 4. Select your driver or ORM +
+
+ +
+
+ + + + +
+
+ +
+
+ + + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +## Step 5. Connect to the cluster + +
+
+ +{% include {{ page.version.version }}/connect/connection-url.md %} + +
+
+ +
+
+ +{% include {{ page.version.version }}/connect/connection-url.md %} + +
+
+ +
+
+ +{% include {{ page.version.version }}/connect/connection-url.md %} + +
+
+ +
+
+ +{% include {{ page.version.version }}/connect/connection-url.md %} + +
+
+ +
+ +
+The **Connect to cluster** dialog shows information about how to connect to your cluster. + +1. Select **Java** from the **Select option** dropdown. +1. Copy the `JDBC_DATABASE_URL` environment variable command provided and save it in a secure location. +
+ +
+Copy the JDBC connection string from the `sql (JDBC)` field in the output from when you started the cluster. +
+ +{% include {{ page.version.version }}/connect/jdbc-connection-url.md %} + +
+ +
@@ -65,7 +161,7 @@ Where `DATABASE_URL` is an environment variable set to a valid CockroachDB conne node-postgres accepts the following format for CockroachDB connection strings: -
+
{% include_cached copy-clipboard.html %} ~~~ @@ -74,7 +170,7 @@ postgresql://:@:/?sslmode=verify-full
-
+
{% include_cached copy-clipboard.html %} ~~~ @@ -90,6 +186,8 @@ postgresql://:@:/?sslmode=verify-full& postgresql://@:/?sslmode=verify-full&sslrootcert=&sslcert=&sslkey= ~~~ +{% include {{ page.version.version }}/connect/core-note.md %} +
For more information about connecting with node-postgres, see the [official node-postgres documentation](https://node-postgres.com/features/connecting). @@ -114,7 +212,7 @@ Where `DATABASE_URL` is an environment variable set to a valid CockroachDB conne Sequelize accepts the following format for CockroachDB connection strings: -
+
{% include_cached copy-clipboard.html %} ~~~ @@ -123,7 +221,7 @@ postgresql://:@:/?sslmode=verify-full
-
+
{% include_cached copy-clipboard.html %} ~~~ @@ -139,6 +237,8 @@ postgresql://:@:/?sslmode=verify-full& postgresql://@:/?sslmode=verify-full&sslrootcert=&sslcert=&sslkey= ~~~ +{% include {{ page.version.version }}/connect/core-note.md %} +
{{site.data.alerts.callout_info}} @@ -159,9 +259,9 @@ For example, suppose that you are defining the `DataSource` for your application
-
+
-CockroachDB {{ site.data.products.serverless }} requires you to specify the `type`, `url`, and `ssl` properties: +CockroachDB {{ site.data.products.basic }} and {{ site.data.products.standard }} requires you to specify the `type`, `url`, and `ssl` properties: {% include_cached copy-clipboard.html %} ~~~ ts @@ -186,9 +286,9 @@ postgresql://:@:/
-
+
-CockroachDB {{ site.data.products.dedicated }} requires you to specify the `type`, `url`, and `ssl` properties: +CockroachDB {{ site.data.products.advanced }} requires you to specify the `type`, `url`, and `ssl` properties: {% include_cached copy-clipboard.html %} ~~~ ts @@ -207,7 +307,7 @@ export const AppDataSource = new DataSource({ Where: - `DATABASE_URL` is an environment variable set to a valid CockroachDB connection string. -- `CA_CERT` is an environment variable set to the root certificate [downloaded from the CockroachDB Cloud Console](../cockroachcloud/authentication.html#node-identity-verification). +- `CA_CERT` is an environment variable set to the root certificate [downloaded from the CockroachDB Cloud Console]({% link cockroachcloud/authentication.md %}#node-identity-verification). TypeORM accepts the following format for CockroachDB connection strings: @@ -241,9 +341,11 @@ export const AppDataSource = new DataSource({ Where: - `DATABASE_URL` is an environment variable set to a valid CockroachDB connection string. -- `CA_CERT` is an environment variable set to the root certificate.
You can generate this certificate with [`cockroach cert create-ca`](cockroach-cert.html#subcommands), or you can use a [custom CA cert](create-security-certificates-custom-ca.html). -- `CLIENT_KEY` is an environment variable set to the [client key](cockroach-cert.html#client-key-and-certificates) for the user connecting to the cluster.
You can generate this key with [`cockroach cert create-client`](cockroach-cert.html#subcommands). -- `CLIENT_CERT` is an environment variable set to the [client certificate](cockroach-cert.html#client-key-and-certificates) for the user connecting to the cluster.
You can generate this certificate with [`cockroach cert create-client`](cockroach-cert.html#subcommands). +- `CA_CERT` is an environment variable set to the root certificate.
You can generate this certificate with [`cockroach cert create-ca`]({% link {{ page.version.version }}/cockroach-cert.md %}#subcommands), or you can use a [custom CA cert]({% link {{ page.version.version }}/create-security-certificates-custom-ca.md %}). +- `CLIENT_KEY` is an environment variable set to the [client key]({% link {{ page.version.version }}/cockroach-cert.md %}#client-key-and-certificates) for the user connecting to the cluster.
You can generate this key with [`cockroach cert create-client`]({% link {{ page.version.version }}/cockroach-cert.md %}#subcommands). +- `CLIENT_CERT` is an environment variable set to the [client certificate]({% link {{ page.version.version }}/cockroach-cert.md %}#client-key-and-certificates) for the user connecting to the cluster.
You can generate this certificate with [`cockroach cert create-client`]({% link {{ page.version.version }}/cockroach-cert.md %}#subcommands). + +{% include {{ page.version.version }}/connect/core-note.md %} TypeORM accepts the following format for CockroachDB connection strings: @@ -294,7 +396,7 @@ Where `DATABASE_URL` is an environment variable set to a valid CockroachDB conne Prisma accepts the following format for CockroachDB connection strings: -
+
{% include_cached copy-clipboard.html %} ~~~ @@ -303,10 +405,10 @@ postgresql://:@:/?sslmode=verify-full
-
+
{% include_cached copy-clipboard.html %} -~~~ +~~~ postgresql://:@:/?sslmode=verify-full&sslrootcert= ~~~ @@ -315,10 +417,12 @@ postgresql://:@:/?sslmode=verify-full&
{% include_cached copy-clipboard.html %} -~~~ +~~~ postgresql://@:/?sslmode=verify-full&sslrootcert=&sslcert=&sslkey= ~~~ +{% include {{ page.version.version }}/connect/core-note.md %} +
For more information about connecting with Prisma, see the [official Prisma documentation](https://www.prisma.io/cockroachdb). @@ -327,11 +431,11 @@ For more information about connecting with Prisma, see the [official Prisma docu ## Connection parameters -
+
Parameter | Description ----------|------------ -`` | The [SQL user](security-reference/authorization.html#sql-users) connecting to the cluster. +`` | The [SQL user]({% link {{ page.version.version }}/security-reference/authorization.md %}#sql-users) connecting to the cluster. `` | The password for the SQL user connecting to the cluster. `` | The host on which the CockroachDB node is running. `` | The port at which the CockroachDB node is listening. @@ -339,16 +443,16 @@ Parameter | Description
-
+
Parameter | Description ----------|------------ -`` | The [SQL user](security-reference/authorization.html#sql-users) connecting to the cluster. +`` | The [SQL user]({% link {{ page.version.version }}/security-reference/authorization.md %}#sql-users) connecting to the cluster. `` | The password for the SQL user connecting to the cluster. `` | The host on which the CockroachDB node is running. `` | The port at which the CockroachDB node is listening. `` | The name of the (existing) database. -`` | The path to the root certificate that you [downloaded from the CockroachDB Cloud Console](../cockroachcloud/authentication.html#node-identity-verification). +`` | The path to the root certificate that you [downloaded from the CockroachDB Cloud Console]({% link cockroachcloud/authentication.md %}#node-identity-verification).
@@ -356,32 +460,26 @@ Parameter | Description Parameter | Description ----------|------------ -`` | The [SQL user](security-reference/authorization.html#sql-users) connecting to the cluster. +`` | The [SQL user]({% link {{ page.version.version }}/security-reference/authorization.md %}#sql-users) connecting to the cluster. `` | The host on which the CockroachDB node is running. `` | The port at which the CockroachDB node is listening. `` | The name of the (existing) database. -`` | The path to the root certificate.
You can generate this certificate with [`cockroach cert create-ca`](cockroach-cert.html#subcommands), or you can use a [custom CA cert](create-security-certificates-custom-ca.html). -`` | The path to the [client certificate](cockroach-cert.html#client-key-and-certificates) for the user connecting to the cluster.
You can generate this certificate with [`cockroach cert create-client`](cockroach-cert.html#subcommands). -`` | The path to the [client key](cockroach-cert.html#client-key-and-certificates) for the user connecting to the cluster.
You can generate this key with [`cockroach cert create-client`](cockroach-cert.html#subcommands). +`` | The path to the root certificate.
You can generate this certificate with [`cockroach cert create-ca`]({% link {{ page.version.version }}/cockroach-cert.md %}#subcommands), or you can use a [custom CA cert]({% link {{ page.version.version }}/create-security-certificates-custom-ca.md %}). +`` | The path to the [client certificate]({% link {{ page.version.version }}/cockroach-cert.md %}#client-key-and-certificates) for the user connecting to the cluster.
You can generate this certificate with [`cockroach cert create-client`]({% link {{ page.version.version }}/cockroach-cert.md %}#subcommands). +`` | The path to the [client key]({% link {{ page.version.version }}/cockroach-cert.md %}#client-key-and-certificates) for the user connecting to the cluster.
You can generate this key with [`cockroach cert create-client`]({% link {{ page.version.version }}/cockroach-cert.md %}#subcommands). -
+{% include {{ page.version.version }}/connect/core-note.md %}
-
- -
- - - -
+
-
+
{{site.data.alerts.callout_info}} -To connect to a CockroachDB {{ site.data.products.serverless }} cluster from a Python application, you must have a valid CA certificate located at ~/.postgresql/root.crt.
For instructions on downloading a CA certificate from the CockroachDB {{ site.data.products.cloud }} Console, see Connect to a CockroachDB {{ site.data.products.serverless }} Cluster. +To connect to a CockroachDB {{ site.data.products.basic }} or {{ site.data.products.standard }} cluster from a Python application, you must have a valid CA certificate located at ~/.postgresql/root.crt.
For instructions on downloading a CA certificate from the CockroachDB {{ site.data.products.cloud }} Console, see [Connect to a CockroachDB {{ site.data.products.basic }} Cluster]({% link cockroachcloud/connect-to-a-basic-cluster.md %}) or [Connect to a CockroachDB {{ site.data.products.standard }} Cluster]({% link cockroachcloud/connect-to-your-cluster.md %}. {{site.data.alerts.end}}
@@ -404,7 +502,7 @@ Where `DATABASE_URL` is an environment variable set to a valid CockroachDB conne Psycopg2 accepts the following format for CockroachDB connection strings: -
+
{% include_cached copy-clipboard.html %} ~~~ @@ -413,7 +511,7 @@ postgresql://{username}:{password}@{host}:{port}/{database}?sslmode=verify-full
-
+
{% include_cached copy-clipboard.html %} ~~~ @@ -429,6 +527,8 @@ postgresql://{username}:{password}@{host}:{port}/{database}?sslmode=verify-full& postgresql://{username}@{host}:{port}/{database}?sslmode=verify-full&sslrootcert={root-cert}&sslcert={client-cert}&sslkey={client-key} ~~~ +{% include {{ page.version.version }}/connect/core-note.md %} +
For more information about connecting with Psycopg, see the [official Psycopg documentation](https://www.psycopg.org/docs). @@ -454,7 +554,7 @@ Where `DATABASE_URL` is an environment variable set to a valid CockroachDB conne Psycopg accepts the following format for CockroachDB connection strings: -
+
{% include_cached copy-clipboard.html %} ~~~ @@ -463,7 +563,7 @@ postgresql://{username}:{password}@{host}:{port}/{database}?sslmode=verify-full
-
+
{% include_cached copy-clipboard.html %} ~~~ @@ -479,6 +579,8 @@ postgresql://{username}:{password}@{host}:{port}/{database}?sslmode=verify-full& postgresql://{username}@{host}:{port}/{database}?sslmode=verify-full&sslrootcert={root-cert}&sslcert={client-cert}&sslkey={client-key} ~~~ +{% include {{ page.version.version }}/connect/core-note.md %} +
For more information about connecting with Psycopg, see the [official Psycopg documentation](https://www.psycopg.org/psycopg3/docs/basic/index.html). @@ -487,7 +589,7 @@ For more information about connecting with Psycopg, see the [official Psycopg do
-To connect to CockroachDB with [SQLAlchemy](http://docs.sqlalchemy.org/en/latest/), [create an `Engine` object](https://docs.sqlalchemy.org/en/14/core/engines.html) by passing the connection string to the `create_engine` function. +To connect to CockroachDB with [SQLAlchemy](http://docs.sqlalchemy.org/), [create an `Engine` object](https://docs.sqlalchemy.org/core/engines.html) by passing the connection string to the `create_engine` function. For example: @@ -504,7 +606,7 @@ Where `DATABASE_URL` is an environment variable set to a valid CockroachDB conne SQLAlchemy accepts the following format for CockroachDB connection strings: -
+
{% include_cached copy-clipboard.html %} ~~~ @@ -513,7 +615,7 @@ cockroachdb://{username}:{password}@{host}:{port}/{database}?sslmode=verify-full
-
+
{% include_cached copy-clipboard.html %} ~~~ @@ -529,13 +631,26 @@ cockroachdb://{username}:{password}@{host}:{port}/{database}?sslmode=verify-full cockroachdb://{username}@{host}:{port}/{database}?sslmode=verify-full&sslrootcert={root-cert}&sslcert={client-cert}&sslkey={client-key} ~~~ +{% include {{ page.version.version }}/connect/core-note.md %} +
{{site.data.alerts.callout_info}} To connect to CockroachDB with SQLAlchemy, you must install the [CockroachDB SQLAlchemy adapter](https://github.com/cockroachdb/sqlalchemy-cockroachdb). {{site.data.alerts.end}} -For more information about connecting with SQLAlchemy, see the [official SQLAlchemy documentation](https://docs.sqlalchemy.org/en/14/core/engines_connections.html). +For more information about connecting with SQLAlchemy, see the [official SQLAlchemy documentation](https://docs.sqlalchemy.org/core/engines_connections.html). + +{{site.data.alerts.callout_info}} +In order for SQLAlchemy to use the CockroachDB adapter, the connection string must begin with `cockroachdb://`. You can use the following code to modify the general connection string, which begins with `postgresql://`, to the format that works with SQLAlchemy and the CockroachDB adapter: + +{% include_cached copy-clipboard.html %} +~~~ python +engine = create_engine(os.environ['DATABASE_URL'].replace("postgresql://", "cockroachdb://")) +engine.connect() +~~~ + +{{site.data.alerts.end}}
@@ -549,7 +664,7 @@ Django accepts the following format for CockroachDB connection information:
-
+
{% include_cached copy-clipboard.html %} ~~~ @@ -576,7 +691,7 @@ DATABASES = {
-
+
{% include_cached copy-clipboard.html %} ~~~ @@ -631,6 +746,8 @@ DATABASES = { ... ~~~ +{% include {{ page.version.version }}/connect/core-note.md %} +
{{site.data.alerts.callout_info}} @@ -643,11 +760,11 @@ For more information about connecting with Django, see the [official Django docu ## Connection parameters -
+
Parameter | Description ----------|------------ -`{username}` | The [SQL user](security-reference/authorization.html#sql-users) connecting to the cluster. +`{username}` | The [SQL user]({% link {{ page.version.version }}/security-reference/authorization.md %}#sql-users) connecting to the cluster. `{password}` | The password for the SQL user connecting to the cluster. `{host}` | The host on which the CockroachDB node is running. `{port}` | The port at which the CockroachDB node is listening. @@ -655,16 +772,16 @@ Parameter | Description
-
+
Parameter | Description ----------|------------ -`{username}` | The [SQL user](security-reference/authorization.html#sql-users) connecting to the cluster. +`{username}` | The [SQL user]({% link {{ page.version.version }}/security-reference/authorization.md %}#sql-users) connecting to the cluster. `{password}` | The password for the SQL user connecting to the cluster. `{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. -`{root-cert}` | The path to the root certificate that you [downloaded from the CockroachDB Cloud Console](../cockroachcloud/authentication.html#node-identity-verification). +`{root-cert}` | The path to the root certificate that you [downloaded from the CockroachDB Cloud Console]({% link cockroachcloud/authentication.md %}#node-identity-verification).
@@ -672,13 +789,15 @@ Parameter | Description Parameter | Description ----------|------------ -`{username}` | The [SQL user](security-reference/authorization.html#sql-users) connecting to the cluster. +`{username}` | The [SQL user]({% link {{ page.version.version }}/security-reference/authorization.md %}#sql-users) connecting to the cluster. `{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. -`{root-cert}` | The path to the root certificate.
You can generate this certificate with [`cockroach cert create-ca`](cockroach-cert.html#subcommands), or you can use a [custom CA cert](create-security-certificates-custom-ca.html). -`{client-cert}` | The path to the [client certificate](cockroach-cert.html#client-key-and-certificates) for the user connecting to the cluster.
You can generate this certificate with [`cockroach cert create-client`](cockroach-cert.html#subcommands). -`{client-key}` | The path to the [client key](cockroach-cert.html#client-key-and-certificates) for the user connecting to the cluster.
You can generate this key with [`cockroach cert create-client`](cockroach-cert.html#subcommands). +`{root-cert}` | The path to the root certificate.
You can generate this certificate with [`cockroach cert create-ca`]({% link {{ page.version.version }}/cockroach-cert.md %}#subcommands), or you can use a [custom CA cert]({% link {{ page.version.version }}/create-security-certificates-custom-ca.md %}). +`{client-cert}` | The path to the [client certificate]({% link {{ page.version.version }}/cockroach-cert.md %}#client-key-and-certificates) for the user connecting to the cluster.
You can generate this certificate with [`cockroach cert create-client`]({% link {{ page.version.version }}/cockroach-cert.md %}#subcommands). +`{client-key}` | The path to the [client key]({% link {{ page.version.version }}/cockroach-cert.md %}#client-key-and-certificates) for the user connecting to the cluster.
You can generate this key with [`cockroach cert create-client`]({% link {{ page.version.version }}/cockroach-cert.md %}#subcommands). + +{% include {{ page.version.version }}/connect/core-note.md %}
@@ -686,12 +805,6 @@ Parameter | Description
-
- - - -
-
To connect to CockroachDB with [pgx](https://github.com/jackc/pgx), use the `pgx.Connect` function. @@ -720,7 +833,7 @@ func main() { pgx accepts the following format for CockroachDB connection strings: -
+
{% include_cached copy-clipboard.html %} ~~~ @@ -729,7 +842,7 @@ postgresql://{username}:{password}@{host}:{port}/{database}?sslmode=verify-full
-
+
{% include_cached copy-clipboard.html %} ~~~ @@ -745,6 +858,8 @@ postgresql://{username}:{password}@{host}:{port}/{database}?sslmode=verify-full& postgresql://{username}@{host}:{port}/{database}?sslmode=verify-full&sslrootcert={root-cert}&sslcert={client-cert}&sslkey={client-key} ~~~ +{% include {{ page.version.version }}/connect/core-note.md %} +
For more information about connecting with pgx, see the [official pgx documentation](https://pkg.go.dev/github.com/jackc/pgx). @@ -779,7 +894,7 @@ func main() { pq accepts the following format for CockroachDB connection strings: -
+
{% include_cached copy-clipboard.html %} ~~~ @@ -788,7 +903,7 @@ postgresql://{username}:{password}@{host}:{port}/{database}?sslmode=verify-full
-
+
{% include_cached copy-clipboard.html %} ~~~ @@ -804,6 +919,8 @@ postgresql://{username}:{password}@{host}:{port}/{database}?sslmode=verify-full& postgresql://{username}@{host}:{port}/{database}?sslmode=verify-full&sslrootcert={root-cert}&sslcert={client-cert}&sslkey={client-key} ~~~ +{% include {{ page.version.version }}/connect/core-note.md %} +
For more information about connecting with pq, see the [official pq documentation](https://pkg.go.dev/github.com/lib/pq). @@ -838,7 +955,7 @@ func main() { GORM accepts the following format for CockroachDB connection strings: -
+
{% include_cached copy-clipboard.html %} ~~~ @@ -847,7 +964,7 @@ postgresql://{username}:{password}@{host}:{port}/{database}?sslmode=verify-full
-
+
{% include_cached copy-clipboard.html %} ~~~ @@ -863,6 +980,8 @@ postgresql://{username}:{password}@{host}:{port}/{database}?sslmode=verify-full& postgresql://{username}@{host}:{port}/{database}?sslmode=verify-full&sslrootcert={root-cert}&sslcert={client-cert}&sslkey={client-key} ~~~ +{% include {{ page.version.version }}/connect/core-note.md %} +
For more information about connecting with GORM, see the [official GORM documentation](https://gorm.io/docs). @@ -871,11 +990,11 @@ For more information about connecting with GORM, see the [official GORM document ## Connection parameters -
+
Parameter | Description ----------|------------ -`{username}` | The [SQL user](security-reference/authorization.html#sql-users) connecting to the cluster. +`{username}` | The [SQL user]({% link {{ page.version.version }}/security-reference/authorization.md %}#sql-users) connecting to the cluster. `{password}` | The password for the SQL user connecting to the cluster. `{host}` | The host on which the CockroachDB node is running. `{port}` | The port at which the CockroachDB node is listening. @@ -883,16 +1002,16 @@ Parameter | Description
-
+
Parameter | Description ----------|------------ -`{username}` | The [SQL user](security-reference/authorization.html#sql-users) connecting to the cluster. +`{username}` | The [SQL user]({% link {{ page.version.version }}/security-reference/authorization.md %}#sql-users) connecting to the cluster. `{password}` | The password for the SQL user connecting to the cluster. `{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. -`{root-cert}` | The path to the root certificate that you [downloaded from the CockroachDB Cloud Console](../cockroachcloud/authentication.html#node-identity-verification). +`{root-cert}` | The path to the root certificate that you [downloaded from the CockroachDB Cloud Console]({% link cockroachcloud/authentication.md %}#node-identity-verification).
@@ -900,25 +1019,21 @@ Parameter | Description Parameter | Description ----------|------------ -`{username}` | The [SQL user](security-reference/authorization.html#sql-users) connecting to the cluster. +`{username}` | The [SQL user]({% link {{ page.version.version }}/security-reference/authorization.md %}#sql-users) connecting to the cluster. `{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. -`{root-cert}` | The path to the root certificate.
You can generate this certificate with [`cockroach cert create-ca`](cockroach-cert.html#subcommands), or you can use a [custom CA cert](create-security-certificates-custom-ca.html). -`{client-cert}` | The path to the [client certificate](cockroach-cert.html#client-key-and-certificates) for the user connecting to the cluster.
You can generate this certificate with [`cockroach cert create-client`](cockroach-cert.html#subcommands). -`{client-key}` | The path to the [client key](cockroach-cert.html#client-key-and-certificates) for the user connecting to the cluster.
You can generate this key with [`cockroach cert create-client`](cockroach-cert.html#subcommands). +`{root-cert}` | The path to the root certificate.
You can generate this certificate with [`cockroach cert create-ca`]({% link {{ page.version.version }}/cockroach-cert.md %}#subcommands), or you can use a [custom CA cert]({% link {{ page.version.version }}/create-security-certificates-custom-ca.md %}). +`{client-cert}` | The path to the [client certificate]({% link {{ page.version.version }}/cockroach-cert.md %}#client-key-and-certificates) for the user connecting to the cluster.
You can generate this certificate with [`cockroach cert create-client`]({% link {{ page.version.version }}/cockroach-cert.md %}#subcommands). +`{client-key}` | The path to the [client key]({% link {{ page.version.version }}/cockroach-cert.md %}#client-key-and-certificates) for the user connecting to the cluster.
You can generate this key with [`cockroach cert create-client`]({% link {{ page.version.version }}/cockroach-cert.md %}#subcommands). -
+{% include {{ page.version.version }}/connect/core-note.md %}
-
- -
- -
+
@@ -936,7 +1051,7 @@ Where `JDBC_DATABASE_URL` is an environment variable set to a valid JDBC-compati JDBC accepts the following format for CockroachDB connection strings: -
+
{% include_cached copy-clipboard.html %} ~~~ @@ -945,7 +1060,7 @@ jdbc:postgresql://{host}:{port}/{database}?password={password}&sslmode=verify-fu
-
+
{% include_cached copy-clipboard.html %} ~~~ @@ -961,6 +1076,8 @@ jdbc:postgresql://{host}:{port}/{database}?user={username}&password={password}&s jdbc:postgresql://{host}:{port}/{database}?user={username}&sslmode=verify-full&sslrootcert={root-cert}&sslcert={client-cert}&sslkey={client-key} ~~~ +{% include {{ page.version.version }}/connect/core-note.md %} +
For more information about connecting with JDBC, see the [official JDBC documentation](https://jdbc.postgresql.org/documentation/). @@ -991,7 +1108,7 @@ Where `DATABASE_URL` is an environment variable set to a valid CockroachDB conne Hibernate accepts the following format for CockroachDB connection strings: -
+
{% include_cached copy-clipboard.html %} ~~~ @@ -1000,7 +1117,7 @@ jdbc:postgresql://{host}:{port}/{database}?password={password}&sslmode=verify-fu
-
+
{% include_cached copy-clipboard.html %} ~~~ @@ -1016,10 +1133,12 @@ jdbc:postgresql://{host}:{port}/{database}?user={username}&password={password}&s jdbc:postgresql://{host}:{port}/{database}?user={username}&sslmode=verify-full&sslrootcert={root-cert}&sslcert={client-cert}&sslkey={client-key} ~~~ +{% include {{ page.version.version }}/connect/core-note.md %} +
{{site.data.alerts.callout_info}} -To connect to CockroachDB with Hibernate, you must specify the [CockroachDB Hibernate dialect](install-client-drivers.html?filters=java#hibernate) in your `hibernate.cfg.xml` configuration file. +To connect to CockroachDB with Hibernate, you must specify the [CockroachDB Hibernate dialect]({% link {{ page.version.version }}/install-client-drivers.md %}?filters=java#hibernate) in your `hibernate.cfg.xml` configuration file. {{site.data.alerts.end}} For more information about connecting with Hibernate, see the [official Hibernate documentation](https://hibernate.org/orm/documentation). @@ -1028,11 +1147,11 @@ For more information about connecting with Hibernate, see the [official Hibernat ## Connection parameters -
+
Parameter | Description ----------|------------ -`{username}` | The [SQL user](security-reference/authorization.html#sql-users) connecting to the cluster. +`{username}` | The [SQL user]({% link {{ page.version.version }}/security-reference/authorization.md %}#sql-users) connecting to the cluster. `{password}` | The password for the SQL user connecting to the cluster. `{host}` | The host on which the CockroachDB node is running. `{port}` | The port at which the CockroachDB node is listening. @@ -1040,16 +1159,16 @@ Parameter | Description
-
+
Parameter | Description ----------|------------ -`{username}` | The [SQL user](security-reference/authorization.html#sql-users) connecting to the cluster. +`{username}` | The [SQL user]({% link {{ page.version.version }}/security-reference/authorization.md %}#sql-users) connecting to the cluster. `{password}` | The password for the SQL user connecting to the cluster. `{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. -`{root-cert}` | The [URL-encoded](https://en.wikipedia.org/wiki/Percent-encoding) path to the root certificate that you [downloaded from the CockroachDB Cloud Console](../cockroachcloud/authentication.html#node-identity-verification). +`{root-cert}` | The [URL-encoded](https://wikipedia.org/wiki/Percent-encoding) path to the root certificate that you [downloaded from the CockroachDB Cloud Console]({% link cockroachcloud/authentication.md %}#node-identity-verification).
@@ -1057,13 +1176,15 @@ Parameter | Description Parameter | Description ----------|------------ -`{username}` | The [SQL user](security-reference/authorization.html#sql-users) connecting to the cluster. +`{username}` | The [SQL user]({% link {{ page.version.version }}/security-reference/authorization.md %}#sql-users) connecting to the cluster. `{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. -`{root-cert}` | The [URL-encoded](https://en.wikipedia.org/wiki/Percent-encoding) path to the root certificate.
You can generate this certificate with [`cockroach cert create-ca`](cockroach-cert.html#subcommands), or you can use a [custom CA cert](create-security-certificates-custom-ca.html). -`{client-cert}` | The [URL-encoded](https://en.wikipedia.org/wiki/Percent-encoding) path to the [client certificate](cockroach-cert.html#client-key-and-certificates) for the user connecting to the cluster.
You can generate this certificate with [`cockroach cert create-client`](cockroach-cert.html#subcommands). -`{client-key}` | The [URL-encoded](https://en.wikipedia.org/wiki/Percent-encoding) path to the [PKCS#8](https://tools.ietf.org/html/rfc5208)-formatted [client key](cockroach-cert.html#client-key-and-certificates) for the user connecting to the cluster.
You can generate this key with [`cockroach cert create-client --also-generate-pkcs8-key`](cockroach-cert.html#subcommands). +`{root-cert}` | The [URL-encoded](https://wikipedia.org/wiki/Percent-encoding) path to the root certificate.
You can generate this certificate with [`cockroach cert create-ca`]({% link {{ page.version.version }}/cockroach-cert.md %}#subcommands), or you can use a [custom CA cert]({% link {{ page.version.version }}/create-security-certificates-custom-ca.md %}). +`{client-cert}` | The [URL-encoded](https://wikipedia.org/wiki/Percent-encoding) path to the [client certificate]({% link {{ page.version.version }}/cockroach-cert.md %}#client-key-and-certificates) for the user connecting to the cluster.
You can generate this certificate with [`cockroach cert create-client`]({% link {{ page.version.version }}/cockroach-cert.md %}#subcommands). +`{client-key}` | The [URL-encoded](https://wikipedia.org/wiki/Percent-encoding) path to the [PKCS#8](https://tools.ietf.org/html/rfc5208)-formatted [client key]({% link {{ page.version.version }}/cockroach-cert.md %}#client-key-and-certificates) for the user connecting to the cluster.
You can generate this key with [`cockroach cert create-client --also-generate-pkcs8-key`]({% link {{ page.version.version }}/cockroach-cert.md %}#subcommands). + +{% include {{ page.version.version }}/connect/core-note.md %}
@@ -1071,13 +1192,8 @@ Parameter | Description
-
- - -
- {{site.data.alerts.callout_info}} -To connect to a CockroachDB {{ site.data.products.serverless }} cluster from a Ruby application, you must have a valid CA certificate located at ~/.postgresql/root.crt.
For instructions on downloading a CA certificate from the CockroachDB {{ site.data.products.cloud }} Console, see Connect to a CockroachDB {{ site.data.products.serverless }} Cluster. +To connect to a CockroachDB {{ site.data.products.basic }} or {{ site.data.products.standard }} cluster from a Ruby application, you must have a valid CA certificate located at `~/.postgresql/root.crt`.For instructions on downloading a CA certificate from the CockroachDB {{ site.data.products.cloud }} Console, see [Connect to a CockroachDB {{ site.data.products.basic }} Cluster]({% link cockroachcloud/connect-to-a-basic-cluster.md %}) or [Connect to a CockroachDB {{ site.data.products.standard }} Cluster]({% link cockroachcloud/connect-to-your-cluster.md %}). {{site.data.alerts.end}}
@@ -1099,7 +1215,7 @@ Where `DATABASE_URL` is an environment variable set to a valid CockroachDB conne pg accepts the following format for CockroachDB connection strings: -
+
{% include_cached copy-clipboard.html %} ~~~ @@ -1108,7 +1224,7 @@ postgresql://{username}:{password}@{host}:{port}/{database}?sslmode=verify-full
-
+
{% include_cached copy-clipboard.html %} ~~~ @@ -1124,6 +1240,8 @@ postgresql://{username}:{password}@{host}:{port}/{database}?sslmode=verify-full& postgresql://{username}@{host}:{port}/{database}?sslmode=verify-full&sslrootcert={root-cert}&sslcert={client-cert}&sslkey={client-key} ~~~ +{% include {{ page.version.version }}/connect/core-note.md %} +
For more information about connecting with pg, see the [official pg documentation](https://www.rubydoc.info/gems/pg). @@ -1150,7 +1268,7 @@ Active Record accepts the following format for CockroachDB connection strings:
-
+
{% include_cached copy-clipboard.html %} ~~~ @@ -1159,7 +1277,7 @@ cockroachdb://{username}:{password}@{host}:{port}/{database}?sslmode=verify-full
-
+
{% include_cached copy-clipboard.html %} ~~~ @@ -1175,6 +1293,8 @@ cockroachdb://{username}:{password}@{host}:{port}/{database}?sslmode=verify-full cockroachdb://{username}@{host}:{port}/{database}?sslmode=verify-full&sslrootcert={root-cert}&sslcert={client-cert}&sslkey={client-key} ~~~ +{% include {{ page.version.version }}/connect/core-note.md %} +
{{site.data.alerts.callout_info}} @@ -1187,11 +1307,11 @@ For more information about connecting with Active Record, see the [official Acti ## Connection parameters -
+
Parameter | Description ----------|------------ -`{username}` | The [SQL user](security-reference/authorization.html#sql-users) connecting to the cluster. +`{username}` | The [SQL user]({% link {{ page.version.version }}/security-reference/authorization.md %}#sql-users) connecting to the cluster. `{password}` | The password for the SQL user connecting to the cluster. `{host}` | The host on which the CockroachDB node is running. `{port}` | The port at which the CockroachDB node is listening. @@ -1199,16 +1319,16 @@ Parameter | Description
-
+
Parameter | Description ----------|------------ -`{username}` | The [SQL user](security-reference/authorization.html#sql-users) connecting to the cluster. +`{username}` | The [SQL user]({% link {{ page.version.version }}/security-reference/authorization.md %}#sql-users) connecting to the cluster. `{password}` | The password for the SQL user connecting to the cluster. `{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. -`{root-cert}` | The path to the root certificate that you [downloaded from the CockroachDB Cloud Console](../cockroachcloud/authentication.html#node-identity-verification). +`{root-cert}` | The path to the root certificate that you [downloaded from the CockroachDB Cloud Console]({% link cockroachcloud/authentication.md %}#node-identity-verification).
@@ -1216,13 +1336,15 @@ Parameter | Description Parameter | Description ----------|------------ -`{username}` | The [SQL user](security-reference/authorization.html#sql-users) connecting to the cluster. +`{username}` | The [SQL user]({% link {{ page.version.version }}/security-reference/authorization.md %}#sql-users) connecting to the cluster. `{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. -`{root-cert}` | The path to the root certificate.
You can generate this certificate with [`cockroach cert create-ca`](cockroach-cert.html#subcommands), or you can use a [custom CA cert](create-security-certificates-custom-ca.html). -`{client-cert}` | The path to the [client certificate](cockroach-cert.html#client-key-and-certificates) for the user connecting to the cluster.
You can generate this certificate with [`cockroach cert create-client`](cockroach-cert.html#subcommands). -`{client-key}` | The path to the [client key](cockroach-cert.html#client-key-and-certificates) for the user connecting to the cluster.
You can generate this key with [`cockroach cert create-client`](cockroach-cert.html#subcommands). +`{root-cert}` | The path to the root certificate.
You can generate this certificate with [`cockroach cert create-ca`]({% link {{ page.version.version }}/cockroach-cert.md %}#subcommands), or you can use a [custom CA cert]({% link {{ page.version.version }}/create-security-certificates-custom-ca.md %}). +`{client-cert}` | The path to the [client certificate]({% link {{ page.version.version }}/cockroach-cert.md %}#client-key-and-certificates) for the user connecting to the cluster.
You can generate this certificate with [`cockroach cert create-client`]({% link {{ page.version.version }}/cockroach-cert.md %}#subcommands). +`{client-key}` | The path to the [client key]({% link {{ page.version.version }}/cockroach-cert.md %}#client-key-and-certificates) for the user connecting to the cluster.
You can generate this key with [`cockroach cert create-client`]({% link {{ page.version.version }}/cockroach-cert.md %}#subcommands). + +{% include {{ page.version.version }}/connect/core-note.md %}
@@ -1230,7 +1352,7 @@ Parameter | Description ## See also -- [Install a Driver or ORM Framework](install-client-drivers.html) -- [Connection Pooling](connection-pooling.html) -- [`cockroach` Connection Parameters](connection-parameters.html) -- [Example Apps](example-apps.html) +- [Install a Driver or ORM Framework]({% link {{ page.version.version }}/install-client-drivers.md %}) +- [Connection Pooling]({% link {{ page.version.version }}/connection-pooling.md %}) +- [`cockroach` Connection Parameters]({% link {{ page.version.version }}/connection-parameters.md %}) +- [Example Apps]({% link {{ page.version.version }}/example-apps.md %}) diff --git a/src/current/v22.1/frequently-asked-questions.md b/src/current/v22.1/frequently-asked-questions.md index 0267503e50f..fe8a055f3b4 100644 --- a/src/current/v22.1/frequently-asked-questions.md +++ b/src/current/v22.1/frequently-asked-questions.md @@ -10,13 +10,7 @@ docs_area: get_started ### What is CockroachDB? -CockroachDB is a [distributed SQL](https://www.cockroachlabs.com/blog/what-is-distributed-sql/) database built on a transactional and strongly-consistent key-value store. It **scales** horizontally; **survives** disk, machine, rack, and even datacenter failures with minimal latency disruption and no manual intervention; supports **strongly-consistent** ACID transactions; and provides a familiar **SQL** API for structuring, manipulating, and querying data. - -CockroachDB is inspired by Google's [Spanner](http://research.google.com/archive/spanner.html) and [F1](http://research.google.com/pubs/pub38125.html) technologies, and the [source code](https://github.com/cockroachdb/cockroach) is freely available. - -{{site.data.alerts.callout_success}} -For a deeper dive into CockroachDB's capabilities and how it fits into the database landscape, take the free [**Intro to Distributed SQL and CockroachDB**](https://university.cockroachlabs.com/courses/course-v1:crl+intro-to-distributed-sql-and-cockroachdb+self-paced/about) course on Cockroach University. -{{site.data.alerts.end}} +{% include {{ page.version.version }}/faq/what-is-crdb.md %} ### When is CockroachDB a good choice? @@ -30,23 +24,22 @@ CockroachDB is well suited for applications that require reliable, available, an -CockroachDB returns single-row reads in 2ms or less and single-row writes in 4ms or less, and supports a variety of [SQL and operational tuning practices](performance-best-practices-overview.html) for optimizing query performance. However, CockroachDB is not yet suitable for heavy analytics / OLAP. +CockroachDB returns single-row reads in 2ms or less and single-row writes in 4ms or less, and supports a variety of [SQL and operational tuning practices]({% link {{ page.version.version }}/performance-best-practices-overview.md %}) for optimizing query performance. However, CockroachDB is not yet suitable for heavy analytics / OLAP. ### How easy is it to get started with CockroachDB? -You can get started with CockroachDB with just a few clicks. Sign up for a CockroachDB {{ site.data.products.cloud }} account to create a free CockroachDB {{ site.data.products.serverless }} cluster. For more details, see [Quickstart](../cockroachcloud/quickstart.html). +You can get started with CockroachDB with just a few clicks. Sign up for a CockroachDB {{ site.data.products.cloud }} account to create a CockroachDB {{ site.data.products.standard }} cluster. For more details, see [Quickstart]({% link cockroachcloud/quickstart.md %}). -Alternatively, you can download a binary or run our official Kubernetes configurations or Docker image. For more details, see [Install CockroachDB](install-cockroachdb.html). +Alternatively, you can download a binary or run our official Kubernetes configurations or Docker image. For more details, see [Install CockroachDB]({% link {{ page.version.version }}/install-cockroachdb.md %}). ### How do I know which CockroachDB deployment option is right for my project? -There are three way to use and deploy CockroachDB: +There are four ways to use and deploy CockroachDB: -- **CockroachDB {{ site.data.products.serverless }}**: A multi-tenant CockroachDB deployment, managed by Cockroach Labs, in a single region and cloud (AWS or GCP). CockroachDB {{ site.data.products.serverless }} lets you create and start clusters instantly. This deployment option is good for starter projects and evaluations. -- **CockroachDB {{ site.data.products.dedicated }}**: A single tenant CockroachDB deployment, managed by Cockroach Labs, in a single, multi-region cloud (AWS or GCP). This deployment option is good for mission-critical databases and projects that require [Enterprise features](enterprise-licensing.html). -- **CockroachDB {{ site.data.products.core }}**: A self-managed CockroachDB deployment, backed by Cockroach Labs Support, for multiple clouds and regions. This deployment option is good if you require complete control over the database environment and require [Enterprise features](enterprise-licensing.html). - -For more details, see [Choose a Deployment Option](choose-a-deployment-option.html). +- **CockroachDB {{ site.data.products.basic }}**: A multi-tenant CockroachDB deployment, managed by Cockroach Labs. CockroachDB {{ site.data.products.basic }} provides highly available database clusters that scale instantly and automatically for small production and dev/test workloads. +- **CockroachDB {{ site.data.products.standard }}**: A multi-tenant CockroachDB deployment, managed by Cockroach Labs. CockroachDB {{ site.data.products.standard }} allows you to consolidate a variety of production workloads while optimizing cost. +- **CockroachDB {{ site.data.products.advanced }}**: A single tenant CockroachDB deployment, managed by Cockroach Labs. CockroachDB {{ site.data.products.advanced }} provides dedicated hardware to support stringent regulatory requirements and enhanced compliance, targeting production workloads with advanced Enterprise requirements. +- **CockroachDB {{ site.data.products.core }}**: A self-managed CockroachDB deployment, backed by Cockroach Labs Support, for multiple clouds and regions. This deployment option is good if you require complete control over the database environment and require [Enterprise features]({% link {{ page.version.version }}/enterprise-licensing.md %}). ## About the database @@ -54,11 +47,14 @@ For more details, see [Choose a Deployment Option](choose-a-deployment-option.ht CockroachDB scales horizontally with minimal operator overhead. -At the key-value level, CockroachDB starts off with a single, empty range. As you put data in, this single range eventually reaches a threshold size (512 MiB by default). When that happens, the data splits into two ranges, each covering a contiguous segment of the entire key-value space. This process continues indefinitely; as new data flows in, existing ranges continue to split into new ranges, aiming to keep a relatively small and consistent range size. +At the key-value level, CockroachDB starts off with a single, empty range. As you put data in, this single range eventually reaches [a threshold size]({% link {{ page.version.version }}/configure-replication-zones.md %}#range-max-bytes). When that happens, the data [splits into two ranges]({% link {{ page.version.version }}/architecture/distribution-layer.md %}#range-splits), each covering a contiguous segment of the entire key-value space. This process continues indefinitely; as new data flows in, existing ranges continue to split into new ranges, aiming to keep a relatively small and consistent range size. + +When your cluster spans multiple nodes (physical machines, virtual machines, or containers), newly split ranges are automatically rebalanced to nodes with more capacity. CockroachDB communicates opportunities for rebalancing using a peer-to-peer [gossip protocol](https://wikipedia.org/wiki/Gossip_protocol) by which nodes exchange network addresses, store capacity, and other information. -When your cluster spans multiple nodes (physical machines, virtual machines, or containers), newly split ranges are automatically rebalanced to nodes with more capacity. CockroachDB communicates opportunities for rebalancing using a peer-to-peer [gossip protocol](https://en.wikipedia.org/wiki/Gossip_protocol) by which nodes exchange network addresses, store capacity, and other information. +For more information about scaling a CockroachDB cluster, see the following docs: -For more information about scaling a CockroachDB cluster, refer to [`cockroach start` - Add a node to a cluster](cockroach-start.html#add-a-node-to-a-cluster) +- [Manage Your Advanced Cluster - Scale your cluster]({% link cockroachcloud/advanced-cluster-management.md %}#scale-your-cluster) +- [`cockroach start` - Add a node to a cluster]({% link {{ page.version.version }}/cockroach-start.md %}#add-a-node-to-a-cluster) ### How does CockroachDB survive failures? @@ -66,13 +62,13 @@ CockroachDB is designed to survive software and hardware failures, from server r **Replication** -CockroachDB replicates your data for availability and guarantees consistency between replicas using the [Raft consensus algorithm](https://raft.github.io/), a popular alternative to Paxos. You can [define the location of replicas](configure-replication-zones.html) in various ways, depending on the types of failures you want to secure against and your network topology. You can locate replicas on: +CockroachDB replicates your data for availability and guarantees consistency between replicas using the [Raft consensus algorithm](https://raft.github.io/), a popular alternative to Paxos. You can [define the location of replicas]({% link {{ page.version.version }}/configure-replication-zones.md %}) in various ways, depending on the types of failures you want to secure against and your network topology. You can locate replicas on: - Different servers within a rack to tolerate server failures - Different servers on different racks within a datacenter to tolerate rack power/network failures - Different servers in different datacenters to tolerate large scale network or power outages -In a CockroachDB cluster spread across multiple geographic regions, the round-trip latency between regions will have a direct effect on your database's performance. In such cases, it is important to think about the latency requirements of each table and then use the appropriate [data topologies](topology-patterns.html) to locate data for optimal performance and resiliency. For a step-by-step demonstration, see [Low Latency Multi-Region Deployment](demo-low-latency-multi-region-deployment.html). +In a CockroachDB cluster spread across multiple geographic regions, the round-trip latency between regions will have a direct effect on your database's performance. In such cases, it is important to think about the latency requirements of each table and then use the appropriate [data topologies]({% link {{ page.version.version }}/topology-patterns.md %}) to locate data for optimal performance and resiliency. For a step-by-step demonstration, see [Low Latency Multi-Region Deployment]({% link {{ page.version.version }}/demo-low-latency-multi-region-deployment.md %}). **Automated Repair** @@ -80,36 +76,36 @@ For short-term failures, such as a server restart, CockroachDB uses Raft to cont ### How is CockroachDB strongly-consistent? -CockroachDB guarantees [serializable SQL transactions](demo-serializable.html), the highest isolation level defined by the SQL standard. It does so by combining the Raft consensus algorithm for writes and a custom time-based synchronization algorithms for reads. +CockroachDB guarantees [serializable SQL transactions]({% link {{ page.version.version }}/demo-serializable.md %}), the highest isolation level defined by the SQL standard. It does so by combining the Raft consensus algorithm for writes and a custom time-based synchronization algorithms for reads. -- Stored data is versioned with MVCC, so [reads simply limit their scope to the data visible at the time the read transaction started](architecture/transaction-layer.html#time-and-hybrid-logical-clocks). +- Stored data is versioned with MVCC, so [reads simply limit their scope to the data visible at the time the read transaction started]({% link {{ page.version.version }}/architecture/transaction-layer.md %}#time-and-hybrid-logical-clocks). -- Writes are serviced using the [Raft consensus algorithm](https://raft.github.io/), a popular alternative to Paxos. A consensus algorithm guarantees that any majority of replicas together always agree on whether an update was committed successfully. Updates (writes) must reach a majority of replicas (2 out of 3 by default) before they are considered committed. +- Writes are serviced using the [Raft consensus algorithm](https://raft.github.io/), a popular alternative to Paxos. A consensus algorithm guarantees that any majority of replicas together always agree on whether an update was committed successfully. Updates (writes) must reach a majority of replicas (2 out of 3 by default) before they are considered committed. - To ensure that a write transaction does not interfere with read transactions that start after it, CockroachDB also uses a [timestamp cache](architecture/transaction-layer.html#timestamp-cache) which remembers when data was last read by ongoing transactions. + To ensure that a write transaction does not interfere with read transactions that start after it, CockroachDB also uses a [timestamp cache]({% link {{ page.version.version }}/architecture/transaction-layer.md %}#timestamp-cache) which remembers when data was last read by ongoing transactions. This ensures that clients always observe serializable consistency with regards to other concurrent transactions. ### How is CockroachDB both highly available and strongly consistent? -The [CAP theorem](https://en.wikipedia.org/wiki/CAP_theorem) states that it is impossible for a distributed system to simultaneously provide more than two out of the following three guarantees: +The [CAP theorem](https://wikipedia.org/wiki/CAP_theorem) states that it is impossible for a distributed system to simultaneously provide more than two out of the following three guarantees: - Consistency - Availability - Partition Tolerance CockroachDB is a CP (consistent and partition tolerant) system. This means -that, in the presence of partitions, the system will become unavailable rather than do anything which might cause inconsistent results. For example, writes require acknowledgements from a majority of replicas, and reads require a lease, which can only be transferred to a different node when writes are possible. +that, in the presence of partitions, the system will become unavailable rather than do anything which might cause inconsistent results. For example, writes require acknowledgments from a majority of replicas, and reads require a lease, which can only be transferred to a different node when writes are possible. Separately, CockroachDB is also Highly Available, although "available" here means something different than the way it is used in the CAP theorem. In the CAP theorem, availability is a binary property, but for High Availability, we talk about availability as a spectrum (using terms like "five nines" for a system that is available 99.999% of the time). -Being both CP and HA means that whenever a majority of replicas can talk to each other, they should be able to make progress. For example, if you deploy CockroachDB to three datacenters and the network link to one of them fails, the other two datacenters should be able to operate normally with only a few seconds' disruption. We do this by attempting to detect partitions and failures quickly and efficiently, transferring leadership to nodes that are able to communicate with the majority, and routing internal traffic away from nodes that are partitioned away. +Being both CP and HA means that whenever a majority of replicas can talk to each other, they should be able to make progress. For example, if you deploy CockroachDB to three datacenters and the network link to one of them fails, the other two datacenters should be able to operate normally with only a few seconds' disruption. We do this by attempting to detect partitions and failures quickly and efficiently, [transferring leadership to nodes that are able to communicate with the majority]({% link {{ page.version.version }}/architecture/replication-layer.md %}#how-leases-are-transferred-from-a-dead-node), and routing internal traffic away from nodes that are partitioned away. ### Why is CockroachDB SQL? -At the lowest level, CockroachDB is a distributed, strongly-consistent, transactional key-value store, but the external API is Standard SQL with extensions. This provides developers familiar relational concepts such as schemas, tables, columns, and indexes and the ability to structure, manipulate, and query data using well-established and time-proven tools and processes. Also, since CockroachDB supports the PostgreSQL wire protocol, it’s simple to get your application talking to Cockroach; just find your [PostgreSQL language-specific driver](install-client-drivers.html) and start building. +At the lowest level, CockroachDB is a distributed, strongly-consistent, transactional key-value store, but the external API is Standard SQL with extensions. This provides developers familiar relational concepts such as schemas, tables, columns, and indexes and the ability to structure, manipulate, and query data using well-established and time-proven tools and processes. Also, since CockroachDB supports the PostgreSQL wire protocol, it’s simple to get your application talking to Cockroach; just find your [PostgreSQL language-specific driver]({% link {{ page.version.version }}/install-client-drivers.md %}) and start building. -For more details, learn our [basic CockroachDB SQL statements](learn-cockroachdb-sql.html), explore the [full SQL grammar](sql-grammar.html), and try it out via our [built-in SQL client](cockroach-sql.html). Also, to understand how CockroachDB maps SQL table data to key-value storage and how CockroachDB chooses the best index for running a query, see [SQL in CockroachDB](https://www.cockroachlabs.com/blog/sql-in-cockroachdb-mapping-table-data-to-key-value-storage/) and [Index Selection in CockroachDB](https://www.cockroachlabs.com/blog/index-selection-cockroachdb-2/). +For more details, learn our [basic CockroachDB SQL statements]({% link {{ page.version.version }}/learn-cockroachdb-sql.md %}), explore the [full SQL grammar]({% link {{ page.version.version }}/sql-grammar.md %}), and try it out via our [built-in SQL client]({% link {{ page.version.version }}/cockroach-sql.md %}). Also, to understand how CockroachDB maps SQL table data to key-value storage and how CockroachDB chooses the best index for running a query, see [SQL in CockroachDB](https://www.cockroachlabs.com/blog/sql-in-cockroachdb-mapping-table-data-to-key-value-storage/) and [Index Selection in CockroachDB](https://www.cockroachlabs.com/blog/index-selection-cockroachdb-2/). ### Does CockroachDB support distributed transactions? @@ -117,18 +113,18 @@ Yes. CockroachDB distributes transactions across your cluster, whether it’s a ### Do transactions in CockroachDB guarantee ACID semantics? -Yes. Every [transaction](transactions.html) in CockroachDB guarantees [ACID semantics](https://en.wikipedia.org/wiki/ACID) spanning arbitrary tables and rows, even when data is distributed. +Yes. Every [transaction]({% link {{ page.version.version }}/transactions.md %}) in CockroachDB guarantees [ACID semantics](https://en.wikipedia.org/wiki/ACID) spanning arbitrary tables and rows, even when data is distributed. - **Atomicity:** Transactions in CockroachDB are “all or nothing.” If any part of a transaction fails, the entire transaction is aborted, and the database is left unchanged. If a transaction succeeds, all mutations are applied together with virtual simultaneity. For a detailed discussion of atomicity in CockroachDB transactions, see [How CockroachDB Distributes Atomic Transactions](https://www.cockroachlabs.com/blog/how-cockroachdb-distributes-atomic-transactions/). - **Consistency:** SQL operations never see any intermediate states and move the database from one valid state to another, keeping indexes up to date. Operations always see the results of previously completed statements on overlapping data and maintain specified constraints such as unique columns. For a detailed look at how we've tested CockroachDB for correctness and consistency, see [CockroachDB Beta Passes Jepsen Testing](https://www.cockroachlabs.com/blog/cockroachdb-beta-passes-jepsen-testing/). -- **Isolation:** Transactions in CockroachDB implement the strongest ANSI isolation level: serializable (`SERIALIZABLE`). This means that transactions will never result in anomalies. For more information about transaction isolation in CockroachDB, see [Transactions: Isolation Levels](transactions.html#isolation-levels). +- **Isolation:** Transactions in CockroachDB implement the strongest ANSI isolation level: serializable (`SERIALIZABLE`). This means that transactions will never result in anomalies. For more information about transaction isolation in CockroachDB, see [Transactions: Isolation Levels]({% link {{ page.version.version }}/transactions.md %}#isolation-levels). - **Durability:** In CockroachDB, every acknowledged write has been persisted consistently on a majority of replicas (by default, at least 2) via the [Raft consensus algorithm](https://raft.github.io/). Power or disk failures that affect only a minority of replicas (typically 1) do not prevent the cluster from operating and do not lose any data. ### Since CockroachDB is inspired by Spanner, does it require atomic clocks to synchronize time? No. CockroachDB was designed to work without atomic clocks or GPS clocks. It’s a database intended to be run on arbitrary collections of nodes, from physical servers in a corp development cluster to public cloud infrastructure using the flavor-of-the-month virtualization layer. It’d be a showstopper to require an external dependency on specialized hardware for clock synchronization. However, CockroachDB does require moderate levels of clock synchronization for correctness. If clocks drift past a maximum threshold, nodes will be taken offline. It's therefore highly recommended to run [NTP](http://www.ntp.org/) or other clock synchronization software on each node. -For more details on how CockroachDB handles unsynchronized clocks, see [Clock Synchronization](recommended-production-settings.html#clock-synchronization). And for a broader discussion of clocks, and the differences between clocks in Spanner and CockroachDB, see [Living Without Atomic Clocks](https://www.cockroachlabs.com/blog/living-without-atomic-clocks/). +For more details on how CockroachDB handles unsynchronized clocks, see [Clock Synchronization]({% link {{ page.version.version }}/recommended-production-settings.md %}#clock-synchronization). And for a broader discussion of clocks, and the differences between clocks in Spanner and CockroachDB, see [Living Without Atomic Clocks](https://www.cockroachlabs.com/blog/living-without-atomic-clocks/). ### What languages can I use to work with CockroachDB? @@ -143,7 +139,7 @@ CockroachDB supports the PostgreSQL wire protocol, so you can use any available - C#(.NET) - Rust -See [Install Client Drivers](install-client-drivers.html) for more details. +See [Install Client Drivers]({% link {{ page.version.version }}/install-client-drivers.md %}) for more details. ### Why does CockroachDB use the PostgreSQL wire protocol instead of the MySQL protocol? @@ -153,9 +149,9 @@ Note, however, that the protocol used doesn't significantly impact how easy it i ### Can a PostgreSQL or MySQL application be migrated to CockroachDB? -Yes. Most users should be able to follow the instructions in [Migrate from PostgreSQL](migrate-from-postgres.html) or [Migrate from MySQL](migrate-from-mysql.html). Due to differences in available features and syntax, some features supported by these databases may require manual effort to port to CockroachDB. Check those pages for details. +Yes. Most users should be able to follow the instructions in [Migrate from PostgreSQL]({% link {{ page.version.version }}/migrate-from-postgres.md %}) or [Migrate from MySQL]({% link {{ page.version.version }}/migrate-from-mysql.md %}). Due to differences in available features and syntax, some features supported by these databases may require manual effort to port to CockroachDB. Check those pages for details. -We also fully support [importing your data via CSV](migrate-from-csv.html). +We also fully support [importing your data via CSV]({% link {{ page.version.version }}/migrate-from-csv.md %}). ### What is CockroachDB’s security model? @@ -163,7 +159,7 @@ You can run a secure or insecure CockroachDB cluster. When secure, client/node a Also, CockroachDB supports common SQL privileges on databases and tables. The `root` user has privileges for all databases, while unique users can be granted privileges for specific statements at the database and table-levels. -For more details, see our [Security Overview](security-reference/security-overview.html). +For more details, see our [Security Overview]({% link {{ page.version.version }}/security-reference/security-overview.md %}). ## How CockroachDB compares @@ -171,17 +167,17 @@ For more details, see our [Security Overview](security-reference/security-overvi While all of these databases support SQL syntax, CockroachDB is the only one that scales easily (without the manual complexity of sharding), rebalances and repairs itself automatically, and distributes transactions seamlessly across your cluster. -For more insight, see [CockroachDB in Comparison](cockroachdb-in-comparison.html). +For more insight, see [CockroachDB in Comparison]({% link {{ page.version.version }}/cockroachdb-in-comparison.md %}). ### How does CockroachDB compare to Cassandra, HBase, MongoDB, or Riak? While all of these are distributed databases, only CockroachDB supports distributed transactions and provides strong consistency. Also, these other databases provide custom APIs, whereas CockroachDB offers standard SQL with extensions. -For more insight, see [CockroachDB in Comparison](cockroachdb-in-comparison.html). +For more insight, see [CockroachDB in Comparison]({% link {{ page.version.version }}/cockroachdb-in-comparison.md %}). ## Have questions that weren’t answered? -Try searching the rest of our docs for answers or using our other [support resources](support-resources.html), including: +Try searching the rest of our docs for answers or using our other [support resources]({% link {{ page.version.version }}/support-resources.md %}), including: - [CockroachDB Community Forum](https://forum.cockroachlabs.com) - [CockroachDB Community Slack](https://cockroachdb.slack.com)