Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ClusterSharding.Node example to use shared SQLite store #7494

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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