Memcached repcached同步

Standard
#安装
wget http://downloads.sourceforge.net/project/repcached/repcached/2.2-1.2.8/repcached-2.2-1.2.8.patch.gz
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
 
gzip -cd ../repcached-2.2-1.2.8.patch.gz | patch -p1
./configure --prefix=/usr/local/memcached --enable-replication
make
make install
 
#启动
cd /usr/local/memcached
#默认复制监听端口11212
#Master
./memcached -v -l 127.0.0.1 -p 11211 -uroot
#Slaver
./memcached -v -l 127.0.0.1 -p 11213 -uroot -x 127.0.0.1 -X 11212
 
#验证同步是否成功
#telnet 127.0.0.1 11211
set key1 0 0 3
111
STORED
get key2
VALUE key2 0 3
222
END
 
#telnet 127.0.0.1 11213
get key1
VALUE key1 0 3
111
END
set key2 0 0 3
222
STORED
 
#注:一开始看官方上写Master/Slaver还以为像Mysql一样只有Master才能读写.实际其Slaver上进行的写操作也会被Master同步.

One thought on “Memcached repcached同步

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.