Skip to content

Commit bb1784e

Browse files
committed
3.0 config - update per TW review
1 parent 382b36b commit bb1784e

File tree

2 files changed

+49
-23
lines changed

2 files changed

+49
-23
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

+48-23
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,57 @@
33
Configuration
44
=============
55

6+
Tarantool provides the ability to configure the full topology of a cluster and set parameters specific for concrete instances, such as 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 the 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* represents a single running Tarantool instance.
49+
It stores data or might act as a router for handling CRUD requests in a :ref:`sharded <sharding>` cluster.
50+
- ``replicasets``
51+
52+
A *replica set* is a pack of instances that operate on same data sets.
2953
:ref:`Replication <replication>` provides redundancy and increases data availability.
30-
- A *group* provides the ability to organize replica sets.
54+
- ``groups``
55+
56+
A *group* provides the ability to organize replica sets.
3157
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.
3258

3359
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 +122,7 @@ Most of the configuration options can be applied to a specific instance, replica
96122

97123
- *Global*
98124

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

101127
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/global_scope/config.yaml
102128
:language: yaml
@@ -106,7 +132,7 @@ Most of the configuration options can be applied to a specific instance, replica
106132

107133
.. NOTE::
108134

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

111137

112138
.. _configuration_replica_set_scopes:
@@ -119,13 +145,12 @@ You can learn more about configuring replication from :ref:`Replication tutorial
119145

120146
.. literalinclude:: /code_snippets/snippets/replication/instances.enabled/manual_leader/config.yaml
121147
:language: yaml
122-
:emphasize-lines: 1-8,10-12,14-15,21,24-25,27-28,30-31
123148
:end-before: Load sample data
124149
:dedent:
125150

126151
- ``credentials`` (*global*)
127152

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

131156
- ``iproto`` (*global*, *instance*)
@@ -150,7 +175,7 @@ You can learn more about configuring replication from :ref:`Replication tutorial
150175
Loading an application
151176
**********************
152177

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

156181
In the example below, the application is loaded from the ``myapp.lua`` file placed next to the YAML configuration file:
@@ -202,7 +227,7 @@ In a configuration file, you can use the following predefined variables that are
202227
- ``replicaset_name``
203228
- ``group_name``
204229

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

208233
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/templating/config.yaml
@@ -220,10 +245,10 @@ Environment variables
220245

221246
For each configuration parameter, Tarantool provides two sets of predefined environment variables:
222247

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

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

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

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

241266
.. code-block:: console
242267
@@ -248,28 +273,28 @@ Below are a few examples that show how to set environment variables of different
248273
249274
$ export TT_IPROTO_LISTEN='127.0.0.1:3311,127.0.0.1:3312'
250275
251-
* (*Number*) In this example, ``TT_LOG_LEVEL`` is used to set a logging level to 3 (``CRITICAL``):
276+
* Number. In this example, ``TT_LOG_LEVEL`` is used to set a logging level to 3 (``CRITICAL``):
252277

253278
.. code-block:: console
254279
255280
$ export TT_LOG_LEVEL=3
256281
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* ...
282+
* Array. The examples below show how to set the ``TT_SHARDING_ROLES`` variable that accepts an array value.
283+
Arrays can be passed in two ways: using a *simple* ...
259284

260285
.. code-block:: console
261286
262287
$ export TT_SHARDING_ROLES=router,storage
263288
264-
or *JSON* format:
289+
... or *JSON* format:
265290

266291
.. code-block:: console
267292
268293
$ export TT_SHARDING_ROLES='["router", "storage"]'
269294
270295
The *simple* format is applicable only to arrays containing scalar values.
271296

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

275300
.. code-block:: console
@@ -394,7 +419,7 @@ Below are a few examples on how to do this:
394419
Access control
395420
~~~~~~~~~~~~~~
396421

397-
The ``credentials`` section allows you to grant the specified privileges to users.
422+
The ``credentials`` section allows you to create users and grant them the specified privileges.
398423
In the example below, there are two users:
399424

400425
* The *replicator* user is used for replication and has a corresponding role.

0 commit comments

Comments
 (0)