Skip to content

Commit 134ab56

Browse files
committed
persistence: update topic and reference section
1 parent dd7f600 commit 134ab56

File tree

10 files changed

+370
-126
lines changed

10 files changed

+370
-126
lines changed

doc/book/admin/backups.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ that are made after the last snapshot are incremental backups. Therefore taking
3737
a backup is a matter of copying the snapshot and WAL files.
3838

3939
1. Use ``tar`` to make a (possibly compressed) copy of the latest .snap and .xlog
40-
files on the :ref:`memtx_dir <cfg_basic-memtx_dir>` and
41-
:ref:`wal_dir <cfg_basic-wal_dir>` directories.
40+
files on the :ref:`snapshot.dir <configuration_reference_snapshot_dir>` and
41+
:ref:`wal.dir <configuration_reference_wal_dir>` directories.
4242

4343
2. If there is a security policy, encrypt the .tar file.
4444

4545
3. Copy the .tar file to a safe place.
4646

4747
Later, restoring the database is a matter of taking the .tar file and putting
48-
its contents back in the ``memtx_dir`` and ``wal_dir`` directories.
48+
its contents back in the ``snapshot.dir`` and ``wal.dir`` directories.
4949

5050
.. _admin-backups-hot_backup_vinyl_memtx:
5151

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
wal:
2+
ext:
3+
new: true
4+
old: true
5+
spaces:
6+
bands:
7+
new: false
8+
mode: 'write'
9+
dir: ''
10+
dir_rescan_delay: 3
11+
cleanup_delay: 18000
12+
max_size: 268435456
13+
14+
snapshot:
15+
dir:
16+
snap_io_rate_limit:
17+
by:
18+
interval: 60
19+
count: 10
20+
21+
22+
groups:
23+
group001:
24+
replicasets:
25+
replicaset001:
26+
instances:
27+
instance001:
28+
iproto:
29+
listen:
30+
- uri: '127.0.0.1:3301'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
instance001:

doc/concepts/configuration.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,8 @@ When the limit is reached, ``INSERT`` or ``UPDATE`` requests fail with :ref:`ER_
429429
Snapshots and write-ahead logs
430430
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
431431

432-
The ``snapshot.dir`` and ``wal.dir`` options can be used to configure directories for storing snapshots and write-ahead logs.
432+
The :ref:`snapshot.dir <configuration_reference_snapshot_dir>` and :ref:`wal.dir <configuration_reference_wal_dir>`
433+
options can be used to configure directories for storing snapshots and write-ahead logs.
433434
For example, you can place snapshots and write-ahead logs on different hard drives for better reliability.
434435

435436
.. code-block:: yaml
@@ -450,6 +451,7 @@ To learn more about the persistence mechanism in Tarantool, see the :ref:`Persis
450451

451452
configuration/configuration_etcd
452453
configuration/configuration_code
454+
configuration/configuration_persistence
453455
configuration/configuration_connections
454456
configuration/configuration_authentication
455457
.. configuration/configuration_migrating
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
.. _configuration_persistence:
2+
3+
Persistence
4+
===========
5+
6+
**Example on GitHub**: `persistence <https://github.com/tarantool/doc/tree/latest/doc/code_snippets/snippets/config/instances.enabled/persistence>`_
7+
8+
To ensure data persistence, Tarantool provides the abilities to:
9+
10+
* record each data change request into a write-ahead log (WAL) file
11+
* take snapshots that contain on-disk copy of the entire data set for a given moment
12+
13+
During the recovery process, Tarantool can load the latest snapshot file and then read the requests from the WAL files,
14+
produced after this snapshot was made.
15+
16+
.. _configuration_persistence_wal:
17+
18+
Configure the write-ahead log
19+
-----------------------------
20+
21+
.. _configuration_persistence_wal_mode:
22+
23+
Set the WAL mode
24+
~~~~~~~~~~~~~~~~
25+
26+
To be able to recover data in case of a possible instance restart, enable recording to the write-ahead log.
27+
To do it, set the :ref:`wal.mode <configuration_reference_wal_mode>` configuration option to ``write`` or ``fsync``:
28+
29+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/persistence/config.yaml
30+
:language: yaml
31+
:start-at: mode:
32+
:end-at: 'write'
33+
:dedent:
34+
35+
An exclusion from this is when the instance is processing data that can be freely rejected.
36+
For example, when Tarantool is used for caching, WAL can be disabled to reduce i/o load.
37+
38+
To turn the WAL writer off, set the ``wal.mode`` option to ``none``.
39+
40+
.. _configuration_persistence_wal_dir:
41+
42+
Specify a directory for WAL files
43+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
44+
45+
46+
47+
.. _configuration_persistence_snapshot:
48+
49+
Configure the snapshots
50+
-----------------------
51+
52+
53+
54+
The :ref:`snapshot.by.interval <cfg_checkpoint_daemon-checkpoint_interval>` and
55+
:ref:`checkpoint_count <cfg_checkpoint_daemon-checkpoint_count>` configuration
56+
settings determine how long the intervals are, and how many snapshots should
57+
exist before deletions occur.
58+
- One or several URIs used to listen for incoming requests.
59+
- An URI used to advertise an instance to other cluster members. This URI lets other cluster members know how to connect to the current Tarantool instance.
60+
- (Optional) SSL settings used to secure connections between instances.
61+
62+
Configuring connection settings is also required to enable communication of a Tarantool cluster to external systems.
63+
For example, this might be administering cluster members using :ref:`tt <tt-cli>`, managing clusters using :ref:`Tarantool Cluster Manager <tcm>`, or using :ref:`connectors <index-box_connectors>` for different languages.
64+
65+
This topic describes how to define connection settings in the :ref:`iproto <configuration_reference_iproto>` section of a YAML configuration.

