安装memcached agent

一.软件下载

wget http://memcached.googlecode.com/files/memcached-1.4.15.tar.gz

wget http://memagent.googlecode.com/files/magent-0.6.tar.gz

wget http://monkey.org/~provos/libevent-2.0.21-stable.tar.gz

mkdir magent-0.6

tar zvxf magent-0.6.tar.gz -C magent-0.6

cd magent-0.6

直接make可能会报错,因为之前你的libevent可能安装的目录跟Makefile里面的不一样,所以需要修改这个文件:

vi Makefile
主要修改以下两行对应你自己的libevent安装目录就行:

 LIBS = -levent -lm -L/usr/local/libevent/lib
CFLAGS = -Wall -g -O2 -I/usr/local/libevent/include $(M64)
然后make,还会报错:

gcc -Wall -g -O2 -I/usr/local/libevent/include -m64 -o magent magent.o ketama.o /usr/lib64/libevent.a /usr/lib64/libm.a 
/usr/lib64/libevent.a(event.o): In function `gettime':
/soft/libevent-2.0.21-stable/event.c:370: undefined reference to `clock_gettime'
/usr/lib64/libevent.a(event.o): In function `detect_monotonic':
/soft/libevent-2.0.21-stable/event.c:340: undefined reference to `clock_gettime'
collect2: ld returned 1 exit status

解决办法:

vi Makefile 

 CFLAGS = -Wall -g -O2 -I/usr/local/libevent/include $(M64)

改为:   

CFLAGS = -lrt -Wall -g -O2 -I/usr/local/libevent/include $(M64)

编译成功:

gcc -lrt -Wall -g -O2 -I/usr/local/libevent/include -m64 -o magent magent.o ketama.o /usr/lib64/libevent.a /usr/lib64/libm.a 
接下来拷贝magent命令到bin目录:

cp magent /usr/bin/magent
启动:

magent -u hbapp -n 51200 -l 192.168.29.47 -p 12000 -s 192.168.29.47:11211 -b 192.168.29.48:11211


你可能感兴趣的:(代理,memcached,单点故障)