Skip to content

Commit b0ef2dd

Browse files
Document the 'replication.anon' config option (#4344)
1 parent 089122e commit b0ef2dd

File tree

7 files changed

+102
-29
lines changed

7 files changed

+102
-29
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Anonymous replica
2+
3+
A sample application demonstrating how to add an anonymous replica to a replica set.
4+
5+
## Running
6+
7+
To start all instances, execute the following command in the [replication](../../../replication) directory:
8+
9+
```console
10+
$ tt start anonymous_replica
11+
```
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
credentials:
2+
users:
3+
replicator:
4+
password: 'topsecret'
5+
roles: [replication]
6+
7+
iproto:
8+
advertise:
9+
peer:
10+
login: replicator
11+
12+
replication:
13+
failover: manual
14+
15+
groups:
16+
group001:
17+
replicasets:
18+
replicaset001:
19+
leader: instance001
20+
instances:
21+
instance001:
22+
iproto:
23+
listen:
24+
- uri: '127.0.0.1:3301'
25+
instance002:
26+
iproto:
27+
listen:
28+
- uri: '127.0.0.1:3302'
29+
instance003:
30+
replication:
31+
anon: true
32+
iproto:
33+
listen:
34+
- uri: '127.0.0.1:3303'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
instance001:
2+
instance002:
3+
instance003:

doc/dev_guide/internals/iproto/keys.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ General replication
229229
* - :ref:`IPROTO_BALLOT_IS_ANON <internals-iproto-keys-ballot>`
230230
- 0x05 |br| MP_BOOL
231231
- True if the replica is anonymous.
232-
Corresponds to :ref:`box.cfg.replication_anon <cfg_replication-replication_anon>`.
232+
Corresponds to :ref:`replication.anon <configuration_reference_replication_anon>`.
233233
Since :doc:`2.7.1 </release/2.7.1>`
234234

235235
* - :ref:`IPROTO_BALLOT_IS_BOOTED <internals-iproto-keys-ballot>`

doc/dev_guide/internals/iproto/replication.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ General
4545
* - IPROTO_FETCH_SNAPSHOT
4646
- 0x45
4747
- Fetch the master's snapshot and start anonymous replication.
48-
See :ref:`replication_anon <cfg_replication-replication_anon>`
48+
See :ref:`replication.anon <configuration_reference_replication_anon>`
4949

5050
* - IPROTO_REGISTER
5151
- 0x46

doc/reference/configuration/configuration_reference.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2841,6 +2841,37 @@ The ``replication`` section defines configuration parameters related to :ref:`re
28412841

28422842
.. confval:: replication.anon
28432843

2844+
Whether to make the current instance act as an anonymous replica.
2845+
Anonymous replicas are read-only and can be used, for example, for backups.
2846+
2847+
To make the specified instance act as an anonymous replica, set ``replication.anon`` to ``true``:
2848+
2849+
.. literalinclude:: /code_snippets/snippets/replication/instances.enabled/anonymous_replica/config.yaml
2850+
:language: yaml
2851+
:start-at: instance003
2852+
:end-at: anon: true
2853+
:dedent:
2854+
2855+
You can find the full example on GitHub: `anonymous_replica <https://github.com/tarantool/doc/tree/latest/doc/code_snippets/snippets/replication/instances.enabled/anonymous_replica>`_.
2856+
2857+
Anonymous replicas are not displayed in the :ref:`box.info.replication <box_info_replication>` section.
2858+
You can check their status using :ref:`box.info.replication_anon() <box_info_replication-anon>`.
2859+
2860+
While anonymous replicas are read-only, you can write data to replication-local and temporary spaces (:ref:`created <box_schema-space_create>` with ``is_local = true`` and ``temporary = true``, respectively).
2861+
Given that changes to replication-local spaces are allowed, an anonymous replica might increase the ``0`` component of the :ref:`vclock <box_introspection-box_info>` value.
2862+
2863+
Here are the limitations of having anonymous replicas in a replica set:
2864+
2865+
* A replica set must contain at least one non-anonymous instance.
2866+
* An anonymous replica can't be configured as a writable instance by setting :ref:`database.mode <configuration_reference_database_mode>` to ``rw`` or making it a leader using :ref:`<replicaset_name>.leader <configuration_reference_replicasets_name_leader>`.
2867+
* If :ref:`replication.failover <configuration_reference_replication_failover>` is set to ``election``, an anonymous replica can have :ref:`replication.election_mode <configuration_reference_replication_election_mode>` set to ``off`` only.
2868+
* If :ref:`replication.failover <configuration_reference_replication_failover>` is set to ``supervised``, an external failover coordinator doesn't consider anonymous replicas when selecting a bootstrap or replica set leader.
2869+
2870+
.. NOTE::
2871+
2872+
Anonymous replicas are not registered in the :ref:`_cluster <box_space-cluster>` table.
2873+
This means that there is no :ref:`limitation <limitations_replicas>` on the number of anonymous replicas in a replica set.
2874+
28442875
|
28452876
| Type: boolean
28462877
| Default: ``false``

doc/reference/reference_lua/box_info/replication_anon.rst

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ box.info.replication_anon()
88

99
.. function:: replication_anon()
1010

11-
List all the :ref:`anonymous replicas <cfg_replication-replication_anon>`
11+
List all the :ref:`anonymous replicas <configuration_reference_replication_anon>`
1212
following the instance.
1313

1414
The output is similar to the one produced by ``box.info.replication`` with
@@ -24,32 +24,26 @@ box.info.replication_anon()
2424

2525
**Example:**
2626

27-
.. code-block:: tarantoolsession
28-
29-
tarantool> box.info.replication_anon
30-
---
31-
- count: 2
32-
...
33-
34-
tarantool> box.info.replication_anon()
35-
---
36-
- 3a6a2cfb-7e47-42f6-8309-7a25c37feea1:
37-
id: 0
38-
uuid: 3a6a2cfb-7e47-42f6-8309-7a25c37feea1
39-
lsn: 0
40-
downstream:
41-
status: follow
42-
idle: 0.76203499999974
43-
vclock: {1: 1}
44-
f58e4cb0-e0a8-42a1-b439-591dd36c8e5e:
45-
id: 0
46-
uuid: f58e4cb0-e0a8-42a1-b439-591dd36c8e5e
47-
lsn: 0
48-
downstream:
49-
status: follow
50-
idle: 0.0041349999992235
51-
vclock: {1: 1}
52-
...
27+
.. code-block:: tarantoolsession
28+
29+
anonymous_replica:instance001> box.info.replication_anon
30+
---
31+
- count: 1
32+
...
33+
34+
anonymous_replica:instance001> box.info.replication_anon()
35+
---
36+
- 44237cb4-de83-4347-b6db-46274b940acf:
37+
id: 0
38+
uuid: 44237cb4-de83-4347-b6db-46274b940acf
39+
lsn: 0
40+
downstream:
41+
status: follow
42+
idle: 0.81613899999866
43+
vclock: {1: 7}
44+
lag: 0
45+
name: null
46+
...
5347
5448
Notice that anonymous replicas hide their ``lsn`` from the others, so an
5549
anonymous replica ``lsn`` will always be reported as zero, even if an anonymous

0 commit comments

Comments
 (0)