Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Add HA configuration #23

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion container/appmaster/runit/service/flink/run
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,14 @@ function add_if_non_empty() {
fi
}

function add_if_non_empty_to_config() {
if [ -n "$2" ]; then
echo "$1: $2" >> ${FLINK_HOME}/conf/flink-conf.yaml
fi
}

function add_mesos_configurations() {
add_if_non_empty jobmanager.rpc.address $(hostname -f)
add_if_non_empty jobmanager.rpc.address $(hostname -f)
add_if_non_empty mesos.resourcemanager.framework.role "${FLINK_DISPATCHER_MESOS_ROLE}"
add_if_non_empty mesos.resourcemanager.framework.principal "${FLINK_DISPATCHER_MESOS_PRINCIPAL}"
add_if_non_empty mesos.resourcemanager.framework.secret "${FLINK_DISPATCHER_MESOS_SECRET}"
Expand Down Expand Up @@ -74,13 +80,46 @@ function add_kerberos_configurations() {
fi
}

function add_ha_configurations() {
if [[ "${FLINK_HA_ENABLED}" == true ]]; then
add_if_non_empty_to_config high-availability ZOOKEEPER
add_if_non_empty_to_config high-availability.cluster-id "${FLINK_HIGH_AVAILABILITY_CLUSTER_ID}"
add_if_non_empty_to_config high-availability.storageDir "${FLINK_HIGH_AVAILABILITY_STORAGE_DIR}"
add_if_non_empty_to_config high-availability.zookeeper.quorum "${FLINK_HIGH_AVAILABILITY_ZOOKEEPER_QUORUM}"
add_if_non_empty_to_config high-availability.jobmanager.port "${FLINK_HIGH_AVAILABILITY_JOBMANAGER_PORT}"
add_if_non_empty_to_config high-availability.job.delay "${FLINK_HIGH_AVAILABILITY_JOB_DELAY}"
add_if_non_empty_to_config high-availability.zookeeper.path.root "${FLINK_HIGH_AVAILABILITY_ZOOKEEPER_PATH_ROOT}"
add_if_non_empty_to_config high-availability.zookeeper.path.running-registry \
"${FLINK_HIGH_AVAILABILITY_ZOOKEEPER_PATH_RUNNING_REGISTRY}"
add_if_non_empty_to_config high-availability.zookeeper.path.latch "${FLINK_HIGH_AVAILABILITY_ZOOKEEPER_PATH_LEADER_LATCH}"
add_if_non_empty_to_config high-availability.zookeeper.path.jobgraphs "${FLINK_HIGH_AVAILABILITY_ZOOKEEPER_PATH_JOBGRAPHS}"
add_if_non_empty_to_config high-availability.zookeeper.path.leader "${FLINK_HIGH_AVAILABILITY_ZOOKEEPER_PATH_LEADER}"
add_if_non_empty_to_config high-availability.zookeeper.path.checkpoints "${FLINK_HIGH_AVAILABILITY_ZOOKEEPER_PATH_CHECKPOINTS}"
add_if_non_empty_to_config high-availability.zookeeper.path.checkpoint-counter "${FLINK_HIGH_AVAILABILITY_ZOOKEEPER_PATH_CHECKPOINT_COUNTER}"
add_if_non_empty_to_config high-availability.zookeeper.path.mesos-workers "${FLINK_HIGH_AVAILABILITY_ZOOKEEPER_PATH_MESOS_WORKERS}"

# used for the client at ha services initiated by the mesos app master runner
add_if_non_empty_to_config high-availability.zookeeper.client.session-timeout \
"${FLINK_HIGH_AVAILABILITY_ZOOKEEPER_CLIENT_SESSION_TIMEOUT}"
add_if_non_empty_to_config high-availability.zookeeper.client.connection-timeout \
"${FLINK_HIGH_AVAILABILITY_ZOOKEEPER_CLIENT_CONNECTION_TIMEOUT}"
add_if_non_empty_to_config high-availability.zookeeper.client.retry-wait \
"${FLINK_HIGH_AVAILABILITY_ZOOKEEPER_CLIENT_RETRY_WAIT}"
add_if_non_empty_to_config high-availability.zookeeper.client.max-retry-attempts \
"${FLINK_HIGH_AVAILABILITY_ZOOKEEPER_CLIENT_MAX_RETRY_ATTEMPTS}"
add_if_non_empty_to_config high-availability.zookeeper.client.acl \
"${FLINK_HIGH_AVAILABILITY_ZOOKEEPER_CLIENT_ACL}"
fi
}

function update_log_level() {
if [[ "${FLINK_LOG_LEVEL}" != "" ]]; then
sed -ie 's/log4j.rootLogger=INFO, file/log4j.rootLogger='"${FLINK_LOG_LEVEL}"', file/g' ${FLINK_HOME}/conf/log4j.properties
fi
}

add_flink_configurations
add_ha_configurations
add_mesos_configurations
add_ssl_configurations
add_kerberos_configurations
Expand Down