17
17
# variable MYSQLD_MULTI_INSTANCE controls each instance to ensure it is
18
18
# run independently.
19
19
#
20
+ # This is not suitable for Galera as specialised SST recovery scripts are
21
+ # needed.
22
+ #
20
23
# Suffix Mechanism (default):
21
24
#
22
- # MYSQLD_MULTI_INSTANCE=--defaults-group-suffix=.%I
25
+ # MYSQLD_MULTI_INSTANCE=--defaults-group-suffix=.%I --basedir=@prefix@
23
26
#
24
27
# With this option, the [mysqld.{instancename}] group is read from the default
25
28
# configuration file.
56
59
#
57
60
# Then run "systemctl daemon-reload".
58
61
#
62
+ # Multi User Based Mechanism
63
+ #
64
+ # Create instances in users home directory with abstract socket:
65
+ #
66
+ # [Service]
67
+ # User=%I
68
+ # ProtectHome=false
69
+ # Environment=MYSQLD_MULTI_INSTANCE="--defaults-file=/home/%I/my%I.cnf --datadir=/home/%I/mysqldatadir --skip-networking --socket=@mysql-%I"
70
+ #
59
71
# CONFLICTING VARIABLES
60
72
#
61
73
# A number of MariaDB system variables may conflict. The main ones that need to
64
76
# * port
65
77
# * datadir
66
78
#
67
- # Galera will require:
68
- # * wsrep_node_address
69
- # * wsrep_cluster_address
70
- # * ensure SST mechanisms don't conflict on network ports or temporary locations
71
- #
72
79
# PRE-10.3
73
80
#
74
81
# Before 10.3 MYSQLD_MULTI_INSTANCE was effectively --defaults-file=@sysconf2dir@/my%I.cnf
@@ -131,9 +138,6 @@ PrivateNetwork=false
131
138
## Package maintainers
132
139
##
133
140
134
- User=mysql
135
- Group=mysql
136
-
137
141
# To allow memlock to be used as non-root user if set in configuration
138
142
CapabilityBoundingSet=CAP_IPC_LOCK
139
143
@@ -149,37 +153,16 @@ PrivateDevices=true
149
153
# Prevent accessing /home, /root and /run/user
150
154
ProtectHome=true
151
155
152
- # Execute pre and post scripts as root, otherwise it does it as User=
153
- PermissionsStartOnly=true
154
-
155
- # Perform automatic wsrep recovery. When server is started without wsrep,
156
- # galera_recovery simply returns an empty string. In any case, however,
157
- # the script is not expected to return with a non-zero status.
158
- # It is always safe to unset _WSREP_START_POSITION%I environment variable.
159
- # Do not panic if galera_recovery script is not available. (MDEV-10538)
160
- ExecStartPre=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION%I"
161
-
162
- ExecStartPre=/bin/sh -c "[ ! -e @bindir@/galera_recovery ] && VAR= || \
163
- VAR=`@bindir@/galera_recovery $MYSQLD_MULTI_INSTANCE`; [ $? -eq 0 ] \
164
- && systemctl set-environment _WSREP_START_POSITION%I=$VAR || exit 1"
165
-
166
156
# Needed to create system tables etc.
167
- ExecStartPre=@scriptdir@/mysql_install_db $MYSQLD_MULTI_INSTANCE --user=mysql
157
+ ExecStartPre=@scriptdir@/mysql_install_db $MYSQLD_MULTI_INSTANCE
168
158
169
159
# Start main service
170
160
# A few variables are here:
171
161
# * MYSQLD_MULTI_INSTANCE - control how multiple instances are distinguisable
172
- # * _WSREP_NEW_CLUSTER - for the exclusive use of the script galera_new_cluster
173
162
# * MYSQLD_OPTS - user definable extras - not a replacement for my.cnf
174
163
#
175
164
# Note 1: Place $MYSQLD_OPTS at the very end for its options to take precedence.
176
- # Note 2: we set --basedir to prevent probes that might trigger SELinux alarms,
177
- # per bug https://bugzilla.redhat.com/show_bug.cgi?id=547485
178
- ExecStart=@sbindir@/mysqld $MYSQLD_MULTI_INSTANCE --basedir=@prefix@ \
179
- $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION%I $MYSQLD_OPTS
180
-
181
- # Unset _WSREP_START_POSITION environment variable.
182
- ExecStartPost=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION%I"
165
+ ExecStart=@sbindir@/mysqld $MYSQLD_MULTI_INSTANCE $MYSQLD_OPTS
183
166
184
167
KillSignal=SIGTERM
185
168
@@ -215,7 +198,17 @@ UMask=007
215
198
PrivateTmp=false
216
199
217
200
# Controlling how multiple instances are separated. See top of this file.
218
- Environment=MYSQLD_MULTI_INSTANCE=--defaults-group-suffix=.%I
201
+ # Note 1: This service isn't User=mysql be default so we need to be explicit.
202
+ # Note 2: we set --basedir to prevent probes that might trigger SELinux alarms,
203
+ # per bug https://bugzilla.redhat.com/show_bug.cgi?id=547485. Its as an option
204
+ # here as a user may want to use the MYSQLD_MULTI_INSTANCE to run multiple
205
+ # versions.
206
+ Environment=MYSQLD_MULTI_INSTANCE=--defaults-group-suffix=.%I --basedir=@prefix@
207
+
208
+ # While you can override these, you shouldn't leave them empty as that
209
+ # will default to root.
210
+ User=mysql
211
+ Group=mysql
219
212
220
213
##
221
214
## Options previously available to be set via [mysqld_safe]
0 commit comments