Skip to content

Commit fe01b27

Browse files
committed
Hot standby reference
1 parent f9cba27 commit fe01b27

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

doc/reference/configuration/configuration_reference.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,6 +1428,44 @@ The ``database`` section defines database-specific configuration parameters, suc
14281428

14291429
.. confval:: database.hot_standby
14301430

1431+
Whether to start the server in the hot standby mode.
1432+
This mode can be used to provide failover without :ref:`replication <replication>`.
1433+
1434+
Suppose, there are two cluster applications.
1435+
Each cluster have one instance with the same configuration:
1436+
1437+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/hot_standby_1/config.yaml
1438+
:language: yaml
1439+
:dedent:
1440+
1441+
In particular, both instances use the same directory for storing write-ahead logs and snapshots.
1442+
1443+
When you start both cluster applications at the same machine, the first one will be the "primary" instance and the second will be the "standby" instance.
1444+
In the :ref:`logs <configuration_reference_log>` of the second cluster instance, you should see a notification:
1445+
1446+
.. code-block:: text
1447+
1448+
main/104/interactive I> Entering hot standby mode
1449+
1450+
This means that the standby instance is ready to take over if the primary instance goes down.
1451+
The standby instance initializes and tries to take a lock on a directory for storing write-ahead logs
1452+
but fails because the primary instance has made a lock on this directory.
1453+
So the standby instance goes into a loop, reading the write-ahead log which
1454+
the primary instance is writing (), and trying to take the lock.
1455+
So the two instances are always in sync.
1456+
1457+
If the primary instance goes down for any reason, the lock is released.
1458+
In this case, the standby instance succeeds in taking the lock and becomes the primary instance.
1459+
1460+
``database.hot_standby`` has no effect:
1461+
1462+
* If :ref:`wal.mode <configuration_reference_wal_mode>` is ``none``.
1463+
* On macOS and FreeBSD if :ref:`wal.dir_rescan_delay <configuration_reference_wal_dir_rescan_delay>` is a large value; on these platforms, the hot standby mode is designed so that the loop repeats every
1464+
``wal.dir_rescan_delay`` seconds.
1465+
* For spaces created with :doc:`engine = 'vinyl' </reference/reference_lua/box_schema/space_create>`.
1466+
1467+
Examples on GitHub: `hot_standby_1 <https://github.com/tarantool/doc/tree/latest/doc/code_snippets/snippets/config/instances.enabled/hot_standby_1>`_, `hot_standby_2 <https://github.com/tarantool/doc/tree/latest/doc/code_snippets/snippets/config/instances.enabled/hot_standby_2>`_
1468+
14311469
|
14321470
| Type: boolean
14331471
| Default: false

0 commit comments

Comments
 (0)