@@ -26,17 +26,33 @@ if [ $? != 0 ]; then
2626 exit 1
2727fi
2828version=${version% .* }
29- if awk " BEGIN {exit !($version < 7.8)}" ; then
30- url=${endpoint} /_cluster/voting_config_exclusions/$KB_LEAVE_MEMBER_POD_NAME
29+ # Check if voting_config_exclusions API is supported (available from ES 7.0+)
30+ if awk " BEGIN {exit !($version >= 7.0)}" ; then
31+ if awk " BEGIN {exit !($version < 7.8)}" ; then
32+ url=${endpoint} /_cluster/voting_config_exclusions/$KB_LEAVE_MEMBER_POD_NAME
33+ else
34+ url=${endpoint} /_cluster/voting_config_exclusions? node_names=$KB_LEAVE_MEMBER_POD_NAME
35+ fi
36+ curl ${common_options} -v -X POST $url
37+ if [ $? != 0 ]; then
38+ echo " failed to add node $KB_LEAVE_MEMBER_POD_NAME to voting config exclusion list"
39+ echo " may be the voting config exclusion list is full, try to remove it first"
40+ curl ${common_options} -X DELETE " ${endpoint} /_cluster/voting_config_exclusions?pretty&wait_for_removal=false"
41+ exit 1
42+ else
43+ echo " successfully added node $KB_LEAVE_MEMBER_POD_NAME to voting config exclusion list"
44+ fi
3145else
32- url=${endpoint} /_cluster/voting_config_exclusions? node_names=$KB_LEAVE_MEMBER_POD_NAME
33- fi
34- curl ${common_options} -v -X POST $url
35- if [ $? != 0 ]; then
36- echo " failed to add node $KB_LEAVE_MEMBER_POD_NAME to voting config exclusion list"
37- echo " may be the voting config exclusion list is full, try to remove it first"
38- curl ${common_options} -X DELETE " ${endpoint} /_cluster/voting_config_exclusions?pretty&wait_for_removal=false"
39- exit 1
40- else
41- echo " successfully added node $KB_LEAVE_MEMBER_POD_NAME to voting config exclusion list"
46+ echo " ES version $version does not support voting_config_exclusions API, skipping node exclusion"
47+
48+ # For ES 6.x, check if this is a master node and warn about minimum_master_nodes
49+ if [[ " $KB_LEAVE_MEMBER_POD_NAME " == * -master-* ]]; then
50+ echo " WARNING: Removing master node $KB_LEAVE_MEMBER_POD_NAME from ES $version cluster"
51+ echo " Please ensure the remaining master nodes count >= minimum_master_nodes setting"
52+ echo " Check cluster health after removal to avoid split-brain scenarios"
53+ else
54+ echo " Removing data node $KB_LEAVE_MEMBER_POD_NAME , data will be automatically migrated"
55+ fi
56+
57+ echo " Node $KB_LEAVE_MEMBER_POD_NAME will be removed from cluster naturally"
4258fi
0 commit comments