I installed memcache in my CentOS server, and the respective libraries for php as well:
Despite having installed both of them, I ended using Memcache
$memcache = new Memcache;
Since I wanted the memcache service to run automatically after rebooting the server, I did this:
memcached -d -u nobody -m 512 -p 11211 127.0.0.1
chkconfig memcached on
Then I checked:
chkconfig --list | grep memcache
> memcached 0:off 1:off 2:on 3:on 4:on 5:on 6:off
After a few minutes of use:
echo stats | nc 127.0.0.1 11211
STAT pid 30412
STAT uptime 1616
STAT time 1424280050
STAT version 1.4.15
STAT libevent 1.4.13-stable
STAT pointer_size 64
STAT rusage_user 0.053991
STAT rusage_system 0.152976
STAT curr_connections 42
STAT total_connections 144
STAT connection_structures 43
STAT reserved_fds 20
STAT cmd_get 639
STAT cmd_set 360
STAT cmd_flush 0
STAT cmd_touch 0
STAT get_hits 262
STAT get_misses 377
STAT delete_misses 0
STAT delete_hits 0
STAT incr_misses 0
STAT incr_hits 0
STAT decr_misses 0
STAT decr_hits 0
STAT cas_misses 0
STAT cas_hits 0
STAT cas_badval 0
STAT touch_hits 0
STAT touch_misses 0
STAT auth_cmds 0
STAT auth_errors 0
STAT bytes_read 147954
STAT bytes_written 455620
STAT limit_maxbytes 536870912
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT threads 4
STAT conn_yields 0
STAT hash_power_level 16
STAT hash_bytes 524288
STAT hash_is_expanding 0
STAT bytes 138385
STAT curr_items 359
STAT total_items 360
STAT expired_unfetched 0
STAT evicted_unfetched 0
STAT evictions 0
STAT reclaimed 1
END
Everything ran fine for a few weeks. After that time I decided to check the service status, and for some reason, memcache was not running at all. I had to put it back on (i did reboot the server at some point in those weeks):
memcached -d -u nobody -m 512 -p 11211 127.0.0.1
Why didn't memcache start automatically after the reboot? Isn't that what chkconfig memcached on
is for? Why could it have stopped working?