[Commits] a2c3549: MDEV-427: systemd - use galera_new_cluster instead of bootstrap

Nirbhay Choubey nirbhay at mariadb.com
Tue Nov 3 06:37:03 EET 2015


revision-id: a2c3549404cbdc55aaaa8537739853d7369aa79a
parent(s): 7877438f3152bb2bdc17ed6cdea94838fdd47be0
committer: Nirbhay Choubey
branch nick: 10.1
timestamp: 2015-11-02 23:37:03 -0500
message:

MDEV-427: systemd - use galera_new_cluster instead of bootstrap

Use galera_new_cluster instead. systemctl start mariadb at bootstrap
will generate error message, use_galera_new_cluster.conf is the name
of the file that will generate this error.

Output:

Job for mariadb at bootstrap.service failed. See "systemctl status
mariadb at bootstrap.service" and "journalctl -xe" for details.

● mariadb at bootstrap.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb at .service; disabled;
vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/mariadb at bootstrap.service.d
           └─use_galera_new_cluster.conf
   Active: failed (Result: exit-code) since Thu 2015-10-15 19:27:52
CEST; 5s ago
  Process: 24334 ExecStart=/usr/bin/false (code=exited,
status=1/FAILURE)
  Process: 24330 ExecStart=/usr/bin/echo Please use galera_new_cluster
to start the mariadb service with --wsrep-new-cluster (code=exited,
status=0/SUCCESS)
 Main PID: 24334 (code=exited, status=1/FAILURE)

Oct 15 19:27:52 spaceman systemd[1]: Starting MariaDB database server...
Oct 15 19:27:52 spaceman systemd[1]: mariadb at bootstrap.service: main
process exited, code=exited, status=1/FAILURE
Oct 15 19:27:52 spaceman systemd[1]: Failed to start MariaDB database
server.
Oct 15 19:27:52 spaceman systemd[1]: Unit mariadb at bootstrap.service
entered failed state.
Oct 15 19:27:52 spaceman systemd[1]: mariadb at bootstrap.service failed.

---
 cmake/systemd.cmake                       |  5 +++--
 scripts/galera_new_cluster.sh             | 14 ++++++++++++++
 support-files/CMakeLists.txt              |  8 ++++----
 support-files/mariadb.service.in          |  3 ++-
 support-files/mariadb at .service.in         |  3 ++-
 support-files/use_galera_new_cluster.conf | 22 ++++++++++++++++++++++
 support-files/wsrep-new-cluster.conf      | 16 ----------------
 7 files changed, 47 insertions(+), 24 deletions(-)

diff --git a/cmake/systemd.cmake b/cmake/systemd.cmake
index 30374e4..b0161cf 100644
--- a/cmake/systemd.cmake
+++ b/cmake/systemd.cmake
@@ -55,11 +55,12 @@ MACRO(CHECK_SYSTEMD)
       IF(HAVE_SYSTEMD AND HAVE_SYSTEMD_SD_DAEMON_H AND HAVE_SYSTEMD_SD_LISTEN_FDS
          AND HAVE_SYSTEMD_SD_NOTIFY AND HAVE_SYSTEMD_SD_NOTIFYF)
         ADD_DEFINITIONS(-DHAVE_SYSTEMD)
