|
|
|
@ -17,7 +17,7 @@
|
|
|
|
|
|
|
|
|
|
# Setup FLINK_HOME
|
|
|
|
|
args=("$@")
|
|
|
|
|
# Loop through command-line arguments
|
|
|
|
|
# Check if FLINK_HOME is set in command-line arguments by "--flink-home"
|
|
|
|
|
for ((i=0; i < ${#args[@]}; i++)); do
|
|
|
|
|
case "${args[i]}" in
|
|
|
|
|
--flink-home)
|
|
|
|
@ -28,8 +28,20 @@ for ((i=0; i < ${#args[@]}; i++)); do
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
if [[ -z $FLINK_HOME ]]; then
|
|
|
|
|
echo "[ERROR] Unable to find FLINK_HOME either in command-line argument \"--flink-home\" or environment variable \"FLINK_HOME\"."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Setup Flink related configurations
|
|
|
|
|
# Setting _FLINK_HOME_DETERMINED in order to avoid config.sh to overwrite it
|
|
|
|
|
_FLINK_HOME_DETERMINED=1
|
|
|
|
|
# FLINK_CONF_DIR is required by config.sh
|
|
|
|
|
FLINK_CONF_DIR=$FLINK_HOME/conf
|
|
|
|
|
# Use config.sh to setup Flink related configurations
|
|
|
|
|
. $FLINK_HOME/bin/config.sh
|
|
|
|
|
|
|
|
|
|
# Define directories
|
|
|
|
|
# Define Flink CDC directories
|
|
|
|
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
|
|
|
FLINK_CDC_HOME="$SCRIPT_DIR"/..
|
|
|
|
|
FLINK_CDC_CONF="$FLINK_CDC_HOME"/conf
|
|
|
|
@ -46,23 +58,14 @@ done
|
|
|
|
|
for jar in "$FLINK_CDC_LIB"/*.jar; do
|
|
|
|
|
CLASSPATH=$CLASSPATH:$jar
|
|
|
|
|
done
|
|
|
|
|
# Add Hadoop classpath, which is defined in config.sh
|
|
|
|
|
CLASSPATH=$CLASSPATH:$INTERNAL_HADOOP_CLASSPATHS
|
|
|
|
|
# Trim classpath
|
|
|
|
|
CLASSPATH=${CLASSPATH#:}
|
|
|
|
|
|
|
|
|
|
# Setup Java by operating system
|
|
|
|
|
UNAME=$(uname -s)
|
|
|
|
|
if [ "${UNAME:0:6}" == "CYGWIN" ]; then
|
|
|
|
|
JAVA_RUN=java
|
|
|
|
|
else
|
|
|
|
|
if [[ -d "$JAVA_HOME" ]]; then
|
|
|
|
|
JAVA_RUN="$JAVA_HOME"/bin/java
|
|
|
|
|
else
|
|
|
|
|
JAVA_RUN=java
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Setup logging
|
|
|
|
|
LOG=$FLINK_CDC_LOG/flink-cdc-cli-$HOSTNAME.log
|
|
|
|
|
LOG_SETTINGS=(-Dlog.file="$LOG" -Dlog4j.configuration=file:"$FLINK_CDC_CONF"/log4j-cli.properties -Dlog4j.configurationFile=file:"$FLINK_CDC_CONF"/log4j-cli.properties)
|
|
|
|
|
|
|
|
|
|
# JAVA_RUN should have been setup in config.sh
|
|
|
|
|
exec "$JAVA_RUN" -classpath "$CLASSPATH" "${LOG_SETTINGS[@]}" com.ververica.cdc.cli.CliFrontend "$@"
|
|
|
|
|