From 217a03ab35cd6447799cc1858369a1c8615a8d27 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 13 Jun 2020 07:50:06 +0000 Subject: [PATCH] Script for fixing Master Address --- environment_bnode_script.sh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 environment_bnode_script.sh diff --git a/environment_bnode_script.sh b/environment_bnode_script.sh new file mode 100755 index 0000000..903ae2d --- /dev/null +++ b/environment_bnode_script.sh @@ -0,0 +1,8 @@ +#!/bin/bash +unset MASTER_ADDR +mcontainer_addr=$(ssh root@10.0.3.100 "docker ps|xargs -n1|grep -i NAMES -A 1|tail -1") +MASTER_ADDR=$(ssh -t root@10.0.3.100 "docker exec -it $mcontainer_addr ip a s|grep -i 10.0|head -1 2>/dev/null" 2>&1 |grep inet|awk '{print $2}'|cut -d "/" -f 1) +[ -z $MASTER_ADDR ] && echo "Node 1 hasn't yet been initialized" && exit 1 +env MASTER_ADDR="${MASTER_ADDR}" docker stack deploy -c stack.yaml stack +env MASTER_ADDR="${MASTER_ADDR}" docker service scale stack_bnode=1 +