Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to cockroach demo docs #5363

Merged
merged 1 commit into from
Sep 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _includes/v19.2/sql/movr-start-nodes.md
Original file line number Diff line number Diff line change
@@ -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
~~~
4 changes: 2 additions & 2 deletions _includes/v19.2/sql/movr-start.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
10 changes: 0 additions & 10 deletions _includes/v19.2/sql/movr-statements-no-data.md

This file was deleted.

4 changes: 2 additions & 2 deletions _includes/v19.2/sql/movr-statements-nodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
~~~
4 changes: 2 additions & 2 deletions _includes/v19.2/sql/movr-statements-partitioning.md
Original file line number Diff line number Diff line change
@@ -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
~~~
Expand Down
4 changes: 2 additions & 2 deletions _includes/v19.2/sql/movr-statements.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
~~~
15 changes: 1 addition & 14 deletions _includes/v19.2/sql/partitioning-enterprise.md
Original file line number Diff line number Diff line change
@@ -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 = '<your organization>';
~~~

{% include copy-clipboard.html %}
~~~ sql
> SET CLUSTER SETTING enterprise.license = '<your license key>';
~~~
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).
23 changes: 18 additions & 5 deletions v19.2/cockroach-demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.


<span class="version-tag">New in v19.2:</span> Each instance of `cockroach demo` loads a temporary [enterprise license](https://www.cockroachlabs.com/get-cockroachdb) that expires after an hour.

## Synopsis

~~~ shell
Expand All @@ -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).<br><br><span class="version-tag">New in v19.2:</span> 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.

Expand All @@ -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 i<sup>th</sup> pair is the locality setting for the i<sup>th</sup> demo cockroach node.<br><br>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` | <span class="version-tag">New in v19.2:</span> 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 i<sup>th</sup> pair is the locality setting for the i<sup>th</sup> demo cockroach node.<br><br>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`:<br><br>`--demo-locality=region=us-east1,az=1:region=us-east1,az=2:region=us-east1,az=3`<br><br>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`<br>`-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.<br><br>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`.<br><br>**Default:** `table` for sessions that [output on a terminal](use-the-built-in-sql-client.html#session-and-output-types); `tsv` otherwise<br /><br />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.<br><br>**Default:** 1
`--nodes` | <span class="version-tag">New in v19.2:</span> Specify the number of in-memory nodes to create for the demo.<br><br>**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`.<br><br>**Default:** `true` for [interactive sessions](use-the-built-in-sql-client.html#session-and-output-types); `false` otherwise<br><br>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.<br><br>After starting the SQL shell, the `\set` and `unset` commands can be use to enable and disable client-side options as well.
`--with-load` | <span class="version-tag">New in v19.2:</span> Run a demo [`movr`](movr.html) workload against the preloaded `movr` database.

### Logging

Expand Down Expand Up @@ -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 %}
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion v19.2/show-locality.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion v19.2/show-partitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
10 changes: 5 additions & 5 deletions v19.2/show-ranges.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 %}
Expand Down