Skip to content

Commit

Permalink
min master fix to avoid es split brain
Browse files Browse the repository at this point in the history
  • Loading branch information
jcantrill committed Mar 24, 2017
1 parent f4d71e0 commit 4f789b4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion deployer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ENV BIN_DIR=/opt/deploy \
WRITE_KUBECONFIG=1 \
LOGGING_VERSION=6

RUN yum install -y java-1.8.0-openjdk openssl && yum clean all
RUN yum install -y java-1.8.0-openjdk openssl bc && yum clean all

RUN mkdir -p ${HOME} ${SCRATCH_DIR} ${BIN_DIR} && chmod 555 ${BIN_DIR} && chmod 777 ${HOME}
COPY . ${BIN_DIR}
Expand Down
1 change: 1 addition & 0 deletions deployer/conf/elasticsearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ cloud:
discovery:
type: kubernetes
zen.ping.multicast.enabled: false
zen.minimum_master_nodes: ${MIN_MASTERS}

gateway:
expected_master_nodes: ${NODE_QUORUM}
Expand Down
17 changes: 15 additions & 2 deletions deployer/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ function initialize_install_vars() {
journal_read_from_head=${input_vars[journal-read-from-head]:-false}
journal_source=${input_vars[journal-source]:-}

es_min_masters=$(echo "$es_cluster_size / 2 + 1" | bc)
if [ "$es_cluster_size" -eq "1" ]; then
es_min_masters=1
fi

es_ops_min_masters=$(echo "$es_ops_cluster_size / 2 + 1" | bc)
if [ "$es_ops_cluster_size" -eq "1" ]; then
es_ops_min_masters=1
fi


# other env vars used:
# WRITE_KUBECONFIG, KEEP_SUPPORT, ENABLE_OPS_CLUSTER
# *_NODESELECTOR
Expand Down Expand Up @@ -308,7 +319,8 @@ function generate_es_template(){
--param ES_RECOVER_EXPECTED_NODES=${es_recover_expected_nodes} \
--param ES_RECOVER_AFTER_TIME=${es_recover_after_time} \
--param STORAGE_GROUP_DEFAULT=${storage_group} \
--param "$image_params"
--param "$image_params" \
--param ES_MIN_MASTERS=${es_min_masters}

if [ "${input_vars[enable-ops-cluster]}" == true ]; then
create_template_optional_nodeselector "${input_vars[es-ops-nodeselector]}" es \
Expand All @@ -319,7 +331,8 @@ function generate_es_template(){
--param ES_RECOVER_EXPECTED_NODES=${es_ops_recover_expected_nodes} \
--param ES_RECOVER_AFTER_TIME=${es_ops_recover_after_time} \
--param STORAGE_GROUP_DEFAULT=${storage_group} \
--param "$image_params"
--param "$image_params" \
--param ES_MIN_MASTERS=${es_ops_min_masters}
fi
}

Expand Down
8 changes: 8 additions & 0 deletions deployer/templates/es.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ objects:
-
name: INSTANCE_RAM
value: ${INSTANCE_RAM}
-
name: MIN_MASTERS
value: ${MIN_MASTERS}
-
name: NODE_QUORUM
value: ${NODE_QUORUM}
Expand Down Expand Up @@ -147,9 +150,14 @@ objects:
description: "Numeric ID of a supplemental group for storage volume access."
name: STORAGE_GROUP
value: ${STORAGE_GROUP_DEFAULT}
-
description: "The mimimum number of masters that must be present in the ES cluster for the master election process to complete"
name: MIN_MASTERS
value: ${ES_MIN_MASTERS}
parameters:
- name: ES_CLUSTER_NAME
- name: ES_INSTANCE_RAM
- name: ES_MIN_MASTERS
- name: ES_NODE_QUORUM
- name: ES_RECOVER_AFTER_NODES
- name: ES_RECOVER_EXPECTED_NODES
Expand Down

0 comments on commit 4f789b4

Please sign in to comment.