I have compiled the memcached-repcached with --enable-replication option, and started it like below:
on the server 1:
# /usr/local/memcached/bin/memcached -v -d -u memcached -l 192.168.7.106 -p 11216 -c 2048 -m 512 -P /usr/local/memcached/var/run/test.pid -x 192.168.3.82 -X 11216
# replication: connect (peer=192.168.3.82:11216)
replication: marugoto copying
replication: close
replication: failed to initialize replication server socket
on the server 2:
# /usr/local/memcached/bin/memcached -v -d -u memcached -l 192.168.3.82 -p 11216 -c 2048 -m 512 -P /usr/local/memcached/var/run/test.pid -x 192.168.7.106 -X 11216
replication: connect (peer=192.168.7.106:11216)
replication: marugoto copying
But it seems that the server 2 only connect to memcached instance on the server 1, it didn't listen on port 11216:
# lsof -i :11216
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
memcached 12786 memcached 6u IPv4 55213579 TCP 192.168.3.82:56176->192.168.7.106:11216 (ESTABLISHED)
therefore I cannot telnet on server 2:
# telnet 192.168.3.82 11216
Trying 192.168.3.82...
telnet: connect to address 192.168.3.82: Connection refused
telnet: Unable to connect to remote host: Connection refused
But if I try to replicate 2 memcached instances on only one server with different port, it works fine:
$ telnet 192.168.7.106 11216
Trying 192.168.7.106...
Connected to 192.168.7.106.
Escape character is '^]'.
set foo 0 0 3
bar
STORED
$ telnet 192.168.7.106 11217
Trying 192.168.7.106...
Connected to 192.168.7.106.
Escape character is '^]'.
marugoto_end
rep foo 0 0 3 1
bar
get foo
VALUE foo 0 3
bar
END
Did I miss something?