File tree 6 files changed +97
-1
lines changed
doc/code_snippets/snippets/sharding
instances.enabled/sharded_cluster
6 files changed +97
-1
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ groups:
34
34
iproto :
35
35
listen : 127.0.0.1:3302
36
36
storage-b :
37
- leader : storage-b-002
37
+ leader : storage-b-001
38
38
instances :
39
39
storage-b-001 :
40
40
iproto :
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
1
+ storage-a-001 :
2
+ storage-a-002 :
3
+ storage-b-001 :
4
+ storage-b-002 :
5
+ router-a-001:
Original file line number Diff line number Diff line change
1
+ local vshard = require (' vshard' )
2
+
3
+ vshard .router .bootstrap ()
4
+
5
+ -- Router code --
Original file line number Diff line number Diff line change
1
+ -- Storage code --
You can’t perform that action at this time.
0 commit comments