@@ -14,64 +14,27 @@ It is recommended that you complete the bootstrapping guide before you proceed.
14
14
Adding a replica
15
15
----------------
16
16
17
- .. image :: mr-1m-2r-mesh-add.png
18
- :align: center
17
+ 1. Update ``instances.yml ``:
19
18
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 :
23
22
24
- .. code-block :: lua
23
+ 2. Add `` instance003 ``:
25
24
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:
41
30
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 ``.
44
32
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() ``.
47
36
48
- .. code-block :: console
49
37
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.
75
38
76
39
.. _replication-add_master :
77
40
0 commit comments