-        SET(SYSTEMD_SCRIPTS mariadb-service-convert)
+        SET(SYSTEMD_SCRIPTS mariadb-service-convert galera_new_cluster)
         SET(SYSTEMD_DEB_FILES "usr/bin/mariadb-service-convert
+                               usr/bin/galera_new_cluster
                                ${INSTALL_SYSTEMD_UNITDIR}/mariadb.service
                                ${INSTALL_SYSTEMD_UNITDIR}/mariadb at .service
-                               ${INSTALL_SYSTEMD_UNITDIR}/mariadb at bootstrap.service.d/wsrep-new-cluster.conf")
+                               ${INSTALL_SYSTEMD_UNITDIR}/mariadb at bootstrap.service.d/use_galera_new_cluster.conf")
         IF(DEB)
           SET(SYSTEMD_EXECSTARTPRE "ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld")
           SET(SYSTEMD_EXECSTARTPOST "ExecStartPost=/etc/mysql/debian-start")
diff --git a/scripts/galera_new_cluster.sh b/scripts/galera_new_cluster.sh
new file mode 100755
index 0000000..0720116
--- /dev/null
+++ b/scripts/galera_new_cluster.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+VERSION="@VERSION@@MYSQL_SERVER_SUFFIX@"
+COMPILATION_COMMENT="@COMPILATION_COMMENT@"
+
+/usr/bin/systemctl set-environment _WSREP_NEW_CLUSTER='--wsrep-new-cluster' && \
+     /usr/bin/systemctl start {1:-mariadb at service}
+
+/usr/bin/systemctl set-environment _WSREP_NEW_CLUSTER=''
diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt
index c357528..eff2be3 100644
--- a/support-files/CMakeLists.txt
+++ b/support-files/CMakeLists.txt
@@ -79,10 +79,10 @@ IF(UNIX)
   IF(HAVE_SYSTEMD)
     CONFIGURE_FILE(mariadb.service.in
                    ${CMAKE_CURRENT_BINARY_DIR}/mariadb.service @ONLY)
-    IF(NOT RPM)
+    IF(CMAKE_VERSION VERSION_LESS 3.3.0)
       CONFIGURE_FILE(mariadb at .service.in
                      ${CMAKE_CURRENT_BINARY_DIR}/mariadb at .service @ONLY)
-      INSTALL(FILES wsrep-new-cluster.conf
+      INSTALL(FILES use_galera_new_cluster.conf
               ${CMAKE_CURRENT_BINARY_DIR}/mariadb.service
               ${CMAKE_CURRENT_BINARY_DIR}/mariadb at .service
               DESTINATION ${inst_location}/systemd COMPONENT SupportFiles)
@@ -90,8 +90,8 @@ IF(UNIX)
     IF(INSTALL_SYSTEMD_UNITDIR)
       # @ in directory name broken between CMake version 2.8.12.2 and 3.3
       # http://public.kitware.com/Bug/view.php?id=14782
-      IF(NOT RPM)
-        INSTALL(FILES wsrep-new-cluster.conf
+      IF(NOT CMAKE_VERSION VERSION_LESS 3.3.0 OR NOT RPM)
+        INSTALL(FILES use_galera_new_cluster.conf
                 DESTINATION
                 "${INSTALL_SYSTEMD_UNITDIR}/mariadb at bootstrap.service.d"
                 COMPONENT Server)
diff --git a/support-files/mariadb.service.in b/support-files/mariadb.service.in
index 0b4e8f6..6a53f42 100644
--- a/support-files/mariadb.service.in
+++ b/support-files/mariadb.service.in
@@ -52,8 +52,9 @@ PermissionsStartOnly=true
 # MYSQLD_OPTS here is for users to set in /etc/systemd/system/mariadb.service.d/MY_SPECIAL.conf
 # Use the [service] section and Environment="MYSQLD_OPTS=...".
 # This isn't a replacement for my.cnf.
+# _WSREP_NEW_CLUSTER is for the exclusive use of the script galera_new_cluster
 @SYSTEMD_EXECSTARTPRE@
-ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS
+ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER
 @SYSTEMD_EXECSTARTPOST@
 
 KillMode=process
diff --git a/support-files/mariadb at .service.in b/support-files/mariadb at .service.in
index dd9eded..4555df8 100644
--- a/support-files/mariadb at .service.in
+++ b/support-files/mariadb at .service.in
@@ -59,9 +59,10 @@ PermissionsStartOnly=true
 # MYSQLD_OPTS here is for users to set in /etc/systemd/system/mariadb at .service.d/MY_SPECIAL.conf
 # Use the [service] section and Environment="MYSQLD_OPTS=...".
 # This isn't a replacement for my.cnf.
+# _WSREP_NEW_CLUSTER is for the exclusive use of the script galera_new_cluster
 
 ExecStart=
-ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS --defaults-file=@INSTALL_SYSCONF2DIR@/my%I.cnf
+ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER --defaults-file=@INSTALL_SYSCONF2DIR@/my%I.cnf
 # Alternate: (remove ConditionPathExists above)
 # use [mysqld.INSTANCENAME] as sections in my.cnf
 #
diff --git a/support-files/use_galera_new_cluster.conf b/support-files/use_galera_new_cluster.conf
new file mode 100644
index 0000000..90e0365
--- /dev/null
+++ b/support-files/use_galera_new_cluster.conf
@@ -0,0 +1,22 @@
+#
+# Install as /etc/systemd/system/mariadb at bootstrap.service.d/use_galera_new_cluster.conf
+#
+# MariaDB uses /usr/bin/galera_new_cluster
+#
+# This is here to help guide people that may have used Percona mysql at bootstrap
+# to the correct implementation.
+
+[Unit]
+
+ConditionPathExists=
+
+[Service]
+
+Type=oneshot
+Restart=no
+
+# Override the multi instance service for a bootstrap start instance
+ExecStart=
+ExecStart=/usr/bin/echo "Please use galera_new_cluster to start the mariadb service with --wsrep-new-cluster"
+ExecStart=/usr/bin/false
+
diff --git a/support-files/wsrep-new-cluster.conf b/support-files/wsrep-new-cluster.conf
deleted file mode 100644
index a71b26a..0000000
--- a/support-files/wsrep-new-cluster.conf
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Install as /etc/systemd/system/mariadb at bootstrap.service.d/wsrep-new-cluster.conf
-#
-# This uses the multi instance version as a base.
-#
-
-[Unit]
-
-ConditionPathExists=
-
-[Service]
-
-# Override the multi instance service for a bootstrap start instance
-ExecStart=
-ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS --wsrep-new-cluster
-


More information about the commits mailing list