diff --git a/_includes/v19.2/sql/movr-start-nodes.md b/_includes/v19.2/sql/movr-start-nodes.md index 07152b80d44..830301d6e3f 100644 --- a/_includes/v19.2/sql/movr-start-nodes.md +++ b/_includes/v19.2/sql/movr-start-nodes.md @@ -1,6 +1,6 @@ -Run [`cockroach demo movr`](cockroach-demo.html) with the `--nodes` and `--demo-locality` tags. This command opens an interactive SQL shell to a temporary, multi-node in-memory cluster with the `movr` database preloaded and set as the [current database](sql-name-resolution.html#current-database). +Run [`cockroach demo`](cockroach-demo.html) with the `--nodes` and `--demo-locality` tags. This command opens an interactive SQL shell to a temporary, multi-node in-memory cluster with the `movr` database preloaded and set as the [current database](sql-name-resolution.html#current-database). {% include copy-clipboard.html %} ~~~ shell - $ cockroach demo movr --nodes=3 --demo-locality=region=us-east1,region=us-central1,region=us-west1 + $ cockroach demo --nodes=3 --demo-locality=region=us-east1:region=us-central1:region=us-west1 ~~~ diff --git a/_includes/v19.2/sql/movr-start.md b/_includes/v19.2/sql/movr-start.md index fe0e255d1e7..12bd968bb52 100644 --- a/_includes/v19.2/sql/movr-start.md +++ b/_includes/v19.2/sql/movr-start.md @@ -1,8 +1,8 @@ -- Run [`cockroach demo movr`](cockroach-demo.html) to start a temporary, in-memory cluster with the `movr` dataset pre-loaded: +- Run [`cockroach demo`](cockroach-demo.html) to start a temporary, in-memory cluster with the `movr` dataset preloaded: {% include copy-clipboard.html %} ~~~ shell - $ cockroach demo movr + $ cockroach demo ~~~ - Load the `movr` dataset into a persistent local cluster and open an interactive SQL shell: diff --git a/_includes/v19.2/sql/movr-statements-no-data.md b/_includes/v19.2/sql/movr-statements-no-data.md deleted file mode 100644 index aaf66a35cef..00000000000 --- a/_includes/v19.2/sql/movr-statements-no-data.md +++ /dev/null @@ -1,10 +0,0 @@ -The following examples use MovR, a fictional vehicle-sharing application, to demonstrate CockroachDB SQL statements. For more information about the MovR example application, see [MovR: A Global Vehicle-sharing App](movr.html). - -To follow along, do the following: - -1. Start up a [secure](secure-a-cluster.html) or [insecure](start-a-local-cluster.html) local cluster. -1. Open an interactive SQL shell to the cluster with the [`cockroach sql`](use-the-built-in-sql-client.html) command. -1. Create the `movr` database with the [`CREATE DATABASE`](create-table.html) statement. -1. Set `movr` as the [current database](sql-name-resolution.html#current-database) for the session with the [`SET`](set-vars.html) statement. - -You can alternatively run `cockroach demo` to open an interactive SQL shell to a temporary, in-memory cluster, and then complete steps 3 and 4. diff --git a/_includes/v19.2/sql/movr-statements-nodes.md b/_includes/v19.2/sql/movr-statements-nodes.md index a265aecbb6d..2147f158b7c 100644 --- a/_includes/v19.2/sql/movr-statements-nodes.md +++ b/_includes/v19.2/sql/movr-statements-nodes.md @@ -2,9 +2,9 @@ The following examples use MovR, a fictional vehicle-sharing application, to demonstrate CockroachDB SQL statements. For more information about the MovR example application and dataset, see [MovR: A Global Vehicle-sharing App](movr.html). -To follow along, run [`cockroach demo movr`](cockroach-demo.html) with the `--nodes` and `--demo-locality` tags. This command opens an interactive SQL shell to a temporary, multi-node in-memory cluster with the `movr` database preloaded and set as the [current database](sql-name-resolution.html#current-database). +To follow along, run [`cockroach demo`](cockroach-demo.html) with the `--nodes` and `--demo-locality` tags. This command opens an interactive SQL shell to a temporary, multi-node in-memory cluster with the `movr` database preloaded and set as the [current database](sql-name-resolution.html#current-database). {% include copy-clipboard.html %} ~~~ shell -$ cockroach demo movr --nodes=3 --demo-locality=region=us-east1,region=us-central1,region=us-west1 +$ cockroach demo --nodes=3 --demo-locality=region=us-east1:region=us-central1:region=us-west1 ~~~ diff --git a/_includes/v19.2/sql/movr-statements-partitioning.md b/_includes/v19.2/sql/movr-statements-partitioning.md index d4db749681f..3daa8ae2554 100644 --- a/_includes/v19.2/sql/movr-statements-partitioning.md +++ b/_includes/v19.2/sql/movr-statements-partitioning.md @@ -1,10 +1,10 @@ The following examples use MovR, a fictional vehicle-sharing application, to demonstrate CockroachDB SQL statements. For more information about the MovR example application and dataset, see [MovR: A Global Vehicle-sharing App](movr.html). -To follow along with the partitioning examples below, open a new terminal and run [`cockroach demo movr`](cockroach-demo.html) with the `--nodes` and `--demo-locality` tags. This command opens an interactive SQL shell to a temporary, multi-node in-memory cluster with the `movr` database preloaded and set as the [current database](sql-name-resolution.html#current-database). +To follow along with the partitioning examples below, open a new terminal and run [`cockroach demo`](cockroach-demo.html) with the `--nodes` and `--demo-locality` tags. This command opens an interactive SQL shell to a temporary, multi-node in-memory cluster with the `movr` database preloaded and set as the [current database](sql-name-resolution.html#current-database). {% include copy-clipboard.html %} ~~~ shell -$ cockroach demo movr \ +$ cockroach demo \ --nodes=9 \ --demo-locality=region=us-east1:region=us-east1:region=us-east1:region=us-central1:region=us-central1:region=us-central1:region=us-west1:region=us-west1:region=us-west1 ~~~ diff --git a/_includes/v19.2/sql/movr-statements.md b/_includes/v19.2/sql/movr-statements.md index f0cd01f86f9..656f92346dc 100644 --- a/_includes/v19.2/sql/movr-statements.md +++ b/_includes/v19.2/sql/movr-statements.md @@ -2,9 +2,9 @@ The following examples use MovR, a fictional vehicle-sharing application, to demonstrate CockroachDB SQL statements. For more information about the MovR example application and dataset, see [MovR: A Global Vehicle-sharing App](movr.html). -To follow along, run [`cockroach demo movr`](cockroach-demo.html) to start a temporary, in-memory cluster with the `movr` dataset pre-loaded: +To follow along, run [`cockroach demo`](cockroach-demo.html) to start a temporary, in-memory cluster with the `movr` dataset preloaded: {% include copy-clipboard.html %} ~~~ shell -$ cockroach demo movr +$ cockroach demo ~~~ diff --git a/_includes/v19.2/sql/partitioning-enterprise.md b/_includes/v19.2/sql/partitioning-enterprise.md index 6b0cf1cf7f6..adea6950671 100644 --- a/_includes/v19.2/sql/partitioning-enterprise.md +++ b/_includes/v19.2/sql/partitioning-enterprise.md @@ -1,14 +1 @@ -Partitioning is an enterprise-only feature. To continue, you must set a trial or enterprise key in your cluster settings: - - 1. [Request a trial enterprise license](https://www.cockroachlabs.com/get-cockroachdb/). You should receive your trial license via email within a few minutes. - - 2. Run the following commands in your SQL shell to enable enterprise features using your trial license: - {% include copy-clipboard.html %} - ~~~ sql - > SET CLUSTER SETTING cluster.organization = ''; - ~~~ - - {% include copy-clipboard.html %} - ~~~ sql - > SET CLUSTER SETTING enterprise.license = ''; - ~~~ +Partitioning is an enterprise-only feature. Each instance of `cockroach demo` loads a temporary enterprise license that expires after an hour. If you want to use enterprise-only features outside of a `cockroach demo` instance, [request a trial enterprise license](https://www.cockroachlabs.com/get-cockroachdb/), and then [set the license key](enterprise-licensing.html#set-the-trial-or-enterprise-license-key). diff --git a/v19.2/cockroach-demo.md b/v19.2/cockroach-demo.md index 47faf7b28ce..188eb79a313 100644 --- a/v19.2/cockroach-demo.md +++ b/v19.2/cockroach-demo.md @@ -4,10 +4,13 @@ summary: Use cockroach demo to open a SQL shell to a temporary, in-memory, singl toc: true --- -The `cockroach demo` [command](cockroach-commands.html) starts a temporary, in-memory CockroachDB cluster, optionally with a pre-loaded dataset, and opens an [interactive SQL shell](use-the-built-in-sql-client.html) to the cluster. +The `cockroach demo` [command](cockroach-commands.html) starts a temporary, in-memory CockroachDB cluster, a preloaded dataset, and opens an [interactive SQL shell](use-the-built-in-sql-client.html) to the cluster. The in-memory cluster persists only as long as the SQL shell is open. As soon as the shell is exited, the cluster and all its data are permanently destroyed. This command is therefore recommended only as an easy way to experiment with the CockroachDB SQL dialect. + +New in v19.2: Each instance of `cockroach demo` loads a temporary [enterprise license](https://www.cockroachlabs.com/get-cockroachdb) that expires after an hour. + ## Synopsis ~~~ shell @@ -34,7 +37,7 @@ Workload | Description ---------|------------ `bank` | A `bank` database, with one `bank` table containing account details. `intro` | An `intro` database, with one table, `mytable`, with a hidden message. -`movr` | A `movr` database, with several tables of data for the [MovR example application](movr.html). +`movr` | A `movr` database, with several tables of data for the [MovR example application](movr.html).

New in v19.2: By default, `cockroach demo` loads the `movr` database as the [current database](sql-name-resolution.html#current-database), with sample region (`region`) and availability zone (`az`) replica localities for each node specified with the [`--nodes` flag](cockroach-demo.html#general). `startrek` | A `startrek` database, with two tables, `episodes` and `quotes`. `tpcc` | A `tpcc` database, with a rich schema of multiple tables. @@ -46,13 +49,14 @@ The `demo` command supports the following [general-use](#general) and [logging]( Flag | Description -----|------------ -`--demo-locality` | Specify [locality](start-a-node.html#locality) information for each demo node. The input is a comma-separated list of key-value pairs, where the ith pair is the locality setting for the ith demo cockroach node.

For example, the following option assigns node 1's region to `us-east1`, node 2's region to `us-east2`, and node 3's region to `us-east3`: `--demo-locality=region=us-east1,region=us-east2,region=us-east3` +`--demo-locality` | New in v19.2: Specify [locality](start-a-node.html#locality) information for each demo node. The input is a colon-separated list of key-value pairs, where the ith pair is the locality setting for the ith demo cockroach node.

For example, the following option assigns node 1's region to `us-east1` and availability zone to `1`, node 2's region to `us-east2` and availability zone to `2`, and node 3's region to `us-east3` and availability zone to `3`:

`--demo-locality=region=us-east1,az=1:region=us-east1,az=2:region=us-east1,az=3`

By default, `cockroach demo` uses sample region (`region`) and availability zone (`az`) replica localities for each node specified with the `--nodes` flag. `--echo-sql` | Reveal the SQL statements sent implicitly by the command-line utility. This can also be enabled within the interactive SQL shell via the `\set echo` [shell command](use-the-built-in-sql-client.html#commands). `--execute`
`-e` | Execute SQL statements directly from the command line, without opening a shell. This flag can be set multiple times, and each instance can contain one or more statements separated by semi-colons.

If an error occurs in any statement, the command exits with a non-zero status code and further statements are not executed. The results of each statement are printed to the standard output (see `--format` for formatting options). `--format` | How to display table rows printed to the standard output. Possible values: `tsv`, `csv`, `table`, `raw`, `records`, `sql`, `html`.

**Default:** `table` for sessions that [output on a terminal](use-the-built-in-sql-client.html#session-and-output-types); `tsv` otherwise

This flag corresponds to the `display_format` [client-side option](use-the-built-in-sql-client.html#client-side-options) for use in interactive sessions. -`--nodes` | Specify the number of in-memory nodes to create for the demo.

**Default:** 1 +`--nodes` | New in v19.2: Specify the number of in-memory nodes to create for the demo.

**Default:** 1 `--safe-updates` | Disallow potentially unsafe SQL statements, including `DELETE` without a `WHERE` clause, `UPDATE` without a `WHERE` clause, and `ALTER TABLE ... DROP COLUMN`.

**Default:** `true` for [interactive sessions](use-the-built-in-sql-client.html#session-and-output-types); `false` otherwise

Potentially unsafe SQL statements can also be allowed/disallowed for an entire session via the `sql_safe_updates` [session variable](set-vars.html). `--set` | Set a [client-side option](use-the-built-in-sql-client.html#client-side-options) before starting the SQL shell or executing SQL statements from the command line via `--execute`. This flag may be specified multiple times, once per option.

After starting the SQL shell, the `\set` and `unset` commands can be use to enable and disable client-side options as well. +`--with-load` | New in v19.2: Run a demo [`movr`](movr.html) workload against the preloaded `movr` database. ### Logging @@ -134,7 +138,7 @@ $ cockroach demo {% include copy-clipboard.html %} ~~~ shell -$ cockroach demo movr --nodes=3 --demo-locality=region=us-east1,region=us-central1,region=us-west1 +$ cockroach demo movr --nodes=3 --demo-locality=region=us-east1:region=us-central1:region=us-west1 ~~~ {% include copy-clipboard.html %} @@ -201,6 +205,15 @@ INSERT 1 (1 row) ~~~ +### Run `cockroach demo` with a workload + +{% include copy-clipboard.html %} +~~~ shell +$ cockroach demo --with-load +~~~ + +This command starts a demo cluster with the `movr` database preloaded and then inserts rows into each table in the `movr` database. You can monitor the workload progress on the [Admin UI](admin-ui-overview-dashboard.html#sql-queries). + ## See also - [`cockroach sql`](use-the-built-in-sql-client.html) diff --git a/v19.2/show-locality.md b/v19.2/show-locality.md index 7ce6cd43b47..50d5cbb208e 100644 --- a/v19.2/show-locality.md +++ b/v19.2/show-locality.md @@ -28,7 +28,7 @@ To follow along, run [`cockroach demo movr`](cockroach-demo.html) with the `--no {% include copy-clipboard.html %} ~~~ shell -$ cockroach demo movr --nodes=3 --demo-locality=region=us-east1,region=us-central1,region=us-west1 +$ cockroach demo movr --nodes=3 --demo-locality=region=us-east1:region=us-central1:region=us-west1 ~~~ ### Show locality diff --git a/v19.2/show-partitions.md b/v19.2/show-partitions.md index ed470817c62..08daafdeaee 100644 --- a/v19.2/show-partitions.md +++ b/v19.2/show-partitions.md @@ -47,7 +47,7 @@ Field | Description {% include {{page.version.version}}/sql/movr-statements-nodes.md %} -Partitioning is an enterprise-only feature. To continue, you must set a trial or enterprise key in your cluster settings. For instructions, see [Set the Trial or Enterprise License Key](enterprise-licensing.html#set-the-trial-or-enterprise-license-key). +{% include {{page.version.version}}/sql/partitioning-enterprise.md %} Use [ALTER TABLE](alter-table.html) and [PARTITION BY](partition-by.html) to partition the `users` table by city. diff --git a/v19.2/show-ranges.md b/v19.2/show-ranges.md index c8981c59ad7..7c819c0ad6d 100644 --- a/v19.2/show-ranges.md +++ b/v19.2/show-ranges.md @@ -43,11 +43,11 @@ You can use the [`SPLIT AT`](split-at.html) statement to manually split table ra #### Setup -To follow along with the example statements, run [`cockroach demo movr`](cockroach-demo.html) to start a temporary, in-memory cluster with the `movr` dataset pre-loaded: +To follow along with the example statements, run [`cockroach demo`](cockroach-demo.html) to start a temporary, in-memory cluster with the `movr` dataset preloaded: {% include copy-clipboard.html %} ~~~ shell -$ cockroach demo movr +$ cockroach demo ~~~ Split the `users` table ranges based on primary key values: @@ -153,13 +153,13 @@ A `NULL` in the *End Key* column means "end of table". #### Setup -To follow along with the partitioning examples below, open a new terminal and run [`cockroach demo movr`](cockroach-demo.html) with the `--nodes` and `--demo-locality` tags. This command opens an interactive SQL shell to a temporary, multi-node in-memory cluster with the `movr` database preloaded and set as the [current database](sql-name-resolution.html#current-database). +To follow along with the partitioning examples below, open a new terminal and run [`cockroach demo`](cockroach-demo.html) with the `--nodes` and `--demo-locality` tags. This command opens an interactive SQL shell to a temporary, multi-node in-memory cluster with the `movr` database preloaded and set as the [current database](sql-name-resolution.html#current-database). {% include copy-clipboard.html %} ~~~ shell -$ cockroach demo movr \ +$ cockroach demo \ --nodes=9 \ ---demo-locality=region=us-east1,region=us-east1,region=us-east1,region=us-central1,region=us-central1,region=us-central1,region=us-west1,region=us-west1,region=us-west1 +--demo-locality=region=us-east1:region=us-east1:region=us-east1:region=us-central1:region=us-central1:region=us-central1:region=us-west1:region=us-west1:region=us-west1 ~~~ {% include {{page.version.version}}/sql/partitioning-enterprise.md %}