summaryrefslogtreecommitdiff
path: root/support-files/mariadb@.socket.in
diff options
context:
space:
mode:
authorDaniel Black <grooverdan@users.sourceforge.net>2015-03-12 07:26:04 +1100
committerDaniel Black <daniel@mariadb.org>2021-03-28 13:53:55 +1100
commit460d480c7496e670686c01a1a1d707fb4d412ece (patch)
treea0e2cdcd128c952c89d4c4cc5795120a47c12ece /support-files/mariadb@.socket.in
parentfa0ad2fb11859fdeec93bbf3c4a6fc418eb372ac (diff)
downloadmariadb-git-460d480c7496e670686c01a1a1d707fb4d412ece.tar.gz
MDEV-5536: add systemd socket activation
Systemd has a socket activation feature where a mariadb.socket definition defines the sockets to listen to, and passes those file descriptors directly to mariadbd to use when a connection occurs. The new functionality is utilized when starting as follows: systemctl start mariadb.socket The mariadb.socket definition only needs to contain the network information, ListenStream= directives, the mariadb.service definition is still used for service instigation. When mariadbd is started in this way, the socket, port, bind-address backlog are all assumed to be self contained in the mariadb.socket definition and as such the mariadb settings and command line arguments of these network settings are ignored. See man systemd.socket for how to limit this to specific ports. Extra ports, those specified with extra_port in socket activation mode, are those with a FileDescriptorName=extra. These need to be in a separate service name like mariadb-extra.socket and these require a Service={mariadb.service} directive to map to the original service. Extra ports need systemd v227 or greater (not RHEL/Centos7 - v219) when FileDescriptorName= was added, otherwise the extra ports are treated like ordinary ports. The number of sockets isn't limited when using systemd socket activation (except by operating system limits on file descriptors and a minimal amount of memory used per file descriptor). The systemd sockets passed can include any ownership or permissions, including those the mariadbd process wouldn't normally have the permission to create. This implementation is compatible with mariadb.service definitions. Those services started with: systemctl start mariadb.service does actually start the mariadb.service and used all the my.cnf settings of sockets and ports like it previously did.
Diffstat (limited to 'support-files/mariadb@.socket.in')
-rw-r--r--support-files/mariadb@.socket.in23
1 files changed, 23 insertions, 0 deletions
diff --git a/support-files/mariadb@.socket.in b/support-files/mariadb@.socket.in
new file mode 100644
index 00000000000..561a44443c9
--- /dev/null
+++ b/support-files/mariadb@.socket.in
@@ -0,0 +1,23 @@
+
+[Unit]
+Description=MariaDB @VERSION@ database server (socket activation multi-instance %I))
+Documentation=man:mariadbd(8)
+Documentation=https://mariadb.com/kb/en/library/systemd/
+
+[Socket]
+
+##############################################################################
+## USERs can override
+##
+##
+## by creating a file in /etc/systemd/system/mariadb.socket.d/MY_SPECIAL.conf
+## and adding/setting the following under [Socket] will override this file's
+## settings.
+
+SocketUser=@MYSQLD_USER@
+SocketMode=777
+
+ListenStream=@mariadb-%I
+ListenStream=@MYSQL_UNIX_ADDR@-%I
+
+# Backlog=150