######install libevent 1st########

mkdir -p /home/chentp/tools/

cd /home/chentp/tools/

tar xf libevent-1.4.13-stable.tar.gz 

cd libevent-1.4.13-stable

./configure 

make && make install


######install memcached 2nd######

cd /home/chentp/tools/

tar xf memcached-1.4.13.tar.gz 

cd  memcached-1.4.13

./configure 

make && make install



##for centos 6 fix##

echo "/usr/local/lib" >> /etc/ld.so.conf

ldconfig 


######start memcached 3rd######

echo "memcached -p 11211 -u root -m 32m -c 10240 -d" >>/etc/rc.local

memcached -p 11211 -u root -m 32m -c 10240 -d

memcached -p 11211 -u root -m 32m -c 10240 -d -P /var/run/memcached.pid

netstat -tuanp|grep memcached

tcp        0      0 0.0.0.0:11211               0.0.0.0:*                   LISTEN      12187/memcached     

tcp        0      0 :::11211                    :::*                        LISTEN      12187/memcached     

udp        0      0 0.0.0.0:11211               0.0.0.0:*                               12187/memcached     

udp        0      0 :::11211                    :::*                                    12187/memcached 

#notes:you can start with diffrent port to seperate memory allocation#


#test it with nc#

[root@memcached memcached-1.4.13]# printf "set key1 0 0 6\r\nchentp\r\n" | nc 127.0.0.1 11211

STORED

[root@memcached memcached-1.4.13]# printf "get key1\r\n"|nc 127.0.0.1 11211

VALUE key1 0 6

chentp

END

[root@memcached memcached-1.4.13]# printf "delete key1\r\n"|nc 127.0.0.1 11211

DELETED


[root@memcached memcached-1.4.13]# printf "stats\r\n"|nc 127.0.0.1 11211

....

STAT get_hits 3

STAT get_misses 11

....


END

#test it with telnet#

[root@memcached memcached-1.4.13]# telnet 127.0.0.1 11211

Trying 127.0.0.1...

Connected to 127.0.0.1.

Escape character is '^]'.

set key 0 0 10   

chentp



STORED

get key

VALUE key 0 10

chentp


END

#manage it with memadmin

cd /application/nginx/html/admin

wget http://www.junopen.com/memadmin/memadmin-1.0.12.tar.gz

tar xf memadmin-1.0.12.tar.gz

http://admin.chentp.com/memadmin/

默认用户名admin密码admin