diff --git a/addons/mysql/scripts/init-mysql-instance-for-orc.sh b/addons/mysql/scripts/init-mysql-instance-for-orc.sh index e0d18ddd8..c6739e269 100644 --- a/addons/mysql/scripts/init-mysql-instance-for-orc.sh +++ b/addons/mysql/scripts/init-mysql-instance-for-orc.sh @@ -147,7 +147,7 @@ setup_master_slave() { # If the master_pod_name is not empty, change master to the master_pod_name. else mysql_note "Wait for master to be ready" - change_master "$master_pod_name.${CLUSTER_COMPONENT_NAME}-headless.${CLUSTER_NAMESPACE}.svc.cluster.local" + change_master "$master_pod_name.${CLUSTER_COMPONENT_NAME}-headless" fi return 0 } diff --git a/addons/mysql/scripts/mysql-entrypoint.sh b/addons/mysql/scripts/mysql-entrypoint.sh index de519562e..58b015e1d 100644 --- a/addons/mysql/scripts/mysql-entrypoint.sh +++ b/addons/mysql/scripts/mysql-entrypoint.sh @@ -1,6 +1,10 @@ #!/bin/bash self_last_digit=${POD_NAME##*-} -fqdn_name=${CLUSTER_COMPONENT_NAME}-${self_last_digit}.${CLUSTER_COMPONENT_NAME}-headless.${CLUSTER_NAMESPACE}.svc.cluster.local +fqdn_name=${CLUSTER_COMPONENT_NAME}-${self_last_digit}.${CLUSTER_COMPONENT_NAME}-headless +if [ ${#fqdn_name} -gt 60 ] && [ "${MYSQL_MAJOR}" = "5.7" ]; then + echo "Error: The length of the variable exceeds 60 characters" + exit 1 +fi SERVICE_ID=$((${POD_NAME##*-} + 1)) if [ "${MYSQL_MAJOR}" = '5.7' ]; then /scripts/docker-entrypoint.sh mysqld --server-id $SERVICE_ID --report-host ${fqdn_name} \ diff --git a/addons/mysql/scripts/mysql-orchestrator-register.sh b/addons/mysql/scripts/mysql-orchestrator-register.sh index 7579a248b..da1b852c0 100644 --- a/addons/mysql/scripts/mysql-orchestrator-register.sh +++ b/addons/mysql/scripts/mysql-orchestrator-register.sh @@ -43,7 +43,7 @@ register_first_mysql_instance() { IFS=',' read -r -a replicas <<< "${MYSQL_POD_FQDN_LIST}" fqdn_name=${replicas[0]} last_digit=${fqdn_name##*-} - first_mysql_instance=${CLUSTER_COMPONENT_NAME}-${last_digit}.${CLUSTER_COMPONENT_NAME}-headless.${CLUSTER_NAMESPACE}.svc.cluster.local + first_mysql_instance=${CLUSTER_COMPONENT_NAME}-${last_digit}.${CLUSTER_COMPONENT_NAME}-headless register_to_orchestrator "$first_mysql_instance" echo "Initialization script completed!"