File tree Expand file tree Collapse file tree 3 files changed +12
-15
lines changed Expand file tree Collapse file tree 3 files changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ function zkConfig() {
1919function zkConnectionString() {
2020 # If the client service address is not yet available, then return localhost
2121 set +e
22- nslookup " ${CLIENT_HOST} " 2> /dev/null 1> /dev/null
23- if [[ $? -eq 1 ]]; then
22+ getent hosts " ${CLIENT_HOST} " 2> /dev/null 1> /dev/null
23+ if [[ $? -ne 0 ]]; then
2424 set -e
2525 echo " localhost:${CLIENT_PORT} "
2626 else
Original file line number Diff line number Diff line change @@ -25,8 +25,8 @@ OK=$(echo ruok | nc 127.0.0.1 $CLIENT_PORT)
2525# Check to see if zookeeper service answers
2626if [[ " $OK " == " imok" ]]; then
2727 set +e
28- nslookup $DOMAIN
29- if [[ $? -eq 1 ]]; then
28+ getent hosts $DOMAIN
29+ if [[ $? -ne 0 ]]; then
3030 set -e
3131 echo " There is no active ensemble, skipping readiness probe..."
3232 exit 0
Original file line number Diff line number Diff line change @@ -69,30 +69,27 @@ if [[ -n "$ENVOY_SIDECAR_STATUS" ]]; then
6969fi
7070set -e
7171
72- # Determine if there is a ensemble available to join by checking the service domain
72+ # Determine if there is an ensemble available to join by checking the service domain
7373set +e
74- nslookup $DOMAIN
75- if [[ $? -eq 0 ]]; then
76- ACTIVE_ENSEMBLE=true
77- elif nslookup $DOMAIN | grep -q " server can't find $DOMAIN " ; then
78- echo " there is no active ensemble"
79- ACTIVE_ENSEMBLE=false
80- else
81- # If an nslookup of the headless service domain fails, then there is no
82- # active ensemble yet, but in certain cases nslookup of headless service
74+ getent hosts $DOMAIN # This only performs a dns lookup
75+ if [[ $? -ne 0 ]]; then
76+ # If dns lookup of the headless service domain fails, then there is no
77+ # active ensemble yet, but in certain cases the dns lookup of headless service
8378 # takes a while to come up even if there is active ensemble
8479 ACTIVE_ENSEMBLE=false
8580 declare -i count=20
8681 while [[ $count -ge 0 ]]
8782 do
8883 sleep 2
8984 (( count= count- 1 ))
90- nslookup $DOMAIN
85+ getent hosts $DOMAIN
9186 if [[ $? -eq 0 ]]; then
9287 ACTIVE_ENSEMBLE=true
9388 break
9489 fi
9590 done
91+ else
92+ ACTIVE_ENSEMBLE=true
9693fi
9794
9895if [[ " $ONDISK_MYID_CONFIG " == true && " $ONDISK_DYN_CONFIG " == true ]]; then
You can’t perform that action at this time.
0 commit comments