Skip to content

Commit fdf8244

Browse files
committed
3.0 config - update per TW review
1 parent 5cbe38a commit fdf8244

File tree

2 files changed

+47
-22
lines changed

2 files changed

+47
-22
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
-- myapp.lua --
12
local log = require('log').new("myapp")
23
local config = require('config')
34
log.info("%s from app, %s!", config:get('app.cfg.greeting'), box.info.name)

doc/concepts/configuration.rst

+46-22
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,56 @@
33
Configuration
44
=============
55

6+
Tarantool provides the ability to configure the full topology of a cluster and set parameters specific for concrete instances, like connection settings, memory used to store data, logging, and snapshot settings.
7+
Each instance uses this configuration during :ref:`startup <configuration_run_instance>` to organize the cluster.
8+
69
There are two approaches to configuring Tarantool:
710

8-
* *Since version 3.0*: In a YAML file.
11+
* *Since version 3.0*: In a YAML format.
912

10-
In a YAML file, you can provide the full cluster topology and specify all configuration options.
11-
You can also use :ref:`etcd <configuration_etcd_overview>` to store configuration data in one reliable place.
13+
YAML configuration allows you to provide the full cluster topology and specify all configuration options.
14+
You can use local configuration in a YAML file for each instance or store configuration data in one reliable place using :ref:`etcd <configuration_etcd_overview>`.
1215

1316
* *In version 2.11 and earlier*: :ref:`In code <configuration_code>` using the ``box.cfg`` API.
1417

1518
In this case, configuration is provided in a Lua initialization script.
16-
Starting with the 3.0 version, configuring Tarantool in code is considered a legacy approach.
19+
20+
.. NOTE::
21+
22+
Starting with the 3.0 version, configuring Tarantool in code is considered a legacy approach.
1723

1824

1925
.. _configuration_overview:
2026

2127
Configuration overview
2228
----------------------
2329

24-
A YAML configuration file describes the full topology of a Tarantool cluster.
30+
YAML configuration describes the full topology of a Tarantool cluster.
2531
A cluster's topology includes the following elements, starting from the lower level:
2632

27-
- An *instance* is a member of the cluster that stores data or might act as a router for handling CRUD requests in a :ref:`sharded <sharding>` cluster.
28-
- A *replica set* is a pack of instances that operate on copies of the same databases.
33+
.. code-block:: yaml
34+
:emphasize-lines: 1,3,5
35+
36+
groups:
37+
group001:
38+
replicasets:
39+
replicaset001:
40+
instances:
41+
instance001:
42+
# ...
43+
instance002:
44+
# ...
45+
46+
- ``instances``
47+
48+
An *instance* is a member of the cluster that stores data or might act as a router for handling CRUD requests in a :ref:`sharded <sharding>` cluster.
49+
- ``replicasets``
50+
51+
A *replica set* is a pack of instances that operate on copies of the same databases.
2952
:ref:`Replication <replication>` provides redundancy and increases data availability.
30-
- A *group* provides the ability to organize replica sets.
53+
- ``groups``
54+
55+
A *group* provides the ability to organize replica sets.
3156
For example, in a sharded cluster, one group can contain :ref:`storage <vshard-architecture-storage>` instances and another group can contain :ref:`routers <vshard-architecture-router>` used to handle CRUD requests.
3257

3358
You can flexibly configure a cluster's settings on different levels: from global settings applied to all groups to parameters specific for concrete instances.
@@ -96,7 +121,7 @@ Most of the configuration options can be applied to a specific instance, replica
96121

97122
- *Global*
98123

99-
In this example, ``iproto.listen`` is applied to all instances of all groups.
124+
In this example, ``iproto.listen`` is applied to all instances of the cluster.
100125

101126
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/global_scope/config.yaml
102127
:language: yaml
@@ -106,7 +131,7 @@ Most of the configuration options can be applied to a specific instance, replica
106131

107132
.. NOTE::
108133

109-
The :ref:`Configuration reference <configuration_reference>` contains information to which scopes each configuration option can be applied.
134+
The :ref:`Configuration reference <configuration_reference>` contains information about scopes to which each configuration option can be applied.
110135

111136

