[CentOS] multiple memcached buckets in CentOS 7

Wed Mar 18 03:58:41 UTC 2015
Tim Dunphy <bluethundr at gmail.com>

Hey guys,

 OK so I'm pretty familiar with how to edit an init script for memcached so
that I can get multiple memcached 'buckets' when starting up the service.

The init script would ususally have multiple lines such as these under the
start function:

# cache_block
        /usr/local/bin/memcached -d -m 128 -l `hostname -i` -p 11318 -u
daemon -c 8172 -v 2>> /tmp/memcached.log
        # cache_filter
        /usr/local/bin/memcached -d -m 512 -l `hostname -i` -p 11319 -u
daemon -c 8172 -v 2>> /tmp/memcached.log
        # cache_form
        /usr/local/bin/memcached -d -m 128 -l `hostname -i` -p 11320 -u
daemon -c 8172 -v 2>> /tmp/memcached.log

Now, under CentOS 7, I see we have two files controlling memcached under
the new sysctl system. At least, using sysctl is new to me!

I see we have this file:

[root at web1:~] #cat  /usr/lib/systemd/system/memcached.service
[Unit]
Description=Memcached
Before=httpd.service
After=network.target

[Service]
Type=simple
EnvironmentFile=-/etc/sysconfig/memcached
ExecStart=/usr/bin/memcached -u $USER -p $PORT -m $CACHESIZE -c $MAXCONN
$OPTIONS

[Install]
WantedBy=multi-user.target

And we have this one under sysconfig:

[root at web1:~] #cat /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS=""

So I'm trying to figure out how to achive the same effect that I would
under the old init script way of doing things.

Can someone please give me an example of how to get the same thing done
under the new system?

Thanks,
Tim

-- 
GPG me!!

gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B