Tarantool
無法執行 Tarantool 複製
我正在嘗試從文件中重現 tarantool 主複製
所以我為每個目錄製作了
master/master.lua
,rep1/rep1.lua
, , cd 並執行它,但它顯示了類似這樣的內容(10 多分鐘,沒有進展):rep2/rep2.lua
@ /tmp/master └─[0] <> tarantool master.lua 2021-05-21 21:12:43.941 [884153] main/103/master.lua C> Tarantool 2.7.2-14-ga308ba8e2 2021-05-21 21:12:43.941 [884153] main/103/master.lua C> log level 5 2021-05-21 21:12:43.941 [884153] main/103/master.lua I> wal/engine cleanup is paused 2021-05-21 21:12:43.941 [884153] main/103/master.lua I> mapping 268435456 bytes for memtx tuple arena... 2021-05-21 21:12:43.941 [884153] main/103/master.lua I> Actual slab_alloc_factor calculated on the basis of desired slab_alloc_factor = 1.044274 2021-05-21 21:12:43.941 [884153] main/103/master.lua I> mapping 134217728 bytes for vinyl tuple arena... 2021-05-21 21:12:43.942 [884153] main/103/master.lua I> instance uuid b78ffe3e-d8d3-4f98-b213-dae4ac0b6858 2021-05-21 21:12:43.942 [884153] iproto/101/main I> binary: bound to 0.0.0.0:13301 2021-05-21 21:12:43.942 [884153] main/103/master.lua I> connecting to 2 replicas 2021-05-21 21:12:43.942 [884153] main/111/applier/replicator@127.0.0.1:33301 I> can't connect to master 2021-05-21 21:12:43.942 [884153] main/111/applier/replicator@127.0.0.1:33301 coio.cc:108 !> SystemError connect, called on fd 17, aka 127.0.0.1:59352: Connection refused 2021-05-21 21:12:43.942 [884153] main/111/applier/replicator@127.0.0.1:33301 I> will retry every 1.00 second 2021-05-21 21:12:43.942 [884153] main/110/applier/replicator@127.0.0.1:23301 I> can't connect to master 2021-05-21 21:12:43.942 [884153] main/110/applier/replicator@127.0.0.1:23301 coio.cc:108 !> SystemError connect, called on fd 16, aka 127.0.0.1:49188: Connection refused 2021-05-21 21:12:43.942 [884153] main/110/applier/replicator@127.0.0.1:23301 I> will retry every 1.00 second 2021-05-21 21:12:45.944 [884153] main/110/applier/replicator@127.0.0.1:23301 I> remote master e242f602-6591-4eb5-9194-f64d7541ea67 at 127.0.0.1:23301 running Tarantool 2.7.2 2021-05-21 21:12:47.945 [884153] main/111/applier/replicator@127.0.0.1:33301 I> remote master 7d21d786-f0fa-440c-8b19-4c2f66fe47fe at 127.0.0.1:33301 running Tarantool 2.7.2 2021-05-21 21:12:47.945 [884153] main/103/master.lua I> connected to 2 replicas 2021-05-21 21:12:47.945 [884153] main/111/applier/replicator@127.0.0.1:33301 I> failed to authenticate 2021-05-21 21:12:47.945 [884153] main/111/applier/replicator@127.0.0.1:33301 box.cc:2381 E> ER_LOADING: Instance bootstrap hasn't finished yet 2021-05-21 21:12:47.945 [884153] main/111/applier/replicator@127.0.0.1:33301 I> will retry every 1.00 second @ /tmp/rep1 └─[0] <> tarantool rep1.lua 2021-05-21 21:12:45.793 [884163] main/103/rep1.lua C> Tarantool 2.7.2-14-ga308ba8e2 2021-05-21 21:12:45.793 [884163] main/103/rep1.lua C> log level 5 2021-05-21 21:12:45.793 [884163] main/103/rep1.lua I> wal/engine cleanup is paused 2021-05-21 21:12:45.793 [884163] main/103/rep1.lua I> mapping 268435456 bytes for memtx tuple arena... 2021-05-21 21:12:45.793 [884163] main/103/rep1.lua I> Actual slab_alloc_factor calculated on the basis of desired slab_alloc_factor = 1.044274 2021-05-21 21:12:45.793 [884163] main/103/rep1.lua I> mapping 134217728 bytes for vinyl tuple arena... 2021-05-21 21:12:45.793 [884163] main/103/rep1.lua I> instance uuid e242f602-6591-4eb5-9194-f64d7541ea67 2021-05-21 21:12:45.793 [884163] iproto/101/main I> binary: bound to 0.0.0.0:23301 2021-05-21 21:12:45.793 [884163] main/103/rep1.lua I> connecting to 2 replicas 2021-05-21 21:12:45.794 [884163] main/111/applier/replicator@127.0.0.1:33301 I> can't connect to master 2021-05-21 21:12:45.794 [884163] main/111/applier/replicator@127.0.0.1:33301 coio.cc:108 !> SystemError connect, called on fd 17, aka 127.0.0.1:59388: Connection refused 2021-05-21 21:12:45.794 [884163] main/111/applier/replicator@127.0.0.1:33301 I> will retry every 1.00 second 2021-05-21 21:12:45.794 [884163] main/110/applier/replicator@127.0.0.1:13301 I> remote master b78ffe3e-d8d3-4f98-b213-dae4ac0b6858 at 127.0.0.1:13301 running Tarantool 2.7.2 2021-05-21 21:12:47.796 [884163] main/111/applier/replicator@127.0.0.1:33301 I> remote master 7d21d786-f0fa-440c-8b19-4c2f66fe47fe at 127.0.0.1:33301 running Tarantool 2.7.2 2021-05-21 21:12:47.796 [884163] main/103/rep1.lua I> connected to 2 replicas 2021-05-21 21:12:47.796 [884163] main/110/applier/replicator@127.0.0.1:13301 I> failed to authenticate 2021-05-21 21:12:47.796 [884163] main/110/applier/replicator@127.0.0.1:13301 box.cc:2381 E> ER_LOADING: Instance bootstrap hasn't finished yet 2021-05-21 21:12:47.796 [884163] main/110/applier/replicator@127.0.0.1:13301 I> will retry every 1.00 second @ /tmp/rep2 └─[0] <> tarantool rep2.lua 2021-05-21 21:12:47.435 [884173] main/103/rep2.lua C> Tarantool 2.7.2-14-ga308ba8e2 2021-05-21 21:12:47.435 [884173] main/103/rep2.lua C> log level 5 2021-05-21 21:12:47.435 [884173] main/103/rep2.lua I> wal/engine cleanup is paused 2021-05-21 21:12:47.435 [884173] main/103/rep2.lua I> mapping 268435456 bytes for memtx tuple arena... 2021-05-21 21:12:47.435 [884173] main/103/rep2.lua I> Actual slab_alloc_factor calculated on the basis of desired slab_alloc_factor = 1.044274 2021-05-21 21:12:47.435 [884173] main/103/rep2.lua I> mapping 134217728 bytes for vinyl tuple arena... 2021-05-21 21:12:47.436 [884173] main/103/rep2.lua I> instance uuid 7d21d786-f0fa-440c-8b19-4c2f66fe47fe 2021-05-21 21:12:47.436 [884173] iproto/101/main I> binary: bound to 0.0.0.0:33301 2021-05-21 21:12:47.436 [884173] main/103/rep2.lua I> connecting to 2 replicas 2021-05-21 21:12:47.437 [884173] main/110/applier/replicator@127.0.0.1:13301 I> remote master b78ffe3e-d8d3-4f98-b213-dae4ac0b6858 at 127.0.0.1:13301 running Tarantool 2.7.2 2021-05-21 21:12:47.437 [884173] main/111/applier/replicator@127.0.0.1:23301 I> remote master e242f602-6591-4eb5-9194-f64d7541ea67 at 127.0.0.1:23301 running Tarantool 2.7.2 2021-05-21 21:12:47.437 [884173] main/103/rep2.lua I> connected to 2 replicas 2021-05-21 21:12:47.437 [884173] main/110/applier/replicator@127.0.0.1:13301 I> failed to authenticate 2021-05-21 21:12:47.437 [884173] main/110/applier/replicator@127.0.0.1:13301 box.cc:2381 E> ER_LOADING: Instance bootstrap hasn't finished yet 2021-05-21 21:12:47.437 [884173] main/110/applier/replicator@127.0.0.1:13301 I> will retry every 1.00 second
程式碼在這裡:
master.lua
box.cfg{ listen = 13301, replication = {'replicator:password@127.0.0.1:23301', -- master URI 'replicator:password@127.0.0.1:33301'}, -- replica URI read_only = false } box.once("schema", function() box.schema.user.create('replicator', {password = 'password'}) box.schema.user.grant('replicator', 'replication') -- grant replication role box.schema.space.create("test") box.space.test:create_index("primary") print('box.once executed on master') end)
rep1.lua
box.cfg{ listen = 23301, replication = {'replicator:password@127.0.0.1:13301', -- master URI 'replicator:password@127.0.0.1:33301'}, -- replica URI read_only = true } box.once("schema", function() box.schema.user.create('replicator', {password = 'password'}) box.schema.user.grant('replicator', 'replication') -- grant replication role box.schema.space.create("test") box.space.test:create_index("primary") print('box.once executed on replica 1') end)
rep2.lua
box.cfg{ listen = 33301, replication = {'replicator:password@127.0.0.1:13301', -- master URI 'replicator:password@127.0.0.1:23301'}, -- replica URI read_only = true } box.once("schema", function() box.schema.user.create('replicator', {password = 'password'}) box.schema.user.grant('replicator', 'replication') -- grant replication role box.schema.space.create("test") box.space.test:create_index("primary") print('box.once executed on replica 2') end)
它出什麼問題了?
沒關係,我不好,第一條複製線應該是主線,所以它應該是這樣的:
replication = {'replicator:password@127.0.0.1:13301', -- master URI 'replicator:password@127.0.0.1:23301', -- replica URI 'replicator:password@127.0.0.1:33301'}, -- replica URI