112137
.. _configuration_replica_set_scopes:
@@ -119,13 +144,12 @@ You can learn more about configuring replication from :ref:`Replication tutorial
119144

120145
.. literalinclude:: /code_snippets/snippets/replication/instances.enabled/manual_leader/config.yaml
121146
:language: yaml
122-
:emphasize-lines: 1-8,10-12,14-15,21,24-25,27-28,30-31
123147
:end-before: Load sample data
124148
:dedent:
125149

126150
- ``credentials`` (*global*)
127151

128-
Options in this section grant the specified roles to the *replicator* and *client* users.
152+
This section is used to create the *replicator* and *client* users and assign them the specified roles.
129153
These options are applied globally to all instances.
130154

131155
- ``iproto`` (*global*, *instance*)
@@ -150,7 +174,7 @@ You can learn more about configuring replication from :ref:`Replication tutorial
150174
Loading an application
151175
**********************
152176

153-
Using Tarantool as an application server, you can write your own applications in Lua.
177+
Using Tarantool as an application server, you can run your own Lua applications.
154178
In the ``app`` section, you can load the application and provide a custom application configuration in the ``cfg`` section.
155179

156180
In the example below, the application is loaded from the ``myapp.lua`` file placed next to the YAML configuration file:
@@ -202,7 +226,7 @@ In a configuration file, you can use the following predefined variables that are
202226
- ``replicaset_name``
203227
- ``group_name``
204228

205-
To reference such variables in a configuration file, use double curly braces.
229+
To reference these variables in a configuration file, enclose them in double curly braces with whitespaces.
206230
In the example below, ``{{ instance_name }}`` is replaced with *instance001*.
207231

208232
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/templating/config.yaml
@@ -220,10 +244,10 @@ Environment variables
220244

221245
For each configuration parameter, Tarantool provides two sets of predefined environment variables:
222246

223-
* Variables whose names start with ``TT_`` are used to substitute parameters specified in a configuration file.
247+
* ``TT_<CONFIG_PARAMETER>``. These variables are used to substitute parameters specified in a configuration file.
224248
This means that these variables have a higher :ref:`priority <configuration_precedence>` than the options specified in a configuration file.
225249

226-
* Variables whose names start with ``TT_`` and end with ``_DEFAULT`` are used to specify default values for parameters missing in a configuration file.
250+
* ``TT_<CONFIG_PARAMETER>_DEFAULT``. These variables are used to specify default values for parameters missing in a configuration file.
227251
These variables have a lower :ref:`priority <configuration_precedence>` than the options specified in a configuration file.
228252

229253
For example, ``TT_IPROTO_LISTEN`` and ``TT_IPROTO_LISTEN_DEFAULT`` correspond to the ``iproto.listen`` option.
@@ -236,7 +260,7 @@ To see all the supported environment variables, execute the ``tarantool`` comman
236260
237261
Below are a few examples that show how to set environment variables of different types, like *string*, *number*, *array*, or *map*:
238262

239-
* (*String*) In the example below, ``TT_IPROTO_LISTEN`` is used to specify a :ref:`listening host and port <configuration_options_connection>` values:
263+
* String. In the example below, ``TT_IPROTO_LISTEN`` is used to specify a :ref:`listening host and port <configuration_options_connection>` values:
240264

241265
.. code-block:: console
242266
@@ -248,28 +272,28 @@ Below are a few examples that show how to set environment variables of different
248272
249273
$ export TT_IPROTO_LISTEN='127.0.0.1:3311,127.0.0.1:3312'
250274
251-
* (*Number*) In this example, ``TT_LOG_LEVEL`` is used to set a logging level to 3 (``CRITICAL``):
275+
* Number. In this example, ``TT_LOG_LEVEL`` is used to set a logging level to 3 (``CRITICAL``):
252276

253277
.. code-block:: console
254278
255279
$ export TT_LOG_LEVEL=3
256280
257-
* (*Array*) The examples below show how to set the ``TT_SHARDING_ROLES`` variable that accepts an array value.
258-
Arrays can be passed in a *simple* ...
281+
* Array. The examples below show how to set the ``TT_SHARDING_ROLES`` variable that accepts an array value.
282+
Arrays can be passed in two ways: using a *simple* ...
259283

260284
.. code-block:: console
261285
262286
$ export TT_SHARDING_ROLES=router,storage
263287
264-
or *JSON* format:
288+
... or *JSON* format:
265289

266290
.. code-block:: console
267291
268292
$ export TT_SHARDING_ROLES='["router", "storage"]'
269293
270294
The *simple* format is applicable only to arrays containing scalar values.
271295

272-
* (*Map*) To assign map values to environment variables, you can also use *simple* or *JSON* formats.
296+
* Map. To assign map values to environment variables, you can also use *simple* or *JSON* formats.
273297
In the example below, ``TT_LOG_MODULES`` sets different logging levels for different modules using a *simple* format:
274298

275299
.. code-block:: console

0 commit comments

Comments
 (0)