summaryrefslogtreecommitdiff
path: root/scripts/memcached.sysconfig
diff options
context:
space:
mode:
authorJ. Grizzard <elfchief-github@lupine.org>2017-07-05 08:57:00 -0700
committerdormando <dormando@rydia.net>2018-02-19 21:52:06 -0800
commit7141922a6188b00bc542b29c578506e0db52c9c7 (patch)
tree388e01fd7649d48afb4649d3bc4812bef57460d8 /scripts/memcached.sysconfig
parent4f3d6d6f8ce3b595bbe9fbcce67603f7134def63 (diff)
downloadmemcached-7141922a6188b00bc542b29c578506e0db52c9c7.tar.gz
systemd instancing support & rpm build improvements
The major things this does are adding systemd support to the rpm .spec file, and adding systemd instancing support. This means that it is possible to run multiple memcached instances without having to do any additional configuration or hack on init scripts. To use: systemctl start memcached@11211 memcached@11311 memcached@11411 sysconfig files at /etc/sysconfig/memcached.<port> will be read as appropriate, to allow differing configurations per-port. Defaults will be read from /etc/sysconfig/memcached before the port-specific settings are read. You can also still start memcached the standard way just by doing "systemctl start memcached". This will read /etc/sysconfig/memcached and nothing else. The "enhanced security" lines in the systemd unit file will be commented out on systems where we know systemd isn't knew enough (fedora < 26 and Redhat/CentOS 7), and enabled on other systems. There are two versions of the .service file included, one for standard memcached invocations and one for instanced invocations. The two are very similar, but not identical. Ideally, we'd only have one version in the source tree and we'd massage it with sed or somesuch during the rpm build, but couldn't think of a super clean way to do that, so erred on the side of simplicity. A decent amount of spec file work was needed to enable this functionality. In the process, I also cleaned up several additional aspects of the spec file (like using %{name} in places where it was appropriate). I also commented out the automatic restart in the %postun section, for two main reasons: 1. The try-restart for instanced memcached will produce an error if instanced memcached isn't in use, which is probably quite confusing to people who aren't using that functionality and are just trying to update their package. (There's workarounds for this, but I try to keep pre/post scripts as simple as humanly possible) 2. Automatic restarts on updates means the cache gets flushed, which means you can no longer safely use large-scale management tools (like puppet or chef) to roll out new versions, at least not without a lot of planning first. Not automatically dumping someone's caches feels safer, here.
Diffstat (limited to 'scripts/memcached.sysconfig')
-rw-r--r--scripts/memcached.sysconfig10
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/memcached.sysconfig b/scripts/memcached.sysconfig
new file mode 100644
index 0000000..bd46483
--- /dev/null
+++ b/scripts/memcached.sysconfig
@@ -0,0 +1,10 @@
+# These defaults will be used by every memcached instance, unless overridden
+# by values in /etc/sysconfig/memcached.<port>
+USER="nobody"
+MAXCONN="1024"
+CACHESIZE="64"
+OPTIONS=""
+
+# The PORT variable will only be used by memcached.service, not by
+# memcached@xxxxx services, which will use the xxxxx
+PORT="11211"