Skip to content

Commit a6e76c9

Browse files
committed
Hot standby reference
1 parent f9cba27 commit a6e76c9

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

doc/reference/configuration/configuration_reference.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,6 +1428,43 @@ 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 has 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 on the same machine, the instance from 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 both 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 set to ``none``.
1463+
* If :ref:`wal.dir_rescan_delay <configuration_reference_wal_dir_rescan_delay>` is set to a large value on macOS or FreeBSD. On these platforms, the hot standby mode is designed so that the loop repeats every ``wal.dir_rescan_delay`` seconds.
1464+
* If spaces are created with :ref:`engine <space_opts_engine>` set to ``vinyl``.
1465+
1466+
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>`_
1467+
14311468
|
14321469
| Type: boolean
14331470
| Default: false

0 commit comments

Comments
 (0)