Skip to content

Commit 6994648

Browse files
committed
3.0 configuration: update replication tutorials
1 parent b7f26a6 commit 6994648

File tree

4 files changed

+259
-397
lines changed

4 files changed

+259
-397
lines changed

doc/concepts/replication/repl_architecture.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ The following are specifics of adding different types of information to the WAL:
4747
* Data change operations on **replication-local** spaces (:doc:`created </reference/reference_lua/box_schema/space_create>` with ``is_local = true``) are written to the WAL but are not replicated.
4848

4949

50-
To learn how to enable replication, check the :ref:`Bootstrapping a replica set <replication-setup>` guide.
50+
To learn how to enable replication, check the :ref:`Bootstrapping a replica set <replication-bootstrap>` guide.
5151

5252

5353
.. _replication_stages:

doc/how-to/replication/repl_add_instances.rst

Lines changed: 14 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -14,64 +14,27 @@ It is recommended that you complete the bootstrapping guide before you proceed.
1414
Adding a replica
1515
----------------
1616

17-
.. image:: mr-1m-2r-mesh-add.png
18-
:align: center
17+
1. Update ``instances.yml``:
1918

20-
To add a second **replica** instance to the **master-replica** set from our
21-
:ref:`bootstrapping example <replication-master_replica_bootstrap>`, we need an
22-
analog of the instance file that we created for the first replica in that set:
19+
.. literalinclude:: /code_snippets/snippets/replication/instances.enabled/manual_leader/instances.yml
20+
:language: yaml
21+
:dedent:
2322

24-
.. code-block:: lua
23+
2. Add ``instance003``:
2524

26-
-- instance file for replica #2
27-
box.cfg{
28-
listen = 3301,
29-
replication = {'replicator:password@192.168.0.101:3301', -- master URI
30-
'replicator:password@192.168.0.102:3301', -- replica #1 URI
31-
'replicator:password@192.168.0.103:3301'}, -- replica #2 URI
32-
read_only = true
33-
}
34-
box.once("schema", function()
35-
box.schema.user.create('replicator', {password = 'password'})
36-
box.schema.user.grant('replicator', 'replication') -- grant replication role
37-
box.schema.space.create("test")
38-
box.space.test:create_index("primary")
39-
print('box.once executed on replica #2')
40-
end)
25+
.. literalinclude:: /code_snippets/snippets/replication/instances.enabled/manual_leader/config.yaml
26+
:language: yaml
27+
:start-at: groups:
28+
:end-at: listen: 127.0.0.1:3303
29+
:dedent:
4130

42-
Here we add the URI of replica #2 to the :ref:`replication <cfg_replication-replication>`
43-
parameter, so now it contains three URIs.
31+
3. Start: ``tt start manual_leader:instance003``, ``tt status manual_leader``.
4432

45-
After we launch the new replica instance, it gets connected to the master
46-
instance and retrieves the master's write-ahead-log and snapshot files:
33+
4. ``tt connect manual_leader:instance001``.
34+
35+
``box.info.election``, ``box.space._cluster:select()``.
4736

48-
.. code-block:: console
4937

50-
$ # launching replica #2
51-
$ tarantool replica2.lua
52-
2017-06-14 14:54:33.927 [46945] main/101/replica2.lua C> version 1.7.4-52-g980d30092
53-
2017-06-14 14:54:33.927 [46945] main/101/replica2.lua C> log level 5
54-
2017-06-14 14:54:33.928 [46945] main/101/replica2.lua I> mapping 268435456 bytes for tuple arena...
55-
2017-06-14 14:54:33.930 [46945] main/104/applier/replicator@192.168.0.10 I> remote master is 1.7.4 at 192.168.0.101:3301
56-
2017-06-14 14:54:33.930 [46945] main/104/applier/replicator@192.168.0.10 I> authenticated
57-
2017-06-14 14:54:33.930 [46945] main/101/replica2.lua I> bootstrapping replica from 192.168.0.101:3301
58-
2017-06-14 14:54:33.933 [46945] main/104/applier/replicator@192.168.0.10 I> initial data received
59-
2017-06-14 14:54:33.933 [46945] main/104/applier/replicator@192.168.0.10 I> final data received
60-
2017-06-14 14:54:33.934 [46945] snapshot/101/main I> saving snapshot `/var/lib/tarantool/replica2/00000000000000000010.snap.inprogress'
61-
2017-06-14 14:54:33.934 [46945] snapshot/101/main I> done
62-
2017-06-14 14:54:33.935 [46945] main/101/replica2.lua I> vinyl checkpoint done
63-
2017-06-14 14:54:33.935 [46945] main/101/replica2.lua I> ready to accept requests
64-
2017-06-14 14:54:33.935 [46945] main/101/replica2.lua I> set 'read_only' configuration option to true
65-
2017-06-14 14:54:33.936 [46945] main C> entering the event loop
66-
67-
Since we are adding a read-only instance, there is no need to dynamically
68-
update the ``replication`` parameter on the other running instances. This update
69-
would be required if we :ref:`added a master instance <replication-add_master>`.
70-
71-
However, we recommend specifying the URI of replica #3 in all instance files of the
72-
replica set. This will keep all the files consistent with each other and with
73-
the current replication topology, and so will help to avoid configuration errors
74-
in case of further configuration updates and replica set restart.
7538

7639
.. _replication-add_master:
7740

0 commit comments

Comments
 (0)