File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 5
5
# process and is only used to implement a scalable service architecture.
6
6
7
7
# Wait until primary node is ready
8
- /wait-for-host.sh couchdb1 && /wait-for-it.sh couchdb1:5984 -t 300
8
+ /wait-for-host.sh couchdb1 && /wait-for-it.sh couchdb1:5984 -t 300 && /wait-for-it.sh couchdb1:5986 -t 300
9
9
10
10
if [ $TASK_SLOT -eq 1 ]; then
11
11
echo " Setting up primary node..."
22
22
echo " Setting up secondary node..."
23
23
24
24
# Wait until secondary node is ready
25
- /wait-for-host.sh couchdb$TASK_SLOT && /wait-for-it.sh couchdb$TASK_SLOT :5984 -t 300
25
+ /wait-for-host.sh couchdb$TASK_SLOT && /wait-for-it.sh couchdb$TASK_SLOT :5984 -t 300 && /wait-for-it.sh couchdb $TASK_SLOT :5986 -t 300
26
26
27
- # Register membership
28
- curl -X PUT http://$COUCHDB_USER :$COUCHDB_PASSWORD @couchdb1:5986/_nodes/couchdb@couchdb$TASK_SLOT -d {}
27
+ # Register membership. We need to register couchdb1 with this node (couchdb$TASK_SLOT) and not
28
+ # vise-versa as this way, we can use `/wait-for-host.sh couchdb1` to guarantee that we have a
29
+ # clear route to couchdb1. Otherwise, if we try establishing the membership in the other
30
+ # direction, a race condition in the /etc/hosts entries could lead to couchdb1 not being able to
31
+ # connect to this node.
32
+ curl -X PUT http://$COUCHDB_USER :$COUCHDB_PASSWORD @couchdb$TASK_SLOT :5986/_nodes/couchdb@couchdb1 -d {}
29
33
fi
You can’t perform that action at this time.
0 commit comments