Skip to content

Commit

Permalink
cockroachdb#3038 - Add copy-to-clipboard function to Getting Started
Browse files Browse the repository at this point in the history
Link: https://www.cockroachlabs.com/docs/stable/secure-a-cluster.html

I added {% include copy-clipboard.html %} before code blocks to allow for the Copy to Clipboard function.
  • Loading branch information
vgiurgiu authored May 6, 2018
1 parent 8b3de22 commit ce89376
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions v2.0/secure-a-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Also, feel free to watch this process in action before going through the steps y

You can use either `cockroach cert` commands or [`openssl` commands](create-security-certificates-openssl.html) to generate security certificates. This section features the `cockroach cert` commands.

{% include copy-clipboard.html %}
~~~ shell
# Create a certs directory and safe directory for the CA key.
# If using the default certificate directory (`${HOME}/.cockroach-certs`), make sure it is empty.
Expand Down Expand Up @@ -62,6 +63,7 @@ $(hostname) \

## Step 2. Start the first node

{% include copy-clipboard.html %}
~~~ shell
$ cockroach start \
--certs-dir=certs \
Expand Down Expand Up @@ -95,6 +97,7 @@ At this point, your cluster is live and operational. With just one node, you can

In a new terminal, add the second node:

{% include copy-clipboard.html %}
~~~ shell
$ cockroach start \
--certs-dir=certs \
Expand All @@ -108,6 +111,7 @@ $ cockroach start \

In a new terminal, add the third node:

{% include copy-clipboard.html %}
~~~ shell
$ cockroach start \
--certs-dir=certs \
Expand All @@ -127,6 +131,7 @@ Now that you've scaled to 3 nodes, you can use any node as a SQL gateway to the

{{site.data.alerts.callout_info}}The SQL client is built into the <code>cockroach</code> binary, so nothing extra is needed.{{site.data.alerts.end}}

{% include copy-clipboard.html %}
~~~ shell
$ cockroach sql \
--certs-dir=certs
Expand All @@ -137,6 +142,7 @@ $ cockroach sql \

Run some basic [CockroachDB SQL statements](learn-cockroachdb-sql.html):

{% include copy-clipboard.html %}
~~~ sql
> CREATE DATABASE bank;

Expand All @@ -158,12 +164,14 @@ Run some basic [CockroachDB SQL statements](learn-cockroachdb-sql.html):

Exit the SQL shell on node 1:

{% include copy-clipboard.html %}
~~~ sql
> \q
~~~

Then connect the SQL shell to node 2, this time specifying the node's non-default port:

{% include copy-clipboard.html %}
~~~ shell
$ cockroach sql \
--certs-dir=certs \
Expand All @@ -177,6 +185,7 @@ $ cockroach sql \

Now run the same `SELECT` query:

{% include copy-clipboard.html %}
~~~ sql
> SELECT * FROM bank.accounts;
~~~
Expand All @@ -194,6 +203,7 @@ As you can see, node 1 and node 2 behaved identically as SQL gateways.

Exit the SQL shell on node 2:

{% include copy-clipboard.html %}
~~~ sql
> \q
~~~
Expand Down Expand Up @@ -222,6 +232,7 @@ Once you're done with your test cluster, switch to the terminal running the firs

At this point, with 2 nodes still online, the cluster remains operational because a majority of replicas are available. To verify that the cluster has tolerated this "failure", connect the built-in SQL shell to nodes 2 or 3. You can do this in the same terminal or in a new terminal.

{% include copy-clipboard.html %}
~~~ shell
$ cockroach sql \
--certs-dir=certs \
Expand All @@ -231,6 +242,7 @@ $ cockroach sql \
# To exit: CTRL + D.
~~~

{% include copy-clipboard.html %}
~~~ sql
> SELECT * FROM bank.accounts;
~~~
Expand All @@ -246,6 +258,7 @@ $ cockroach sql \

Exit the SQL shell:

{% include copy-clipboard.html %}
~~~ sql
> \q
~~~
Expand All @@ -256,6 +269,7 @@ Now stop nodes 2 and 3 by switching to their terminals and pressing **CTRL + C**

If you don't plan to restart the cluster, you may want to remove the nodes' data stores:

{% include copy-clipboard.html %}
~~~ shell
$ rm -rf cockroach-data node2 node3
~~~
Expand All @@ -266,6 +280,7 @@ If you decide to use the cluster for further testing, you'll need to restart at

Restart the first node from the parent directory of `cockroach-data/`:

{% include copy-clipboard.html %}
~~~ shell
$ cockroach start \
--certs-dir=certs \
Expand All @@ -278,6 +293,7 @@ $ cockroach start \

In a new terminal, restart the second node from the parent directory of `node2/`:

{% include copy-clipboard.html %}
~~~ shell
$ cockroach start \
--certs-dir=certs \
Expand All @@ -291,6 +307,7 @@ $ cockroach start \

In a new terminal, restart the third node from the parent directory of `node3/`:

{% include copy-clipboard.html %}
~~~ shell
$ cockroach start \
--certs-dir=certs \
Expand Down

0 comments on commit ce89376

Please sign in to comment.