From: Kai Moritz Date: Sun, 15 Jan 2023 19:06:09 +0000 (+0100) Subject: feat: Configrued the `chat-backend` with a working static sharding X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=443fb6d5135832c367d21b4610d3e4d15ac94be8;p=demos%2Fkafka%2Fchat feat: Configrued the `chat-backend` with a working static sharding --- 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