Magent (memcached的代理)
magent是一款开源的Memcached代理服务器软件,其项目网址为:
http://code.google.com/p/memagent/
1、安装步骤:
a、编译安装libevent:
wget http://monkey.org/~provos/libevent-1.4.9-stable.tar.gz
tar zxvf libevent-1.4.9-stable.tar.gz
cd libevent-1.4.9-stable/
./configure --prefix=/usr
make && make install
cd ../
b、编译安装Memcached:
wget http://danga.com/memcached/dist/memcached-1.2.6.tar.gz
tar zxvf memcached-1.2.6.tar.gz
cd memcached-1.2.6/
./configure --with-libevent=/usr
make && make install
cd ../
c、编译安装magent:
mkdir magent
cd magent/
wget http://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
cp magent /usr/bin/magent
cd ../
Repcached (memcached同步补丁)
下载地址:http://sourceforge.net/projects/repcached/files/repcached/2.2.1-1.2.8/
版本号:memcached 1.2.8 repcached 2.2.1
1、repcached介绍
repcached是日本人开发的实现memcached复制功能,它是一个单 master单 slave的方案,但它的 master/slave都是可读写的,而且可以相互同步,如果 master坏掉, slave侦测到连接断了,它会自动 listen而成为 master;而如果 slave坏掉, master也会侦测到连接断,它就会重新 listen等待新的 slave加入
2、安装
在两台服务器上分别安装memcached服务,另注本文libevent的版本为:libevent-1.4.13,下载地址: http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz (安装省略)
repcached有两种安装方式:
方式一、下载对应的repcached版本
#wget http://downloads.sourceforge.net/repcached/memcached-1.2.8-repcached-2.2.tar.gz
#tar zxf memcached-1.2.8-repcached-2.2.tar.gz
#cd memcached-1.2.8-repcached-2.2
方式二、下载对应patch版本
#wget http://downloads.sourceforge.net/repcached/repcached-2.2-1.2.8.patch.gz
#gzip -cd ../repcached-2.2-1.2.8.patch.gz | patch -p1】
#./configure �Cenable-replication
# make
# make install
3、启动:
启动master
# ./memcached -v -u root -d -l 127.0.0.1 -p 11211 -x 127.0.0.1 -X 11111 (11211:master端口;11111:同步端口)
replication: connect (peer=127.0.0.1:11111)
replication: accept
replication: marugoto copying
replication: start
启动salve
# ./memcached -v -u root -d -l 127.0.0.1 -p 11212 -x 127.0.0.1 -X 11111 (11212:slave端口;11111:同步端口)
replication: connect (peer=127.0.0.1:11111)
replication: marugoto copying
replication: close
replication: listen