Skip to content

Commit 682b5b7

Browse files
committed
feat: dragonfly cluster demo
1 parent 488815c commit 682b5b7

File tree

4 files changed

+129
-0
lines changed

4 files changed

+129
-0
lines changed

cluster/cluster.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[
2+
{
3+
"slot_ranges": [
4+
{
5+
"start": 0,
6+
"end": 999
7+
}
8+
],
9+
"master": {
10+
"id": "ed4718a762eac755b1692ec621a0eec10bbe66aa",
11+
"ip": "localhost",
12+
"port": 30001
13+
},
14+
"replicas": []
15+
},
16+
{
17+
"slot_ranges": [
18+
{
19+
"start": 1000,
20+
"end": 16383
21+
}
22+
],
23+
"master": {
24+
"id": "4504afbf9e2d4f4faeeaef516e3baed04bbb7759",
25+
"ip": "localhost",
26+
"port": 30002
27+
},
28+
"replicas": []
29+
}
30+
]

cluster/docker-compose.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: '3'
2+
services:
3+
dragonfly-cluster-1:
4+
container_name: "dragonfly-cluster-1"
5+
image: 'ghcr.io/dragonflydb/dragonfly:v1.22.2-ubuntu'
6+
ulimits:
7+
memlock: -1
8+
ports:
9+
- "30001:6379"
10+
- "31001:31001"
11+
command:
12+
- "--dir=/data"
13+
- "-cluster_mode=yes"
14+
- "-admin_port=31001"
15+
dragonfly-cluster-2:
16+
container_name: "dragonfly-cluster-2"
17+
image: 'ghcr.io/dragonflydb/dragonfly:v1.22.2-ubuntu'
18+
ulimits:
19+
memlock: -1
20+
ports:
21+
- "30002:6379"
22+
- "31002:31002"
23+
command:
24+
- "--dir=/data"
25+
- "-cluster_mode=yes"
26+
- "-admin_port=31002"

cluster/slot-migration-finished.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[
2+
{
3+
"slot_ranges": [
4+
{
5+
"start": 0,
6+
"end": 8000
7+
}
8+
],
9+
"master": {
10+
"id": "97486c9d7e0507e1edb2dfba4655224d5b61c5e2",
11+
"ip": "localhost",
12+
"port": 30001
13+
},
14+
"replicas": []
15+
},
16+
{
17+
"slot_ranges": [
18+
{
19+
"start": 8001,
20+
"end": 16383
21+
}
22+
],
23+
"master": {
24+
"id": "728cf25ecd4d1230805754ff98939321d72d23ef",
25+
"ip": "localhost",
26+
"port": 30002
27+
},
28+
"replicas": []
29+
}
30+
]

cluster/slot-migration.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[
2+
{
3+
"slot_ranges": [
4+
{
5+
"start": 0,
6+
"end": 999
7+
}
8+
],
9+
"master": {
10+
"id": "97486c9d7e0507e1edb2dfba4655224d5b61c5e2",
11+
"ip": "localhost",
12+
"port": 30001
13+
},
14+
"replicas": []
15+
},
16+
{
17+
"slot_ranges": [
18+
{
19+
"start": 1000,
20+
"end": 16383
21+
}
22+
],
23+
"master": {
24+
"id": "728cf25ecd4d1230805754ff98939321d72d23ef",
25+
"ip": "localhost",
26+
"port": 30002
27+
},
28+
"replicas": [],
29+
"migrations": [
30+
{
31+
"slot_ranges": [
32+
{
33+
"start": 1000,
34+
"end": 8000
35+
}
36+
],
37+
"node_id": "97486c9d7e0507e1edb2dfba4655224d5b61c5e2",
38+
"ip": "localhost",
39+
"port": 31001
40+
}
41+
]
42+
}
43+
]

0 commit comments

Comments
 (0)