Skip to content

Commit 420f5c2

Browse files
committed
3.0 config: app template
1 parent 597057a commit 420f5c2

File tree

6 files changed

+97
-1
lines changed

6 files changed

+97
-1
lines changed

doc/code_snippets/snippets/sharding/instances.enabled/sharded_cluster/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ groups:
3434
iproto:
3535
listen: 127.0.0.1:3302
3636
storage-b:
37-
leader: storage-b-002
37+
leader: storage-b-001
3838
instances:
3939
storage-b-001:
4040
iproto:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
description: Basic template
2+
vars:
3+
- prompt: A name of the user for replication
4+
name: replicator_user_name
5+
default: replicator
6+
7+
- prompt: A password for a replicator user
8+
name: replicator_user_password
9+
re: ^\w+$
10+
11+
- prompt: A name of the user for sharding
12+
name: sharding_user_name
13+
default: storage
14+
15+
- prompt: A password for a sharding user
16+
name: sharding_user_password
17+
re: ^\w+$
18+
19+
- prompt: The number of buckets in a cluster
20+
name: sharding_bucket_count
21+
default: '1000'
22+
23+
- prompt: A listen URI
24+
name: listen_uri
25+
default: '127.0.0.1'
26+
include:
27+
- config.yaml
28+
- instances.yaml
29+
- router.lua
30+
- storage.lua
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
credentials:
2+
users:
3+
{{.replicator_user_name}}:
4+
password: '{{.replicator_user_password}}'
5+
roles: [replication]
6+
{{.sharding_user_name}}:
7+
password: '{{.sharding_user_password}}'
8+
roles: [super]
9+
10+
iproto:
11+
advertise:
12+
peer: {{.replicator_user_name}}@
13+
sharding: {{.sharding_user_name}}@
14+
15+
sharding:
16+
bucket_count: {{.sharding_bucket_count}}
17+
18+
groups:
19+
storages:
20+
app:
21+
module: storage
22+
sharding:
23+
roles: [storage]
24+
replication:
25+
failover: manual
26+
replicasets:
27+
storage-a:
28+
leader: storage-a-001
29+
instances:
30+
storage-a-001:
31+
iproto:
32+
listen: {{.listen_uri}}:3301
33+
storage-a-002:
34+
iproto:
35+
listen: {{.listen_uri}}:3302
36+
storage-b:
37+
leader: storage-b-001
38+
instances:
39+
storage-b-001:
40+
iproto:
41+
listen: {{.listen_uri}}:3303
42+
storage-b-002:
43+
iproto:
44+
listen: {{.listen_uri}}:3304
45+
routers:
46+
app:
47+
module: router
48+
sharding:
49+
roles: [router]
50+
replicasets:
51+
router-a:
52+
instances:
53+
router-a-001:
54+
iproto:
55+
listen: {{.listen_uri}}:3300
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
storage-a-001:
2+
storage-a-002:
3+
storage-b-001:
4+
storage-b-002:
5+
router-a-001:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
local vshard = require('vshard')
2+
3+
vshard.router.bootstrap()
4+
5+
-- Router code --
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-- Storage code --

0 commit comments

Comments
 (0)