Making sure that memcache/memcached starts on reboot

Del Drago

Member
Mar 2, 2012
12
1
53
cPanel Access Level
Root Administrator
Hello,

I recently installed memcache and memcached on my server (CENTOS 7.3 cPanel & WHM 64.0). I used the updated instructions in the first post of the following thread:

Installing memcache and memcached with EasyApache4

specifically:
Code:
yum install ea4-experimental
yum install ea-php56-php-memcache
yum install ea-php56-php-memcached
and
Code:
yum install ea-memcached
I then launched the memcached daemon with the following command:
Code:
memcached -d -u nobody -m 1024 127.0.0.1 -p 11211
I want to ensure that, if my server reboots, both memcache and the memcached daemon restart automatically. What steps must I take to ensure that?

Thanks!
 

Jcats

Well-Known Member
PartnerNOC
May 25, 2011
807
160
168
New Jersey
cPanel Access Level
DataCenter Provider
There is only one daemon, 'memcached', where memcache is a PHP extension that allows you to connect to the memcached daemon, there is also a memcached PHP extension.

The way you are starting memcached, it will not restart when you reboot the server. Run the following:

Code:
kill -9 $(pgrep memcached)
systemctl start memcached
systemctl enable memcached
however are you sure memcached is even installed?

ea-memcached isn't an actual package as far as I am aware.

memcached the daemon is available by default via centos repos.

If you run:

Code:
systemctl start memcached
and see:

Code:
# systemctl start memcached
Failed to start memcached.service: Unit not found.
then run:

Code:
yum clean all
yum -y install memcached
systemctl start memcached
systemctl enable memcached
This will ensure memcached starts up upon rebooting.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,254
463
Hello,

The "ea-memcached" package is currently only available for testing purposes. Ensure to review the EasyApache 4 Experimental Repo document to understand the implications of using packages intended for testing purposes.

If you decide to use the EA4 experimental repo and would like to use the "ea-memcached" package, then you'd run the following command after enabling the EA4 Experimental Repo:

Code:
yum install ea-memcached
Once it's installed, you could review the following files to see how it's configured to start on CentOS 7:

Code:
/usr/lib/systemd/system/memcached.service
Thank you.