#!/bin/bash # # This is an entrypoint that runs the MySQL server in the 'slave' mode. # source ${CONTAINER_SCRIPTS_PATH}/common.sh set -eu export_setting_variables log_volume_info $MYSQL_DATADIR export MYSQL_RUNNING_AS_SLAVE=1 [ -f ${CONTAINER_SCRIPTS_PATH}/validate-replication-variables.sh ] && source ${CONTAINER_SCRIPTS_PATH}/validate-replication-variables.sh # Generate the unique 'server-id' for this master export MYSQL_SERVER_ID=$(server_id) log_info "The 'slave' server-id is ${MYSQL_SERVER_ID}" # Process the MySQL configuration files log_info 'Processing MySQL configuration files ...' envsubst < ${CONTAINER_SCRIPTS_PATH}/my-base.cnf.template > /etc/my.cnf.d/base.cnf envsubst < ${CONTAINER_SCRIPTS_PATH}/my-paas.cnf.template > /etc/my.cnf.d/paas.cnf envsubst < ${CONTAINER_SCRIPTS_PATH}/my-slave.cnf.template > /etc/my.cnf.d/slave.cnf envsubst < ${CONTAINER_SCRIPTS_PATH}/my-repl-gtid.cnf.template > /etc/my.cnf.d/repl-gtid.cnf envsubst < ${CONTAINER_SCRIPTS_PATH}/my-tuning.cnf.template > /etc/my.cnf.d/tuning.cnf if [ ! -e "${MYSQL_DATADIR}/mysql" ]; then # Initialize MySQL database and wait for the MySQL master to accept # connections. initialize_database "$@" wait_for_mysql_master mysql $mysql_flags <&1