cd /usr/local mkdir magent cd magent/ wgethttp://memagent.googlecode.com/files/magent-0.5.tar.gz tar zxvf magent-0.5.tar.gz /sbin/ldconfig sed -i "s/LIBS = -levent/LIBS =-levent -lm/g" Makefile make
magent命令参数:
1 2 3 4 5 6 7 8 9 10 11 12 13
-hthis message -u uid -g gid -p port, defaultis11211. (0to disable tcpsupport) -s ip:port, set memcached server ip andport -b ip:port, set backup memcached server ip andport -l ip, local bind ip address, defaultis0.0.0.0 -n number, set max connections, defaultis4096 -D don't go to background -k use ketama key allocation algorithm -f file, unix socket path to listen on. defaultis off -i number, max keep alive connections for onememcached server, defaultis20 -v verbose
wget http://monkey.org/~provos/libevent-1.4.13-stable.tar.gz tar -xzvf libevent-1.4.13-stable.tar.gz cd libevent-1.4.13-stable ./configure --prefix=/usr/local/libevent make make install
2、安装Memcached:
1 2 3 4 5 6 7
wget http://memcached.googlecode.com/files/memcached-1.4.4.tar.gz tar -xzvf memcached-1.4.4.tar.gz cd memcached-1.4.4 ./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent make make install ln -s /usr/local/libevent/lib/libevent-1.4.so.2 /usr/lib/
3、编译安装magent:
1 2 3 4 5 6 7 8 9
mkdir magent cp magent-0.5.tar.gz magent cd magent tar -xzvf magent-0.5.tar.gz /sbin/ldconfig sed -i"s#LIBS = -levent#LIBS = -levent -lm#g" Makefile vi magent.c 添加 #include <limits.h> make
# telnet 192.168.1.219 12000 Trying1192.168.1.219... Connected to 192.168.1。219. Escape character is '^]'. stats memcached agent v0.4 matrix1 -> 192.168.1.219:11211, pool size 0 matrix2 -> 192.168.1.219:11212, pool size 0 END set key1 005 reesun STORED set key2 006 reesun1 STORED quit Connection closed by foreign host.
# telnet 192.168.1.219 11211 Trying192.168.1.219... Connected to 192.168.1.219. Escape character is '^]'. get key1 END get key2 VALUE key2 06 reesun1 END quit Connection closed by foreign host.
# telnet 192.168.1.219 11212 Trying192.168.1.219... Connected to 1192.168.1.219. Escape character is '^]'. get key1 VALUE key1 05 reesun END get key2 END quit Connection closed by foreign host.
# telnet 192.168.1.219 11213 Trying192.168.1.219... Connected to 1192.168.1.219. Escape character is '^]'. get key1 VALUE key1 05 reesun END get key2 VALUE key2 06 reesun1 END quit Connection closed by foreign host.