From 676c172975e4d89f5c8126a8248bb9202ad80fce Mon Sep 17 00:00:00 2001 From: Chris Chinchilla Date: Mon, 7 Dec 2020 16:57:57 +0100 Subject: [PATCH] [DOCS] Fix grammar and create code snippet for step in quickstart (#2961) * Fix grammar and create code snippet for step in quickstart Signed-off-by: ChrisChinchilla * Update other files with readiness Signed-off-by: ChrisChinchilla --- site/content/how_to/cluster_hard_way.md | 19 ++++++++-- site/content/how_to/use_as_tsdb.md | 20 ++++++++-- .../includes/how_to/ready-namespace.sh | 4 ++ .../operational_guide/ready-namespace.sh | 4 ++ .../includes/quickstart/ready-namespace.sh | 4 ++ .../namespace_configuration.md | 38 +++++++++++++++---- site/content/quickstart/docker.md | 12 ++---- 7 files changed, 77 insertions(+), 24 deletions(-) create mode 100644 site/content/includes/how_to/ready-namespace.sh create mode 100644 site/content/includes/operational_guide/ready-namespace.sh create mode 100644 site/content/includes/quickstart/ready-namespace.sh diff --git a/site/content/how_to/cluster_hard_way.md b/site/content/how_to/cluster_hard_way.md index fd63e40ea7..9e714d1c78 100644 --- a/site/content/how_to/cluster_hard_way.md +++ b/site/content/how_to/cluster_hard_way.md @@ -163,14 +163,25 @@ Shortly after, you should see your node complete bootstrapping: 20:10:14.764771[I] successfully updated topology to 3 hosts ``` -Once the node has completed bootstrapping, mark the namespace as ready so the coordinator knows it's ready to receive reads and writes: +Once a namespace has finished bootstrapping, you must mark it as ready before receiving traffic by using the _{{% apiendpoint %}}namespace/ready_. -```shell -curl -X POST http://localhost:7201/api/v1/services/m3db/namespace/ready -d '{ - "name": "1week_namespace" +{{< tabs name="ready_namespaces" >}} +{{% tab name="Command" %}} + +{{% codeinclude file="how_to/ready-namespace.sh" language="shell" %}} + +{{% /tab %}} +{{% tab name="Output" %}} + +```json +{ + "ready": true } ``` +{{% /tab %}} +{{< /tabs >}} + If you need to setup multiple namespaces, you can run the above `/api/v1/database/create` command multiple times with different namespace configurations. ### Replication factor (RF) diff --git a/site/content/how_to/use_as_tsdb.md b/site/content/how_to/use_as_tsdb.md index 7de53aa09f..3317775d54 100644 --- a/site/content/how_to/use_as_tsdb.md +++ b/site/content/how_to/use_as_tsdb.md @@ -143,14 +143,26 @@ curl -X POST http://localhost:7201/api/v1/database/create -d '{ Note that the `retentionTime` is set artificially low to conserve resources. -After a few moments, the M3DB container should finish bootstrapping. Once bootstrapping is finished, mark the namespace as ready to receive traffic: +Once a namespace has finished bootstrapping, you must mark it as ready before receiving traffic by using the _{{% apiendpoint %}}namespace/ready_. -```shell -curl -X POST http://localhost:7201/api/v1/services/m3db/namespace/ready -d '{ - "name": "default" +{{< tabs name="ready_namespaces" >}} +{{% tab name="Command" %}} + +{{% codeinclude file="quickstart/ready-namespace.sh" language="shell" %}} + +{{% /tab %}} +{{% tab name="Output" %}} + +```json +{ + "ready": true } ``` +{{% /tab %}} +{{< /tabs >}} + + At this point it should be ready to serve write and read queries. #### Clients diff --git a/site/content/includes/how_to/ready-namespace.sh b/site/content/includes/how_to/ready-namespace.sh new file mode 100644 index 0000000000..18158c3b8a --- /dev/null +++ b/site/content/includes/how_to/ready-namespace.sh @@ -0,0 +1,4 @@ +#!/bin/bash +curl -X POST http://localhost:7201/api/v1/services/m3db/namespace/ready -d '{ + "name": "1week_namespace" +}' | jq . \ No newline at end of file diff --git a/site/content/includes/operational_guide/ready-namespace.sh b/site/content/includes/operational_guide/ready-namespace.sh new file mode 100644 index 0000000000..720f2e88c3 --- /dev/null +++ b/site/content/includes/operational_guide/ready-namespace.sh @@ -0,0 +1,4 @@ +#!/bin/bash +curl -X POST http://localhost:7201/api/v1/services/m3db/namespace/ready -d '{ + "name": "default_unaggregated" +}' | jq . \ No newline at end of file diff --git a/site/content/includes/quickstart/ready-namespace.sh b/site/content/includes/quickstart/ready-namespace.sh new file mode 100644 index 0000000000..8d5e44fdce --- /dev/null +++ b/site/content/includes/quickstart/ready-namespace.sh @@ -0,0 +1,4 @@ +#!/bin/bash +curl -X POST http://localhost:7201/api/v1/services/m3db/namespace/ready -d '{ + "name": "default" +}' | jq . \ No newline at end of file diff --git a/site/content/operational_guide/namespace_configuration.md b/site/content/operational_guide/namespace_configuration.md index 3e84abd1e2..ff8ae8a006 100644 --- a/site/content/operational_guide/namespace_configuration.md +++ b/site/content/operational_guide/namespace_configuration.md @@ -32,14 +32,25 @@ curl -X POST :/api/v1/ will create a namespace called `default_unaggregated` with a retention of `24 hours`. All of the other namespace options will either use reasonable default values or be calculated based on the provided `retentionTime`. -Adding a namespace requires you mark the namespace as ready once M3DB has finished bootstrapping it. This is done so that M3Coordinator knows the namespace is ready to receive reads and writes. Use the `api/v1/services/m3db/namespace/ready` endpoint to accomplish this: +Once a namespace has finished bootstrapping, you must mark it as ready so that M3Coordinator knows the namespace is ready to receive reads and writes by using the _{{% apiendpoint %}}namespace/ready_. -```shell -curl -X POST :/api/v1/services/m3db/namespace/ready -d '{ - "name": "default_unaggregated" +{{< tabs name="ready_namespaces" >}} +{{% tab name="Command" %}} + +{{% codeinclude file="operational_guide/ready-namespace.sh" language="shell" %}} + +{{% /tab %}} +{{% tab name="Output" %}} + +```json +{ + "ready": true } ``` +{{% /tab %}} +{{< /tabs >}} + If you feel the need to configure the namespace options yourself (for performance or other reasons), read the `Advanced` section below. #### Advanced (Hard Way) @@ -78,14 +89,25 @@ curl -X POST :/api/v1/ }' ``` -Adding a namespace requires you to mark the namespace as ready so M3Coordinator know it is ready to receive traffic: +Once a namespace has finished bootstrapping, you must mark it as ready so that M3Coordinator knows the namespace is ready to receive reads and writes by using the _{{% apiendpoint %}}namespace/ready_. -```shell -curl -X POST :/api/v1/services/m3db/namespace/ready -d '{ - "name": "default_unaggregated" +{{< tabs name="ready_namespaces_adv" >}} +{{% tab name="Command" %}} + +{{% codeinclude file="operational_guide/ready-namespace.sh" language="shell" %}} + +{{% /tab %}} +{{% tab name="Output" %}} + +```json +{ + "ready": true } ``` +{{% /tab %}} +{{< /tabs >}} + ### Deleting a Namespace Deleting a namespace is a simple as using the `DELETE` `/api/v1/services/m3db/namespace` API on an M3Coordinator instance. diff --git a/site/content/quickstart/docker.md b/site/content/quickstart/docker.md index 5ec608ecf6..029cb733f5 100644 --- a/site/content/quickstart/docker.md +++ b/site/content/quickstart/docker.md @@ -264,18 +264,14 @@ curl {{% apiendpoint %}}placement | jq . [Read more about the bootstrapping process](/docs/operational_guide/bootstrapping_crash_recovery/). {{% /notice %}} -### Readying a Namespace - -Once a namespace has finished bootstrapping, it must be marked as ready before receiving traffic. This can be done by calling the _{{% apiendpoint %}}namespace/ready_. +### Ready a Namespace + +Once a namespace has finished bootstrapping, you must mark it as ready before receiving traffic by using the _{{% apiendpoint %}}namespace/ready_. {{< tabs name="ready_namespaces" >}} {{% tab name="Command" %}} -```shell -curl -X POST http://localhost:7201/api/v1/services/m3db/namespace/ready -d '{ - "name": "default" -}' | jq . -``` +{{% codeinclude file="quickstart/ready-namespace.sh" language="shell" %}} {{% /tab %}} {{% tab name="Output" %}}