Skip to content

Commit 7153397

Browse files
committed
3.0 configuration: update replication tutorials
1 parent c0f4522 commit 7153397

File tree

18 files changed

+1050
-868
lines changed

18 files changed

+1050
-868
lines changed

doc/code_snippets/snippets/replication/instances.enabled/auto_leader/data.lua

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@ function create_space()
88
box.space.bands:create_index('primary', { parts = { 'id' } })
99
end
1010

11-
function create_sync_space()
12-
box.schema.space.create('bands', { is_sync = true })
13-
box.space.bands:format({
14-
{ name = 'id', type = 'unsigned' },
15-
{ name = 'band_name', type = 'string' },
16-
{ name = 'year', type = 'unsigned' }
17-
})
18-
box.space.bands:create_index('primary', { parts = { 'id' } })
19-
end
20-
2111
function load_data()
2212
box.space.bands:insert { 1, 'Roxette', 1986 }
2313
box.space.bands:insert { 2, 'Scorpions', 1965 }
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
credentials:
2+
users:
3+
replicator:
4+
password: 'topsecret'
5+
roles: [replication]
6+
7+
iproto:
8+
advertise:
9+
peer: replicator@
10+
11+
replication:
12+
synchro_quorum: 3
13+
election_fencing_mode: off
14+
failover: election
15+
16+
groups:
17+
group001:
18+
replicasets:
19+
replicaset001:
20+
instances:
21+
instance001:
22+
iproto:
23+
listen: 127.0.0.1:3301
24+
instance002:
25+
iproto:
26+
listen: 127.0.0.1:3302
27+
instance003:
28+
iproto:
29+
listen: 127.0.0.1:3303
30+
31+
# Load sample data
32+
app:
33+
file: 'data.lua'
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
function create_sync_space()
2+
box.schema.space.create('bands', { is_sync = true })
3+
box.space.bands:format({
4+
{ name = 'id', type = 'unsigned' },
5+
{ name = 'band_name', type = 'string' },
6+
{ name = 'year', type = 'unsigned' }
7+
})
8+
box.space.bands:create_index('primary', { parts = { 'id' } })
9+
end
10+
11+
function load_data()
12+
box.space.bands:insert { 1, 'Roxette', 1986 }
13+
box.space.bands:insert { 2, 'Scorpions', 1965 }
14+
box.space.bands:insert { 3, 'Ace of Base', 1987 }
15+
box.space.bands:insert { 4, 'The Beatles', 1960 }
16+
box.space.bands:insert { 5, 'Pink Floyd', 1965 }
17+
box.space.bands:insert { 6, 'The Rolling Stones', 1962 }
18+
box.space.bands:insert { 7, 'The Doors', 1965 }
19+
box.space.bands:insert { 8, 'Nirvana', 1987 }
20+
box.space.bands:insert { 9, 'Led Zeppelin', 1968 }
21+
box.space.bands:insert { 10, 'Queen', 1970 }
22+
end
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/code_snippets/snippets/replication/instances.enabled/manual_leader/myapp.lua

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@ function create_space()
88
box.space.bands:create_index('primary', { parts = { 'id' } })
99
end
1010

11-
function create_sync_space()
12-
box.schema.space.create('bands', { is_sync = true })
13-
box.space.bands:format({
14-
{ name = 'id', type = 'unsigned' },
15-
{ name = 'band_name', type = 'string' },
16-
{ name = 'year', type = 'unsigned' }
17-
})
18-
box.space.bands:create_index('primary', { parts = { 'id' } })
19-
end
20-
2111
function load_data()
2212
box.space.bands:insert { 1, 'Roxette', 1986 }
2313
box.space.bands:insert { 2, 'Scorpions', 1965 }
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
credentials:
2+
users:
3+
replicator:
4+
password: 'topsecret'
5+
roles: [replication]
6+
client:
7+
password: 'secret'
8+
roles: [super]
9+
10+
iproto:
11+
advertise:
12+
peer: replicator@
13+
14+
replication:
15+
synchro_quorum: 3
16+
failover: manual
17+
18+
groups:
19+
group001:
20+
replicasets:
21+
replicaset001:
22+
leader: instance001
23+
instances:
24+
instance001:
25+
iproto:
26+
listen: 127.0.0.1:3301
27+
instance002:
28+
iproto:
29+
listen: 127.0.0.1:3302
30+
instance003:
31+
iproto:
32+
listen: 127.0.0.1:3303
33+
34+
# Load sample data
35+
app:
36+
file: 'myapp.lua'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
instance001:
2+
instance002:
3+
instance003:
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
function create_sync_space()
2+
box.schema.space.create('bands', { is_sync = true })
3+
box.space.bands:format({
4+
{ name = 'id', type = 'unsigned' },
5+
{ name = 'band_name', type = 'string' },
6+
{ name = 'year', type = 'unsigned' }
7+
})
8+
box.space.bands:create_index('primary', { parts = { 'id' } })
9+
end
10+
11+
function load_data()
12+
box.space.bands:insert { 1, 'Roxette', 1986 }
13+
box.space.bands:insert { 2, 'Scorpions', 1965 }
14+
box.space.bands:insert { 3, 'Ace of Base', 1987 }
15+
box.space.bands:insert { 4, 'The Beatles', 1960 }
16+
box.space.bands:insert { 5, 'Pink Floyd', 1965 }
17+
box.space.bands:insert { 6, 'The Rolling Stones', 1962 }
18+
box.space.bands:insert { 7, 'The Doors', 1965 }
19+
box.space.bands:insert { 8, 'Nirvana', 1987 }
20+
box.space.bands:insert { 9, 'Led Zeppelin', 1968 }
21+
box.space.bands:insert { 10, 'Queen', 1970 }
22+
end

doc/code_snippets/snippets/replication/instances.enabled/master_master/config.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,9 @@ groups:
2525
database:
2626
mode: rw
2727
iproto:
28-
listen: 127.0.0.1:3302
28+
listen: 127.0.0.1:3302
29+
instance003:
30+
database:
31+
mode: rw
32+
iproto:
33+
listen: 127.0.0.1:3303
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
instance001:
2-
instance002:
2+
instance002:
3+
instance003:

0 commit comments

Comments
 (0)