Advertisement
Guest User

Untitled

a guest
Dec 13th, 2023
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.78 KB | None | 0 0
  1. # It's not recommended to modify this file in-place, because it will be
  2. # overwritten during package upgrades. If you want to customize, the
  3. # best way is to create a file "/etc/systemd/system/mariadb.service",
  4. # containing
  5. # .include /usr/lib/systemd/system/mariadb.service
  6. # ...make your changes here...
  7. # or create a file "/etc/systemd/system/mariadb.service.d/foo.conf",
  8. # which doesn't need to include ".include" call and which will be parsed
  9. # after the file mariadb.service itself is parsed.
  10. #
  11. # For more info about custom unit files, see systemd.unit(5) or
  12. # https://mariadb.com/kb/en/mariadb/systemd/
  13. #
  14. # Copyright notice:
  15. #
  16. # This file is free software; you can redistribute it and/or modify it
  17. # under the terms of the GNU Lesser General Public License as published by
  18. # the Free Software Foundation; either version 2.1 of the License, or
  19. # (at your option) any later version.
  20.  
  21. [Unit]
  22. Description=MariaDB 10.4.32 database server
  23. Documentation=man:mysqld(8)
  24. Documentation=https://mariadb.com/kb/en/library/systemd/
  25. After=network.target
  26.  
  27. [Install]
  28. WantedBy=multi-user.target
  29. Alias=mysql.service
  30. Alias=mysqld.service
  31.  
  32.  
  33. [Service]
  34.  
  35. ##############################################################################
  36. ## Core requirements
  37. ##
  38.  
  39. Type=notify
  40.  
  41. # Setting this to true can break replication and the Type=notify settings
  42. # See also bind-address mysqld option.
  43. PrivateNetwork=false
  44.  
  45. ##############################################################################
  46. ## Package maintainers
  47. ##
  48.  
  49. User=mysql
  50. Group=mysql
  51.  
  52. # CAP_IPC_LOCK To allow memlock to be used as non-root user
  53. # CAP_DAC_OVERRIDE To allow auth_pam_tool (which is SUID root) to read /etc/shadow when it's chmod 0
  54. # does nothing for non-root, not needed if /etc/shadow is u+r
  55. # CAP_AUDIT_WRITE auth_pam_tool needs it on Debian for whatever reason
  56. CapabilityBoundingSet=CAP_IPC_LOCK CAP_DAC_OVERRIDE CAP_AUDIT_WRITE
  57.  
  58. # PrivateDevices=true implies NoNewPrivileges=true and
  59. # SUID auth_pam_tool suddenly doesn't do setuid anymore
  60. PrivateDevices=false
  61.  
  62. # Prevent writes to /usr, /boot, and /etc
  63. ProtectSystem=full
  64.  
  65.  
  66.  
  67. # Doesn't yet work properly with SELinux enabled
  68. # NoNewPrivileges=true
  69.  
  70. # Prevent accessing /home, /root and /run/user
  71. ProtectHome=true
  72.  
  73. # Execute pre and post scripts as root, otherwise it does it as User=
  74. PermissionsStartOnly=true
  75.  
  76.  
  77.  
  78. # Perform automatic wsrep recovery. When server is started without wsrep,
  79. # galera_recovery simply returns an empty string. In any case, however,
  80. # the script is not expected to return with a non-zero status.
  81. # It is always safe to unset _WSREP_START_POSITION environment variable.
  82. # Do not panic if galera_recovery script is not available. (MDEV-10538)
  83. ExecStartPre=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION"
  84. ExecStartPre=/bin/sh -c "[ ! -e /usr/bin/galera_recovery ] && VAR= || \
  85. VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ] \
  86. && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1"
  87.  
  88. # Needed to create system tables etc.
  89. # ExecStartPre=/usr/bin/mysql_install_db -u mysql
  90.  
  91. # Start main service
  92. # MYSQLD_OPTS here is for users to set in /etc/systemd/system/mariadb.service.d/MY_SPECIAL.conf
  93. # Use the [Service] section and Environment="MYSQLD_OPTS=...".
  94. # This isn't a replacement for my.cnf.
  95. # _WSREP_NEW_CLUSTER is for the exclusive use of the script galera_new_cluster
  96. ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION
  97.  
  98. # Unset _WSREP_START_POSITION environment variable.
  99. ExecStartPost=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION"
  100.  
  101.  
  102.  
  103. KillSignal=SIGTERM
  104.  
  105. # Don't want to see an automated SIGKILL ever
  106. SendSIGKILL=no
  107.  
  108. # Restart crashed server only, on-failure would also restart, for example, when
  109. # my.cnf contains unknown option
  110. Restart=on-abort
  111. RestartSec=5s
  112.  
  113. UMask=007
  114.  
  115. ##############################################################################
  116. ## USERs can override
  117. ##
  118. ##
  119. ## by creating a file in /etc/systemd/system/mariadb.service.d/MY_SPECIAL.conf
  120. ## and adding/setting the following under [Service] will override this file's
  121. ## settings.
  122.  
  123. # Useful options not previously available in [mysqld_safe]
  124.  
  125. # Kernels like killing mysqld when out of memory because its big.
  126. # Lets temper that preference a little.
  127. # OOMScoreAdjust=-600
  128.  
  129. # Explicitly start with high IO priority
  130. # BlockIOWeight=1000
  131.  
  132. # If you don't use the /tmp directory for SELECT ... OUTFILE and
  133. # LOAD DATA INFILE you can enable PrivateTmp=true for a little more security.
  134. PrivateTmp=false
  135.  
  136. # Set an explicit Start and Stop timeout of 900 seconds (15 minutes!)
  137. # this is the same value as used in SysV init scripts in the past
  138. # Galera might need a longer timeout, check the KB if you want to change this:
  139. # https://mariadb.com/kb/en/library/systemd/#configuring-the-systemd-service-timeout
  140. TimeoutStartSec=900
  141. TimeoutStopSec=900
  142.  
  143. ##
  144. ## Options previously available to be set via [mysqld_safe]
  145. ## that now needs to be set by systemd config files as mysqld_safe
  146. ## isn't executed.
  147. ##
  148.  
  149. # Number of files limit. previously [mysqld_safe] open-files-limit
  150. LimitNOFILE=32768
  151.  
  152. # Maximium core size. previously [mysqld_safe] core-file-size
  153. # LimitCore=
  154.  
  155. # Nice priority. previously [mysqld_safe] nice
  156. # Nice=-5
  157.  
  158. # Timezone. previously [mysqld_safe] timezone
  159. # Environment="TZ=UTC"
  160.  
  161. # Library substitutions. previously [mysqld_safe] malloc-lib with explicit paths
  162. # (in LD_LIBRARY_PATH) and library name (in LD_PRELOAD).
  163. # Environment="LD_LIBRARY_PATH=/path1 /path2" "LD_PRELOAD=
  164.  
  165. # Flush caches. previously [mysqld_safe] flush-caches=1
  166. # ExecStartPre=sync
  167. # ExecStartPre=sysctl -q -w vm.drop_caches=3
  168.  
  169. # numa-interleave=1 equalivant
  170. # Change ExecStart=numactl --interleave=all /usr/sbin/mysqld......
  171.  
  172. # crash-script equalivent
  173. # FailureAction=
  174.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement