-
Notifications
You must be signed in to change notification settings - Fork 442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need Option to Disable Automatic Replication Start in Docker Setup #614
Comments
Thanks for the feature request. I think I can obey -skip-slave-start as a configuration option rather than adding an env variable. Doing a |
START REPLIA was inssued during initializing which mean that even before /docker-entrypoint/initdb.d there was initializtion going on. Entrypoints that needed data initialzation didn't complete with this nicely. Also if there wasn't any initialization there would be little time for the replication to acheive anything before being shutdown ready for the final start. Moved --skip-slave-start to the default docker_temp_server_start implementation. Closes MariaDB#614
I've drafted #615 - can you build/test this locally and see if it works for you. |
Hi @grooverdan - First, thanks for your time, It's a good idea to use --skip-slave-start, but this is a breaking change. If anyone relies on the Am I right? or I'm missing something? |
You are right that there is a compatibility break in The replication is still started on the final/main start of mariadbd (its default for all replication channels to start). With this most cases where a main start waits until replication has caught up before the main workload is still correct. The use case you describe I think is quite a valid one, that is quite hard to achieve with a running replication. Existing running of replication setups without a handling to wait until the replication caught up step would function with identical outcomes - the replication is restarted in the main start and catches up there. The compatibility would be restored by a While a Because of the compatibility change I'd wait until the next release to push this out, and it would be noted in the release notes of the server. Acceptable? |
START REPLIA was issued during initializing which mean that even before /docker-entrypoint/initdb.d there was initializtion going on. Entrypoints that needed data initialzation didn't complete with this nicely. Also if there wasn't any initialization there would be little time for the replication to acheive anything before being shutdown ready for the final start. Moved --skip-slave-start to the default docker_temp_server_start implementation. Technically this is a compaibility break that is likely to be of significants if: * /docker-entrypoint/initdb.d contains a script waiting for replication to catch up. The recitifcation to the previous behaviour is: /docker-entrypoint/initdb.d contains a SQL to START REPLICA. Recommend also having another script that is: until healthcheck.sh --replication_io \ --replication_sql \ --replication_seconds_behind_master=0 \ --replication --no-connect; do sleep 1 done Closes MariaDB#614
START REPLIA was issued during initializing which mean that even before /docker-entrypoint/initdb.d there was initializtion going on. Entrypoints that needed data initialzation didn't complete with this nicely. Also if there wasn't any initialization there would be little time for the replication to acheive anything before being shutdown ready for the final start. Moved --skip-slave-start to the default docker_temp_server_start implementation. Technically this is a compaibility break that is likely to be of significants if: * /docker-entrypoint/initdb.d contains a script waiting for replication to catch up. The recitifcation to the previous behaviour is: /docker-entrypoint/initdb.d contains a SQL to START REPLICA. Recommend also having another script that is: until healthcheck.sh --replication_io \ --replication_sql \ --replication_seconds_behind_master=0 \ --replication --no-connect; do sleep 1 done Closes #614
This is now in released containers. |
Description:
When deploying a MariaDB master-slave replication setup using Docker, the default behavior of the MariaDB Docker container is to automatically start replication on the slave if specific environment variables are provided, namely
MARIADB_MASTER_HOST
,MARIADB_REPLICATION_USER
, andMARIADB_REPLICATION_PASSWORD
.In my scenario, I have an existing master server with existing data, and my backup script (located in
docker-entrypoint-initdb.d
) needs to run before replication starts. However, the container executes theSTART REPLICA
command immediately upon startup, leading to failures since the backup script has not yet been completed.Request:
I propose adding a new environment variable or configuration option to disable the automatic execution of the
START REPLICA
command on container startup. This would allow users to perform necessary pre-replication tasks without encountering errors due to premature replication initiation.Suggested Solution:
MARIADB_DISABLE_REPLICATION
, which, when set totrue
, prevents the automaticSTART REPLICA
command from running.Current Environment Variables:
MARIADB_ROOT_PASSWORD
: 'securepassword123'MARIADB_MASTER_HOST
: master.example.comMARIADB_REPLICATION_USER
: repl_userMARIADB_REPLICATION_PASSWORD
: secureReplicationPass-2024Expected Behavior:
Setting
MARIADB_DISABLE_REPLICATION=true
would prevent the container from starting replication automatically, allowing users to complete any necessary pre-replication tasks or scripts. This new option should not affect the current default behavior, so that users who do not set this variable will experience the existing automatic replication setup.Additional Context:
In my setup, I manually initiate replication after running the backup script. Therefore, having control over when replication starts is crucial for a successful deployment.
Thank you for considering this request. I look forward to your response.
The text was updated successfully, but these errors were encountered: