Skip to content

Commit 04b2319

Browse files
TCM get started: merge samples (#4030)
1 parent f4a3941 commit 04b2319

File tree

7 files changed

+37
-16
lines changed

7 files changed

+37
-16
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Getting started with Tarantool Cluster Manager
2+
3+
A sample application created in the [Getting started with Tarantool Cluster Manager](https://www.tarantool.io/en/doc/latest/how-to/getting_started_tcm/) tutorial.
4+
5+
## Running
6+
7+
Before starting instances, set up a Tarantool EE cluster as described in the tutorial.
8+
Then, start all instances by executing the following command in the [config](../../../config) directory:
9+
10+
```console
11+
$ tt start tcm_get_started
12+
```
13+
14+
>
15+
> To publish a cluster's configuration to etcd using tt, execute `tt cluster publish`:
16+
>
17+
> ```shell
18+
> tt cluster publish "http://localhost:2379/default" instances.enabled/tcm_get_started/cluster.yaml
19+
> ```

doc/code_snippets/snippets/config/instances.enabled/tcm_get_started_config/config.yaml renamed to doc/code_snippets/snippets/config/instances.enabled/tcm_get_started/cluster.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ groups:
2727
listen:
2828
- uri: '127.0.0.1:3303'
2929
advertise:
30-
client: '127.0.0.1:3303'
30+
client: '127.0.0.1:3303'

doc/code_snippets/snippets/config/instances.enabled/tcm_get_started_tt/config.yaml renamed to doc/code_snippets/snippets/config/instances.enabled/tcm_get_started/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ config:
22
etcd:
33
endpoints:
44
- http://localhost:2379
5-
prefix: /default
5+
prefix: /default
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
instance-001:
22
instance-002:
3-
instance-003:
3+
instance-003:

doc/code_snippets/snippets/config/instances.enabled/tcm_get_started_tt/myapp.lua renamed to doc/code_snippets/snippets/config/instances.enabled/tcm_get_started/myapp.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ end
1717

1818
function select_data()
1919
box.space.bands:select { 3 }
20-
end
20+
end

doc/code_snippets/snippets/config/instances.enabled/tcm_get_started_tt/instances.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

doc/how-to/getting_started_tcm.rst

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Getting started with Tarantool Cluster Manager
88

99
This tutorial uses `Tarantool Enterprise Edition <https://www.tarantool.io/compare/>`_.
1010

11+
**Example on GitHub**: `tcm_get_started <https://github.com/tarantool/doc/tree/latest/doc/code_snippets/snippets/config/instances.enabled/tcm_get_started>`_
12+
1113
In this tutorial, you get :ref:`tcm` up and running on your local system, deploy
1214
a local Tarantool EE cluster, and learn to manage the cluster from the |tcm| web UI.
1315

@@ -179,7 +181,7 @@ To write the cluster configuration and upload it to the etcd storage:
179181
#. Click **+** and provide an arbitrary name for the configuration file, for example, ``all``.
180182
#. Paste the following :ref:`YAML configuration <configuration_overview>` into the editor:
181183

182-
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/tcm_get_started_config/config.yaml
184+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/tcm_get_started/cluster.yaml
183185
:language: yaml
184186
:dedent:
185187

@@ -229,14 +231,14 @@ To deploy a local cluster based on the configuration from etcd:
229231

230232
* ``instances.yml`` specifies instances to run in the current environment. In this example, there are three instances:
231233

232-
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/tcm_get_started_tt/instances.yml
234+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/tcm_get_started/instances.yml
233235
:language: yaml
234236
:dedent:
235237

236238
* ``config.yaml`` instructs ``tt`` to load the cluster configuration from etcd.
237239
The specified etcd location matches the configuration storage of the **Default cluster** in TCM:
238240

239-
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/tcm_get_started_tt/config.yaml
241+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/tcm_get_started/config.yaml
240242
:language: yaml
241243
:dedent:
242244

@@ -309,9 +311,10 @@ Creating a space
309311
Go to the terminal of ``instance-001`` (the leader instance) and run the following code to
310312
create a formatted space with a primary index in the cluster:
311313

312-
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/tcm_get_started_tt/myapp.lua
314+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/tcm_get_started/myapp.lua
313315
:language: lua
314-
:lines: 2-8
316+
:start-at: box.schema.space.create
317+
:end-at: box.space.bands:create_index
315318
:dedent:
316319

317320
.. _getting_started_tcm_manage_write:
@@ -323,9 +326,10 @@ Since ``instance-001`` is a read-write instance (its ``box.info.ro`` is ``false`
323326
the write requests must be executed on it. Run the following code in the ``instance-001``
324327
terminal to write tuples in the space:
325328

326-
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/tcm_get_started_tt/myapp.lua
329+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/tcm_get_started/myapp.lua
327330
:language: lua
328-
:lines: 13-15
331+
:start-at: 'Roxette'
332+
:end-at: 'Ace of Base'
329333
:dedent:
330334

331335
.. _getting_started_tcm_manage_read:
@@ -335,9 +339,10 @@ Reading data
335339

336340
Check the space's tuples by running a read request on ``instance-001``:
337341

338-
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/tcm_get_started_tt/myapp.lua
342+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/tcm_get_started/myapp.lua
339343
:language: lua
340-
:lines: 19
344+
:start-at: box.space.bands:select
345+
:end-at: box.space.bands:select
341346
:dedent:
342347

343348
This is how it looks in |tcm|:

0 commit comments

Comments
 (0)