From a45fa8aa4befd4a8079830103f15ef78de2e0105 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 17 Sep 2023 12:48:13 +0200 Subject: [PATCH] WIP:haproxysharding --- README.sh | 3 +++ docker-compose.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/README.sh b/README.sh index 49adab0b..8883ace0 100644 --- a/README.sh +++ b/README.sh @@ -1,3 +1,6 @@ #!/bin/sh docker run --rm --sysctl net.ipv4.ip_unprivileged_port_start=0 -v $(pwd)./haproxy.cfg://usr/local/etc/haproxy/haproxy.cfg:ro haproxy:2.7 -c i=$(($i+1)); echo -n "Nachricht #$i -- $(date)" | http put :8080/5c73531c-6fc4-426c-adcb-afc5c140a0f7/kai/$i X-Shard:2 +echo "show map" | socat stdio tcp4-connect:127.0.0.1:8401 +echo "show map /usr/local/etc/haproxy/sharding.map" | socat stdio tcp4-connect:127.0.0.1:8401 +echo "set map /usr/local/etc/haproxy/sharding.map 0 backend_3" | socat stdio tcp4-connect:127.0.0.1:8401 diff --git a/docker-compose.yml b/docker-compose.yml index 7aed1f90..1f17d08c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -45,6 +45,7 @@ services: image: juplo/chat-backend:0.0.1-SNAPSHOT environment: chat.backend.services: kafka + chat.backend.instance-id: backend_1 chat.backend.kafka.instance-uri: http://backend-1 chat.backend.kafka.client-id-prefix: 1 chat.backend.kafka.bootstrap-servers: kafka:9092 @@ -55,6 +56,7 @@ services: image: juplo/chat-backend:0.0.1-SNAPSHOT environment: chat.backend.services: kafka + chat.backend.instance-id: backend_2 chat.backend.kafka.instance-uri: http://backend-2 chat.backend.kafka.client-id-prefix: 2 chat.backend.kafka.bootstrap-servers: kafka:9092 @@ -65,6 +67,7 @@ services: image: juplo/chat-backend:0.0.1-SNAPSHOT environment: chat.backend.services: kafka + chat.backend.instance-id: backend_3 chat.backend.kafka.instance-uri: http://backend-3 chat.backend.kafka.client-id-prefix: 3 chat.backend.kafka.bootstrap-servers: kafka:9092 -- 2.20.1