doc/concepts/data_model/persistence.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ In such case, Tarantool restores the data from WAL files
1212
by reading them and redoing the requests.
1313
This is called the "recovery process".
1414
You can change the timing of the WAL writer or turn it off by setting
15-
the :ref:`wal_mode <cfg_binary_logging_snapshots-wal_mode>`.
15+
the :ref:`wal.mode <configuration_reference_wal_mode>`.
1616

1717
Tarantool also maintains a set of :ref:`snapshot files <internals-snapshot>`.
1818
These files contain an on-disk copy of the entire data set for a given moment.

doc/enterprise/flight_recorder.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ to :ref:`crashing <admin-disaster_recovery>` a Tarantool instance.
1717

1818
.. _enterprise-flight-recorder_enable:
1919

20-
Enabling the flight recorder
21-
----------------------------
20+
Enable the flight recorder
21+
--------------------------
2222

2323
The flight recorder is disabled by default and can be enabled and configured for
2424
a specific Tarantool instance.
@@ -33,7 +33,7 @@ configuration option to ``true``.
3333

3434

3535
After ``flightrec.enabled`` is set to ``true``, the flight recorder starts collecting data in the flight recording file ``current.ttfr``.
36-
This file is stored in the ``snapshot.dir`` directory.
36+
This file is stored in the :ref:`snapshot.dir <configuration_reference_snapshot_dir>` directory.
3737
By default, the directory is ``var/lib/{{ instance_name }}/<file_name>.ttfr``.
3838

3939
If the instance crashes and reboots, Tarantool rotates the flight recording:
@@ -49,8 +49,8 @@ Tarantool continues writing to the existing ``current.ttfr`` file after restart.
4949

5050
.. _enterprise-flight-recorder_configure:
5151

52-
Configuring a flight recorder
53-
-----------------------------
52+
Configure a flight recorder
53+
---------------------------
5454

5555
When the flight recorder is enabled, you can set the options related to :ref:`logging <cfg_logging-log>`,
5656
:ref:`metrics <metrics-reference>`, and storing the :ref:`request and response <internals-requests_responses>` data.

doc/enterprise/wal_extensions.rst

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. _wal_extensions:
1+
.. _wal_extensions:
22

33
WAL extensions
44
==============
@@ -8,47 +8,49 @@ For example, you can enable storing an old and new tuple for each CRUD operation
88
This information might be helpful for implementing a CDC (Change Data Capture) utility
99
that transforms a data replication stream.
1010

11-
.. _wal_extensions_configuration:
11+
.. _wal_extensions_configuration:
1212

1313
Configuration
1414
-------------
1515

16-
To configure WAL extensions, use the ``wal.ext`` :ref:`configuration property <configuration_reference_wal>`.
17-
Inside the ``wal_ext`` block, you can enable storing old and new tuples as follows:
16+
WAL extensions are disabled by default.
17+
To configure them, use the :ref:`wal.ext.* <configuration_reference_wal_ext>` configuration options.
18+
Inside the ``wal.ext`` block, you can enable storing old and new tuples as follows:
1819

19-
* Set the ``old`` and ``new`` options to ``true`` to store old and new tuples in a write-ahead log for all spaces.
20+
* To store old and new tuples in a write-ahead log for all spaces, set the
21+
:ref:`wal.ext.old <configuration_reference_wal_ext_old>` and `wal.ext.new <configuration_reference_wal_ext_new>`
22+
options to ``true``:
2023

21-
.. code-block:: lua
24+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/persistence/config.yaml
25+
:language: yaml
26+
:start-at: wal:
27+
:end-at: old: true
28+
:dedent:
2229

23-
box.cfg {
24-
wal_ext = { old = true, new = true }
25-
}
30+
* To adjust these options for specific spaces, specify the :ref:`wal.ext.spaces <configuration_reference_wal_ext_spaces>` option:
2631

27-
* To adjust these options for specific spaces, use the ``spaces`` option.
32+
.. code-block:: yaml
2833
29-
.. code-block:: lua
34+
wal:
35+
ext:
36+
old: true
37+
new: true
38+
spaces:
39+
space1:
40+
old: false
41+
space2:
42+
new: false
3043
31-
box.cfg {
32-
wal_ext = {
33-
old = true, new = true,
34-
spaces = {
35-
space1 = { old = false },
36-
space2 = { new = false }
37-
}
38-
}
39-
}
40-
41-
42-
The configuration for specific spaces has priority over the global configuration,
43-
so only new tuples are added to the log for ``space1`` and only old tuples for ``space2``.
44+
The configuration for specific spaces has priority over the configuration in the ``wal.ext.new`` and ``wal.ext.old``
45+
options.
46+
It means that only new tuples are added to the log for ``space1`` and only old tuples for ``space2``.
4447

4548
Note that records with additional fields are :ref:`replicated <replication-architecture>` as follows:
4649

4750
* If a replica doesn't support the extended format configured on a master, auxiliary fields are skipped.
4851
* If a replica and master have different configurations for WAL records, a master's configuration is ignored.
4952

50-
51-
.. _wal_extensions_example:
53+
.. _wal_extensions_example:
5254

5355
Example
5456
-------

0 commit comments

Comments
 (0)