安装memcache集群管理工具magent
一、安装libevent
tar xf libevent-2.0.20-stable.tar.gz
cd libevent-2.0.20
./configure --prefix=/usr/local/libevent
make && make install
echo "/usr/local/libevent/lib" > /etc/ld.so.conf.d/libevent.conf
ldconfig
二、安装magent
mkdir /usr/local/magent
tar xf magent-0.5.tar.gz -C /usr/local/magent
/sbin/ldconfig
cd /usr/local/magent/
vim Makefile
LIBS = -levent -lm -L /usr/local/libevent/lib
INCLUDE = -I /usr/local/libevent/include
CFLAGS = -Wall -O2 -g
CC = gcc
PROGS = magent
..........(以下省略)
vim ketama.h (在文件起始行加下以下代码)
#ifndef SSIZE_MAX
#define SSIZE_MAX 32767
#endif
ln -sv /usr/local/libevent/lib/libevent-2.0.so.5 /usr/lib/
cp magent /usr/bin/magent
查看是否安装成功及使用
命令帮助
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
示例:
magent -u root -n 2048 -l 10.1.1.244 -p 8888 -s 10.1.1.244 -s 10.1.1.245
telnet 10.1.1.244 8888
stats
memcached agent v0.4
matrix 1 -> 10.1.1.244:11211, pool size 0
matrix 2 -> 10.1.1.245:11211, pool size 0
END
quit
"一劳永逸" 的话,有是有的,而 "一劳永逸" 的事却极少