Installation
Before installing memcached, complete the installation of libevent library.
apt install libevent-devapt install memcached
Check if the process is success
memcached -V
Configuration
- Start
memcached -u root -p 11211 -m 1024m -d
*Attention: Do not use this command directly!
Memcached don’t have password setting, so anyone who knows your IP and mamcached’s port can connect to your memcached use telnet through following command
telnet YOURIP PORT_OF_MEMCACHED
It’s a serious security problem, to refuse the connection from attackers, use following command to start memcached
memcached -u root -p 11211 -l 127.0.0.1 -m 1024m -d
The parameter -l with 127.0.0.1 ensures only localhost can connect to memecached.
- Stop
*Attention: unofficial way to stop memcached. I don’t know what’s the standard command to stop. Actually I’ve tried many commands from different technical blogs but they all didn’t work.
ps -ef | grep memcached
Find the pid of memcached, and
kill -9 PID