summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Black <grooverdan@users.sourceforge.net>2015-10-15 15:38:45 +0200
committerNirbhay Choubey <nirbhay@mariadb.com>2015-11-02 23:37:03 -0500
commita2c3549404cbdc55aaaa8537739853d7369aa79a (patch)
treeebfe09c518850bed19795bcc79636310947e62b1
parent7877438f3152bb2bdc17ed6cdea94838fdd47be0 (diff)
downloadmariadb-git-a2c3549404cbdc55aaaa8537739853d7369aa79a.tar.gz
MDEV-427: systemd - use galera_new_cluster instead of bootstrap
Use galera_new_cluster instead. systemctl start mariadb@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@bootstrap.service failed. See "systemctl status mariadb@bootstrap.service" and "journalctl -xe" for details. ● mariadb@bootstrap.service - MariaDB database server Loaded: loaded (/usr/lib/systemd/system/mariadb@.service; disabled; vendor preset: disabled) Drop-In: /usr/lib/systemd/system/mariadb@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@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@bootstrap.service entered failed state. Oct 15 19:27:52 spaceman systemd[1]: mariadb@bootstrap.service failed.
-rw-r--r--cmake/systemd.cmake5
-rwxr-xr-xscripts/galera_new_cluster.sh14
-rw-r--r--support-files/CMakeLists.txt8
-rw-r--r--support-files/mariadb.service.in3
-rw-r--r--support-files/mariadb@.service.in3
-rw-r--r--support-files/use_galera_new_cluster.conf22
-rw-r--r--support-files/wsrep-new-cluster.conf16
7 files changed, 47 insertions, 24 deletions
diff --git a/cmake/systemd.cmake b/cmake/systemd.cmake
index 30374e4c348..b0161cf9114 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@.service
- ${INSTALL_SYSTEMD_UNITDIR}/mariadb@bootstrap.service.d/wsrep-new-cluster.conf")
+ ${INSTALL_SYSTEMD_UNITDIR}/mariadb@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 00000000000..0720116020d
--- /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@service}
+
+/usr/bin/systemctl set-environment _WSREP_NEW_CLUSTER=''
diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt
index c357528954f..eff2be375b4 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@.service.in
${CMAKE_CURRENT_BINARY_DIR}/mariadb@.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@.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@bootstrap.service.d"
COMPONENT Server)
diff --git a/support-files/mariadb.service.in b/support-files/mariadb.service.in
index 0b4e8f6befe..6a53f427054 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@.service.in b/support-files/mariadb@.service.in
index dd9eded610f..4555df81e39 100644
--- a/support-files/mariadb@.service.in
+++ b/support-files/mariadb@.service.in
@@ -59,9 +59,10 @@ 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
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 00000000000..90e0365ffd8
--- /dev/null
+++ b/support-files/use_galera_new_cluster.conf
@@ -0,0 +1,22 @@
+#
+# Install as /etc/systemd/system/mariadb@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@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 a71b26ae788..00000000000
--- a/support-files/wsrep-new-cluster.conf
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Install as /etc/systemd/system/mariadb@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
-