1. Install dependent software
# yum-y Install libevent libevent-devel perl-test-harness perl-time-hires perl-termreadkey perl-test-compile cpan perl pe Rl-test-class
If make test fails, try Yum install perl-test*
2, installation memcached
# cd/usr/local/src/
# wgethttp://www.memcached.org/files/memcached-1.4.29.tar.gz
# tar XVF memcached-1.4.29.tar.gz
# CD Memcached-1.4.29
#./configure--prefix=/usr/local/memcached
# make
# Make Test
# make Install
3. Start memcached
#/usr/local/memcached/bin/memcached-d-M 128-u root-p 11211-u 11211-p/tmp/memcached.pid
Startup parameter Description:/usr/local/memcached/bin/memcached-h view Help
-P is a PID file that is set to save Memcache
The-c option is the maximum number of concurrent connections that are running, by default 1024
-P is the port that sets the TCP listener for memcache, preferably a port above 1024, the default is 11211
-L is the server IP address of the listener, which defaults to all network cards.
-U is a UDP listening port setting memcache
-U is the user running memcache, and if it is currently root, you need to specify the user with this parameter.
-M return error on memory exhausted (rather than removing items)
-M is the amount of memory allocated to Memcache, in megabytes, default 64MB
The-D option is to start a daemon,
4, Memcache Boot
# vim/etc/rc.d/init.d/memcached
#!/bin/sh
#
# memcached:memcached Daemon
#
# Chkconfig:-90 25
# description:memcached Daemon
#
# Source function library.
. /etc/rc.d/init.d/functions
. /etc/sysconfig/network
#[${networking} = "No"] && exit 0
#[-r/etc/sysconfig/dund] | | Exit 0
#. /etc/sysconfig/dund
#[-Z "$DUNDARGS"] && exit 0
Start ()
{
Echo-n $ "Starting memcached:"
#如需修改启动参数, modify it here
Daemon $MEMCACHED-D-M 128-u root-p 11211-u 11211-p/tmp/memcached.pid
Echo
}
Stop ()
{
Echo-n $ "Shutting down memcached:"
Killproc memcached
Echo
}
#注意修改下面memcached的路径
Memcached= "/usr/local/memcached/bin/memcached"
[-F $MEMCACHED] | | Exit 1
# See how we were called.
Case "$" in
Start
Start
;;
Stop
Stop
;;
Restart
Stop
Sleep 3
Start
;;
*)
echo $ "Usage: $ {Start|stop|restart}"
Exit 1
Esac
Exit 0
# chmod 755/etc/init.d/memcached
# chkconfig--add memcached
# chkconfig memcached on
# service memcached Start
Note: Alternatively, you can add the start command to/etc/rc.local and let memcached boot
5. Clear Cache method
Method 1:telnet 127.0.0.1 11211 executes the flush_all command
Method 2: Restart memcached
Turn from
Memcached Installation-today's headline (www.toutiao.com)
http://www.toutiao.com/i6432180294589088257/
memcached installing "Go"