Skip to content

Commit

Permalink
Update ClusterSharding.Node example to use shared SQLite store (akkad…
Browse files Browse the repository at this point in the history
…otnet#7494)

Co-authored-by: Aaron Stannard <[email protected]>
  • Loading branch information
dimabarbul and Aaronontheweb authored Feb 3, 2025
1 parent 1f5688d commit 8ea9d3b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM mcr.microsoft.com/dotnet/core/runtime:3.1
COPY ["./bin/Release/netcoreapp3.1/publish", "."]
FROM mcr.microsoft.com/dotnet/runtime:8.0
COPY ["./bin/Release/net8.0/publish", "."]
ENTRYPOINT ["dotnet", "ClusterSharding.Node.dll"]
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ akka {
auto-down-unreachable-after = 5s
sharding {
remember-entities = on
least-shard-allocation-strategy.rebalance-threshold = 3
least-shard-allocation-strategy.rebalance-absolute-limit = 3
state-store-mode = ddata
}
}
persistence {
journal {
plugin = "akka.persistence.journal.sqlite"
sqlite {
connection-string = "Datasource=store.db"
connection-string = "Datasource=/data/store.db"
auto-initialize = true
}
}
snapshot-store {
plugin = "akka.persistence.snapshot-store.sqlite"
sqlite {
connection-string = "Datasource=store.db"
connection-string = "Datasource=/data/store.db"
auto-initialize = true
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
version: '3.7'

services:
node-1:
image: cluster-sharding:latest
network_mode: host
ports:
- '6055:6055'
- '6055'
environment:
CLUSTER_IP: "localhost"
CLUSTER_IP: "node-1"
CLUSTER_PORT: 6055
CLUSTER_SEEDS: "akka.tcp://sharded-cluster-system@localhost:6055"
CLUSTER_SEEDS: "akka.tcp://sharded-cluster-system@node-1:6055"
volumes:
- data:/data:rw

node-2:
image: cluster-sharding:latest
network_mode: host
ports:
- '6056:6056'
- '6056'
environment:
CLUSTER_IP: "localhost"
CLUSTER_IP: "node-2"
CLUSTER_PORT: 6056
CLUSTER_SEEDS: "akka.tcp://sharded-cluster-system@localhost:6055"
CLUSTER_SEEDS: "akka.tcp://sharded-cluster-system@node-1:6055"
volumes:
- data:/data:rw

node-3:
image: cluster-sharding:latest
network_mode: host
ports:
- '6057:6057'
- '6057'
environment:
CLUSTER_IP: "localhost"
CLUSTER_IP: "node-3"
CLUSTER_PORT: 6057
CLUSTER_SEEDS: "akka.tcp://sharded-cluster-system@localhost:6055"
CLUSTER_SEEDS: "akka.tcp://sharded-cluster-system@node-1:6055"
volumes:
- data:/data:rw

volumes:
data: ~
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dotnet publish -c Release
docker build -t cluster-sharding:latest .
docker-compose up
docker compose up

0 comments on commit 8ea9d3b

Please sign in to comment.