Skip to content

Commit 8ea9d3b

Browse files
Update ClusterSharding.Node example to use shared SQLite store (#7494)
Co-authored-by: Aaron Stannard <[email protected]>
1 parent 1f5688d commit 8ea9d3b

File tree

4 files changed

+24
-20
lines changed

4 files changed

+24
-20
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
FROM mcr.microsoft.com/dotnet/core/runtime:3.1
2-
COPY ["./bin/Release/netcoreapp3.1/publish", "."]
1+
FROM mcr.microsoft.com/dotnet/runtime:8.0
2+
COPY ["./bin/Release/net8.0/publish", "."]
33
ENTRYPOINT ["dotnet", "ClusterSharding.Node.dll"]

src/examples/Cluster/ClusterSharding/ClusterSharding.Node/app.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@ akka {
1212
auto-down-unreachable-after = 5s
1313
sharding {
1414
remember-entities = on
15-
least-shard-allocation-strategy.rebalance-threshold = 3
15+
least-shard-allocation-strategy.rebalance-absolute-limit = 3
1616
state-store-mode = ddata
1717
}
1818
}
1919
persistence {
2020
journal {
2121
plugin = "akka.persistence.journal.sqlite"
2222
sqlite {
23-
connection-string = "Datasource=store.db"
23+
connection-string = "Datasource=/data/store.db"
2424
auto-initialize = true
2525
}
2626
}
2727
snapshot-store {
2828
plugin = "akka.persistence.snapshot-store.sqlite"
2929
sqlite {
30-
connection-string = "Datasource=store.db"
30+
connection-string = "Datasource=/data/store.db"
3131
auto-initialize = true
3232
}
3333
}
Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,36 @@
1-
version: '3.7'
2-
31
services:
42
node-1:
53
image: cluster-sharding:latest
6-
network_mode: host
74
ports:
8-
- '6055:6055'
5+
- '6055'
96
environment:
10-
CLUSTER_IP: "localhost"
7+
CLUSTER_IP: "node-1"
118
CLUSTER_PORT: 6055
12-
CLUSTER_SEEDS: "akka.tcp://sharded-cluster-system@localhost:6055"
9+
CLUSTER_SEEDS: "akka.tcp://sharded-cluster-system@node-1:6055"
10+
volumes:
11+
- data:/data:rw
1312

1413
node-2:
1514
image: cluster-sharding:latest
16-
network_mode: host
1715
ports:
18-
- '6056:6056'
16+
- '6056'
1917
environment:
20-
CLUSTER_IP: "localhost"
18+
CLUSTER_IP: "node-2"
2119
CLUSTER_PORT: 6056
22-
CLUSTER_SEEDS: "akka.tcp://sharded-cluster-system@localhost:6055"
20+
CLUSTER_SEEDS: "akka.tcp://sharded-cluster-system@node-1:6055"
21+
volumes:
22+
- data:/data:rw
2323

2424
node-3:
2525
image: cluster-sharding:latest
26-
network_mode: host
2726
ports:
28-
- '6057:6057'
27+
- '6057'
2928
environment:
30-
CLUSTER_IP: "localhost"
29+
CLUSTER_IP: "node-3"
3130
CLUSTER_PORT: 6057
32-
CLUSTER_SEEDS: "akka.tcp://sharded-cluster-system@localhost:6055"
31+
CLUSTER_SEEDS: "akka.tcp://sharded-cluster-system@node-1:6055"
32+
volumes:
33+
- data:/data:rw
34+
35+
volumes:
36+
data: ~
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
dotnet publish -c Release
22
docker build -t cluster-sharding:latest .
3-
docker-compose up
3+
docker compose up

0 commit comments

Comments
 (0)