Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-34943

Disable Automatic Replication start in Docker Official Image /docker-entrypoint/initdb.d

    XMLWordPrintable

Details

    Description

      From https://github.com/MariaDB/mariadb-docker/issues/614

      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, and MARIADB_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 the START 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:

      New Environment Variable: Introduce an environment variable, such as MARIADB_DISABLE_REPLICATION, which, when set to true, prevents the automatic START REPLICA command from running.
      Configuration Option: Alternatively, provide a configuration file option or flag that achieves the same result.

      Current Environment Variables:

      MARIADB_ROOT_PASSWORD: 'securepassword123'
      MARIADB_MASTER_HOST: master.example.com
      MARIADB_REPLICATION_USER: repl_user
      MARIADB_REPLICATION_PASSWORD: secureReplicationPass-2024

      Expected 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.

      Attachments

        Activity

          People

            danblack Daniel Black
            danblack Daniel Black
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.