你的位置:首页 > 操作系统

[操作系统]centos7 memcached+memagent 集群

1. 安装libevent

1 wget https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz2 tar -zxvf libevent-2.0.22-stable.tar.gz3 cd libevent-2.0.22-stable4 mkdir /usr/local/libevent5 ./configure --prefix=/usr/local/libevent6 make && make install

2. 安装memcached

1 wget http://memcached.org/files/memcached-1.4.31.tar.gz2 tar -zxvf memcached-1.4.31.tar.gz3 cd memcached-1.4.314 mkdir /usr/local/memcached5 ./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent6 make && make install

3. 安装memagent

1 mkdir /usr/local/magent2 cd /usr/local/magent3 wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/memagent/magent-0.6.tar.gz4 tar -zxvf magent-0.6.tar.gz && rm -rf magent-0.6.tar.gz5 /sbin/ldconfig6 sed -i "s#LIBS = -levent#LIBS = -levent -lm#g" Makefile

3-1。修改Makefile

1 ifeq ($(ARCH), $(X64))2     M64 = -m643     LIBS = /usr/lib64/libevent.so /usr/lib64/libm.so4 else5     LIBS = -levent -lm -L/usr/local/libevent/lib6 endif

3-2。修改ketama.h

1 #ifndef SSIZE_MAX2 #define SSIZE_MAX   327673 #endif4 #ifndef _KETAMA_H5 #define _KETAMA_H6 ..........

3-3.安装memagent

 1 make 2 ln -i /usr/local/magent/magent /usr/bin/magent 

 

4. 使用memagent

1 #memcached 启动2 memcached -d -m 10240 -u root -c 30720 -p 11211 -P /tmp/memcached.pid3 #magent 启动4 magent -u root -n 102400 -p 12000 -s 192.168.0.1:11211 -s 192.168.0.2:11211