再重新make,出现以下
gcc -Wall -O2 -g -I/usr/local/libevent/include -c -o magent.o magent.c
magent.c: 在函数‘writev_list’中:
magent.c:623: 错误:‘SSIZE_MAX’未声明(在此函数内第一次使用)
magent.c:623: 错误:(即使在一个函数内多次出现,每个未声明的标识符在其
magent.c:623: 错误:所在的函数内也只报告一次。)
make: *** [magent.o] 错误 1
需要修改vim ketama.h
在第一行加上
#ifndef SSIZE_MAX
在第四行加上
#define SSIZE_MAX 32676
在最后添加
#endif
再重新make,出现以下则成功
[root@test magent]# make
gcc -Wall -O2 -g -I/usr/local/libevent/include -c -o magent.o magent.c
gcc -Wall -O2 -g -I/usr/local/libevent/include -c -o ketama.o ketama.c
gcc -Wall -O2 -g -o magent magent.o ketama.o -levent -lm -L/usr/local/libevent/lib
执行magent后又报错,则需要执行cp magent /usr/bin/magent
bash: magent: command not found
执行magent出现以下则表示成功
[root@test magent]# magent
please provide -s "ip:port" argument
memcached agent v0.4 Build-Date: Apr 23 2015 21:24:28
Usage:
-h this message
-u uid
-g gid
-p port, default is 11211. (0 to disable tcp support)
-s ip:port, set memcached server ip and port
-b ip:port, set backup memcached server ip and port
-l ip, local bind ip address, default is 0.0.0.0
-n number, set max connections, default is 4096
-D don't go to background
-k use ketama key allocation algorithm
-f file, unix socket path to listen on. default is off
-i number, set max keep alive connections for one memcached server, default is 20
-v verbose