Hi again 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. I just wanted to say thank you again for your advice. Worked like a charm! [root@web1:~] #systemctl start memcached.service [root@web1:~] #lsof -i :11211 | head -5 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME memcached 20604 memcached 26u IPv4 10415567 0t0 TCP *:memcache (LISTEN) memcached 20604 memcached 27u IPv6 10415568 0t0 TCP *:memcache (LISTEN) memcached 20604 memcached 28u IPv4 10415571 0t0 UDP *:memcache memcached 20604 memcached 29u IPv4 10415571 0t0 UDP *:memcache [root@web1:~] #systemctl start memcached-11212.service [root@web1:~] #systemctl start memcached-11212.service [root@web1:~] #lsof -i :11212 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME memcached 20635 memcached 26u IPv4 10415718 0t0 TCP *:11212 (LISTEN) memcached 20635 memcached 27u IPv6 10415719 0t0 TCP *:11212 (LISTEN) memcached 20635 memcached 28u IPv4 10415722 0t0 UDP *:11212 memcached 20635 memcached 29u IPv4 10415722 0t0 UDP *:11212 memcached 20635 memcached 30u IPv4 10415722 0t0 UDP *:11212 memcached 20635 memcached 31u IPv4 10415722 0t0 UDP *:11212 memcached 20635 memcached 32u IPv6 10415723 0t0 UDP *:11212 memcached 20635 memcached 33u IPv6 10415723 0t0 UDP *:11212 memcached 20635 memcached 34u IPv6 10415723 0t0 UDP *:11212 memcached 20635 memcached 35u IPv6 10415723 0t0 UDP *:11212 I ran my demonstration on ports 11211 and 11212 as you can see above. I really appreciate the info you've provided and have stored that in my notes for myself and others to use. Best regards, Tim On Wed, Mar 18, 2015 at 12:16 PM, Tim Dunphy <bluethu...@gmail.com> wrote: > 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 < > arlapo...@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@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@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@centos.org >> http://lists.centos.org/mailman/listinfo/centos >> > > > > -- > GPG me!! > > gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B > > -- GPG me!! gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos