From 443fb6d5135832c367d21b4610d3e4d15ac94be8 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 15 Jan 2023 20:06:09 +0100 Subject: [PATCH] feat: Configrued the `chat-backend` with a working static sharding --- docker-compose.yml | 27 ++++++++++++++++++++++++--- sharding.map | 12 ++++++------ 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7034fe5d..3773f15f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -105,15 +105,36 @@ services: - 8404:8404 backend-1: - image: jmalloc/echo-server:latest + image: juplo/chat-backend:0.0.1-SNAPSHOT + environment: + chat.backend.inmemory.sharding-strategy: kafkalike + chat.backend.inmemory.num-shards: 10 + chat.backend.inmemory.owned-shards: 1, 3, 4, 9 + chat.backend.inmemory.storage-strategy: mongodb + spring.data.mongodb.host: mongo + spring.data.mongodb.database: test ports: - 8081:8080 backend-2: - image: jmalloc/echo-server:latest + image: juplo/chat-backend:0.0.1-SNAPSHOT + environment: + chat.backend.inmemory.sharding-strategy: kafkalike + chat.backend.inmemory.num-shards: 10 + chat.backend.inmemory.owned-shards: 0, 2, 7 + chat.backend.inmemory.storage-strategy: mongodb + spring.data.mongodb.host: mongo + spring.data.mongodb.database: test ports: - 8082:8080 backend-3: - image: jmalloc/echo-server:latest + image: juplo/chat-backend:0.0.1-SNAPSHOT + environment: + chat.backend.inmemory.sharding-strategy: kafkalike + chat.backend.inmemory.num-shards: 10 + chat.backend.inmemory.owned-shards: 5, 6, 8 + chat.backend.inmemory.storage-strategy: mongodb + spring.data.mongodb.host: mongo + spring.data.mongodb.database: test ports: - 8083:8080 diff --git a/sharding.map b/sharding.map index ffdbb6cb..2a278b08 100644 --- a/sharding.map +++ b/sharding.map @@ -1,10 +1,10 @@ -0 backend_3 +0 backend_2 1 backend_1 2 backend_2 -3 backend_3 +3 backend_1 4 backend_1 -5 backend_2 +5 backend_3 6 backend_3 -7 backend_1 -8 backend_2 -9 backend_3 +7 backend_2 +8 backend_3 +9 backend_1 -- 2.20.1