-
Notifications
You must be signed in to change notification settings - Fork 1
Quick Start
Quick Start for memcloud-0.1.0 automan
[root@10.213.42.153 memcloud]#./memcloud-install.shinstall success if you see
memcloud installed ok: /usr/local/bin/memcached
on the bottom lines.
Requirement
before you use it please open and edit some variables according to your environment. the script has been tested on centos 6. please make sure the three packages named ibevent-2.0.19-stable.tar.gz, memcached-1.4.5.tar.gz and repcached-2.3-1.4.5.patch.gz can be downloaded from outside web sites or already placed in the specific local path such as /opt/memcloud/ written in the script by default.
- install path created /opt/memcloud/
- web accessing or the three packages mentioned above found in the install path
by the way, official package memcached-1.4.5.tar.gz is located on http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz, but *.googlecode.com cann't be accessed in some regions.
# ./memcloud.sh
Usage: memcloud.sh [local_ip:]<local_port> <peer_ip:repc_port> example: memcloud.sh 11211 10.213.57.166:11212NOTE
the value of <local_port> MUST be different from <repc_port> because the <repc_port> can listen on <local_ip> or <peer_ip> when failover occurs.
a bad case like this
[root@10.213.42.153 memcloud]# memcloud.sh 11211 10.213.42.154:11211
local addr is 10.213.42.153:11211 and remote addr is 10.213.42.154:11211
/usr/local/bin/memcached -d -p 11211 -m 1024 -x 10.213.42.153 -X 11211 -u root -l 10.213.42.154 -c 256 -P /tmp/memcloud_11211_10.213.42.154_11211.pid -v >> ./memcloud.log 2>&1
[root@10.213.42.153 memcloud]# cat ./memcloud.log
replication: connect (peer=10.213.42.153:11211)
replication: marugoto copying
replication: close
replication: listen
failed to listen on TCP port 11211: Address already in useSuggestion
the value of <local_ip> SHOULD be different from <peer_ip> otherwise replication will take no effects when the host fails down.
a good case
run the command as follows on 10.213.42.153
[root@10.213.42.153 memcloud]# memcloud.sh 11211 10.213.57.166:11212on 10.213.57.166
[root@10.213.57.166 memcloud]# memcloud.sh 11211 10.213.42.153:11212the graph of deployment

for easy communication, let's tag 10.213.42.153 as A, and 10.213.57.166 as B.
- set
hello=worldin A, thenworldgot from B - set
name=memcloudin B, thenmemcloudgot from A
execute the command set hello 0 0 5 in A
➜ ~ telnet 10.213.42.153 11211
Trying 10.213.42.153...
Connected to CDCS-213042153.
Escape character is '^]'.
set hello 0 0 5
world
STORED
gets hello
VALUE hello 0 5 3
world
ENDthen get gets hello from B
➜ ~ telnet 10.213.57.166 11211
Trying 10.213.57.166...
Connected to 10.213.57.166.
Escape character is '^]'.
gets hello
VALUE hello 0 5 3
world
ENDthen set name 0 0 8 in B and gets name in A demonstrated as follows
bi-directional replication

by the way, command syntaxes of memcache protocol
<command name> <key> <flags> <exptime> <bytes>/r/n
<data block>/r/n