Skip to content

Commit

Permalink
chore: set --skip-slave-start=on for mysql entrypoint (#1354)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyelei authored Dec 23, 2024
1 parent dac6947 commit c982cd5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 18 deletions.
4 changes: 2 additions & 2 deletions addons/mysql/scripts/mysql-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ if [ "${MYSQL_MAJOR}" = '5.7' ]; then
--plugin-load-add=rpl_semi_sync_slave=semisync_slave.so \
--plugin-load-add=audit_log=audit_log.so \
--log-bin=/var/lib/mysql/binlog/${POD_NAME}-bin \
--skip-slave-start=$skip_slave_start
--skip-slave-start=ON
elif [ "${MYSQL_MAJOR}" = '8.0' ]; then
docker-entrypoint.sh mysqld --server-id $SERVICE_ID --report-host ${REPORT_HOST} \
--plugin-load-add=rpl_semi_sync_source=semisync_source.so \
--plugin-load-add=rpl_semi_sync_replica=semisync_replica.so \
--plugin-load-add=audit_log=audit_log.so \
--log-bin=/var/lib/mysql/binlog/${POD_NAME}-bin \
--skip-slave-start=$skip_slave_start
--skip-slave-start=ON
else
echo "Unsupported MySQL version"
exit 1
Expand Down
6 changes: 1 addition & 5 deletions addons/mysql/templates/cmpd-mysql57.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,14 @@ spec:
cp {{ .Values.dataMountPath }}/plugin/audit_log.so /usr/lib64/mysql/plugin/
chown -R mysql:root {{ .Values.dataMountPath }}
export LD_PRELOAD=/tools/lib/libjemalloc.so.2
skip_slave_start="OFF"
if [ -f {{ .Values.dataMountPath }}/data/.restore_new_cluster ]; then
skip_slave_start="ON"
fi
SERVICE_ID=$((${POD_NAME##*-} + 1))
docker-entrypoint.sh mysqld --server-id $SERVICE_ID \
--ignore-db-dir=lost+found \
--plugin-load-add=rpl_semi_sync_master=semisync_master.so \
--plugin-load-add=rpl_semi_sync_slave=semisync_slave.so \
--plugin-load-add=audit_log=audit_log.so \
--log-bin=/var/lib/mysql/binlog/${POD_NAME}-bin \
--skip-slave-start=$skip_slave_start
--skip-slave-start=ON
volumeMounts:
- mountPath: {{ .Values.dataMountPath }}
name: data
Expand Down
6 changes: 1 addition & 5 deletions addons/mysql/templates/cmpd-mysql80.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,14 @@ spec:
- |
cp {{ .Values.dataMountPath }}/plugin/audit_log.so /usr/lib64/mysql/plugin/
chown -R mysql:root {{ .Values.dataMountPath }}
skip_slave_start="OFF"
export LD_PRELOAD=/tools/lib/libjemalloc.so.2
if [ -f {{ .Values.dataMountPath }}/data/.restore_new_cluster ]; then
skip_slave_start="ON"
fi
SERVICE_ID=$((${POD_NAME##*-} + 1))
docker-entrypoint.sh mysqld --server-id $SERVICE_ID \
--plugin-load-add=rpl_semi_sync_source=semisync_source.so \
--plugin-load-add=rpl_semi_sync_replica=semisync_replica.so \
--plugin-load-add=audit_log=audit_log.so \
--log-bin=/var/lib/mysql/binlog/${POD_NAME}-bin \
--skip-slave-start=$skip_slave_start
--skip-slave-start=ON
volumeMounts:
- mountPath: {{ .Values.dataMountPath }}
name: data
Expand Down
8 changes: 2 additions & 6 deletions addons/mysql/templates/cmpd-mysql84.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,13 @@ spec:
- |
mkdir -p {{ .Values.dataMountPath }}/{log,binlog,auditlog}
chown -R mysql:root {{ .Values.dataMountPath }}
skip_slave_start="OFF"
export LD_PRELOAD=/tools/lib/libjemalloc.so.2
if [ -f {{ .Values.dataMountPath }}/data/.restore_new_cluster ]; then
skip_slave_start="ON"
fi
export LD_PRELOAD=/tools/lib/libjemalloc.so.2
SERVICE_ID=$((${POD_NAME##*-} + 1))
docker-entrypoint.sh mysqld --server-id $SERVICE_ID \
--plugin-load-add=rpl_semi_sync_source=semisync_source.so \
--plugin-load-add=rpl_semi_sync_replica=semisync_replica.so \
--log-bin=/var/lib/mysql/binlog/${POD_NAME}-bin \
--skip-slave-start=$skip_slave_start
--skip-slave-start=ON
volumeMounts:
- mountPath: {{ .Values.dataMountPath }}
name: data
Expand Down

0 comments on commit c982cd5

Please sign in to comment.