安装repcached,并且测试其双向复制是否成功,抓图安装和测试过程作为作业
内容提交 1.安装libevent-devel包 [root@ractdg3 no
sql]# tar zxvf libevent-1.4.13-stable.tar.gz [root@ractdg3 no
sql]# cd libevent-1.4.13-stable [root@ractdg3 libevent-1.4.13-stable]# ./configure --prefix=/usr/local/libevent [root@ractdg3 libevent-1.4.13-stable]# make && make install (相关输入省略) 2.安装repcached [root@ractdg3 no
sql]# tar zxvf memcached-1.2.8-repcached-2.2.tar.gz [root@ractdg3 no
sql]# cd memcached-1.2.8-repcached-2.2 [root@ractdg3 memcached-1.2.8-repcached-2.2]#./configure --enable-replication --program-transform-name=s/memcached/repcached/ --with-libevent=/usr/local/libevent [root@ractdg3 memcached-1.2.8-repcached-2.2]# make && make install (相关输入省略) 3.启动repcached #启动master节点 [root@ractdg3 memcached-1.2.8-repcached-2.2]# /usr/local/bin/repcached -p 11211 -v -d can't run as root without the -u switch [root@ractdg3 memcached-1.2.8-repcached-2.2]# su - no
sql #使用no
sql 用户启动(非ROOT) [no
sql@ractdg3 ~]$ /usr/local/bin/repcached -p 11211 -v -d replication: listen [no
sql@ractdg3 ~]$ #启动client节点 [no
sql@ractdg3 ~]$ /usr/local/bin/repcached -p 11212 -x localhost -v -d replication: connect (peer=127.0.0.1:11212) replication: accept replication: marugoto copying [no
sql@ractdg3 ~]$ replication: start #验证服务是否启动成功 [no
sql@ractdg3 ~]$ ps aux|grep repcached no
sql 15641 0.0 0.0 2656 948 ? Ss 10:37 0:00 /usr/local/bin/repcached -p 11211 -v -d no
sql 15719 0.0 0.0 2728 692 ? Ss 10:40 0:00 /usr/local/bin/repcached -p 11212 -x localhost -v -d no
sql 15747 0.0 0.0 4268 704 pts/1 S+ 10:41 0:00 grep repcached [no
sql@ractdg3 ~]$ #4验证数据双向复制 4.1在SSH 窗口 1 验证是否已启动: [root@ractdg3 ~]# ps aux|grep rep root 9979 0.0 0.0 4264 692 pts/2 S+ 09:35 0:00 grep rep no
sql 15641 0.0 0.0 2656 948 ? Ss Jan06 0:00 /usr/local/bin/repcached - no
sql 15719 0.0 0.0 2728 692 ? Ss Jan06 0:00 /usr/local/bin/repcached - -v -d [root@ractdg3 ~]# 4.2在SSH 窗口 2 set 数据: telnet localhost 11211 set poamt 32 0 3 100 STORED get poamt VALUE poamt 32 3 100 END 4.3在SSH 窗口 3 get 数据: telnet localhost 11212 get poamt VALUE poamt 32 3 100 END 4.4在SSH 窗口 3 set 数据: set podt 32 0 4 2014 STORED get podt VALUE podt 32 4 2014 4.5在SSH 窗口 2 get 数据: get podt VALUE podt 32 4 2014 END 到此可以看到,11211 节点的数据可以同步到11212 节点, 同时在11212 节点的数据set保存后,在11211也可以进行get.
原文链接:https://www.f2er.com/nosql/204247.html