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

Proposition to add one-shot logic for the --wsrep-new-cluster option

    XMLWordPrintable

    Details

      Description

      Currently there is no easy method and out-of-box option to automatically start MariaDB + Galera with automatic cluster bootstrapping.

      Galera requires a bootstrap phase that are provided by the galera_new_cluster script for the systemd or calling manually the service mysql bootstrap command for the SysVinit. Both cases requires manual actions. Also this approach will not work with environments without systemd and SysVinit like Docker containers.

      Current workaround for the MariaDB container to automatically run Galera cluster with automatic cluster bootstrapping is to create a special wrapper for the mysqld daemon and set the GALERA_NEW_CLUSTER=1 environment variable for the first container in the cluster:

      #!/usr/bin/env sh
       
      if [ -s /var/lib/mysql/gvwstate.dat ]; then
          GALERA_NEW_CLUSTER=
      fi
       
      /usr/local/bin/docker-entrypoint.sh mysqld ${GALERA_NEW_CLUSTER:+--wsrep-new-cluster} ${@:+$@}
      

      The one-shot bootstrapping is provided by the first if statement. Galera during the cluster creation creates the /var/lib/mysql/gvwstate.dat file. This file is used for auto-detecting that cluster was already bootstrapped by the --wsrep-new-cluster option.

      Proposition:

      • Please add an optional argument to the --wsrep-new-cluster option for the mysqld daemon like for example once (or one-shot) that will implement this logic. Example: mysqld --wsrep-new-cluster=once
      • Without arguments it will behave like before (default, always bootstrap)
      • Additional always argument for explicit invocation (like without arguments, default, always bootstrap)
      • Add supports for a new environment variable MARIADB_NEW_CLUSTER that will allow to pass once or always (default) arguments for the --wsrep-new-cluster option

      This should not only simplify running Galera cluster in multi container scenario but in other scenarios also.

        Attachments

          Activity

            People

            Assignee:
            danblack Daniel Black
            Reporter:
            tymonx Tymoteusz Blazejczyk
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: