WIP:haproxysharding
authorKai Moritz <kai@juplo.de>
Sun, 17 Sep 2023 10:48:13 +0000 (12:48 +0200)
committerKai Moritz <kai@juplo.de>
Sun, 17 Sep 2023 10:48:13 +0000 (12:48 +0200)
README.sh
docker-compose.yml

index 49adab0..8883ace 100644 (file)
--- 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
index 7aed1f9..1f17d08 100644 (file)
@@ -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