[CentOS] multiple memcached buckets in CentOS 7

Tim Dunphy bluethundr at gmail.com
Wed Mar 18 16:16:51 UTC 2015


Hi Alberto,

With systemd it will be as easy as creating additional unit files ( one for
> each memcached instance) with its corresponding config file.  That should
> allow to stop / start / restart  each memcache instance individually while
> also being systemd compliant.


Thanks for the info and for the examples. It really does make sense the way
you explain it. Thanks for letting me know!

Best regards,
Tim

On Wed, Mar 18, 2015 at 1:06 AM, Alberto Rivera Laporte <arlaporte at gmail.com
> wrote:

> >
> >
> > 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?
> >
> >
> As you said earlier on earlier ( non-systemd) versions of the memcached
> init scripts, you would define all instances of memcache under the start
> function.
>
> With systemd it will be as easy as creating additional unit files ( one for
> each memcached instance) with its corresponding config file.  That should
> allow to stop / start / restart  each memcache instance individually while
> also being systemd compliant.
>
>
> Examples:
>
> ## first instance ##
> #  /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
>
> #  /etc/sysconfig/memcached
> PORT="11211"
> USER="memcached"
> MAXCONN="1024"
> CACHESIZE="64"
> OPTIONS=""
> ## end first instance
>
> ## second instance ##
>
> ## second instance ##
> #  /usr/lib/systemd/system/memcached-11214.service
> [Unit]
> Description=Memcached-11214
> Before=httpd.service
> After=network.target
>
> [Service]
> Type=simple
> EnvironmentFile=-/etc/sysconfig/memcached-11214
> ExecStart=/usr/bin/memcached -u $USER -p $PORT -m $CACHESIZE -c $MAXCONN
> $OPTIONS
>
> #  /etc/sysconfig/memcached-11214
> PORT="11214"
> USER="memcached"
> MAXCONN="1024"
> CACHESIZE="64"
> OPTIONS=""
> ## end second instance
>
> Lastly enable each service if not already enabled:
> # instance 1
> systemctl enable /usr/lib/systemd/system/memcached.service
> systemctl start memcached.service
>
> # instance 2
> systemctl enable /usr/lib/systemd/system/memcached-11214.service
> systemctl start memcached-11214.service
>
> You can also still use legacy sysv init scripts as there is support for
> backwards compatibility however the systemd approach is much simpler while
> adhering to the systemd standard.
>
> Good luck.
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>



-- 
GPG me!!

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



More information about the CentOS mailing list