I kept getting this annoying message every 30 seconds (dont intend to offend anyone here :))
2012-02-09 13:55:59.322 INFO net.spy.memcached.MemcachedConnection: Reconnecting {QA sa=0.0.0.0/0.0.0.0:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} 2012-02-09 13:55:59.323 INFO net.spy.memcached.MemcachedConnection: Connection state changed for sun.nio.ch.SelectionKeyImpl@15f0688 2012-02-09 13:55:59.323 INFO net.spy.memcached.MemcachedConnection: Reconnecting due to failure to connect to {QA sa=0.0.0.0/0.0.0.0:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} java.net.ConnectException: Connection refused at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:592) at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:313) at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:199) at net.spy.memcached.MemcachedClient.run(MemcachedClient.java:1622) 2012-02-09 13:55:59.324 WARN net.spy.memcached.MemcachedConnection: Closing, and reopening {QA sa=0.0.0.0/0.0.0.0:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0}, attempt 26.
This is what I had running on my setup. All on the localhost
Server
prompt$ /usr/bin/memcached -m 64 -U 11211 -p 11211 -l 127.0.0.1 ps -ef | grep memcached shows username 12029 2961 0 13:32 pts/2 00:00:00 /usr/bin/memcached -m 64 -U 11211 -p 11211 -l 127.0.0.1 sudo netstat -anp | grep 11211 shows prompt$ sudo netstat -anp | grep 11211 tcp 0 0 127.0.0.1:11211 0.0.0.0:* LISTEN 12029/memcached tcp 0 0 127.0.0.1:11211 127.0.0.1:36642 ESTABLISHED 12029/memcached tcp6 0 0 127.0.0.1:36642 127.0.0.1:11211 ESTABLISHED 13941/java udp 0 0 127.0.0.1:11211 0.0.0.0:* 12029/memcached unix 2 [ ACC ] STREAM LISTENING 11211 1821/dbus-daemon @/tmp/dbus-TelpJZAoJl
Client
private MyClass() throws UnknownHostException, IOException { super(new InetSocketAddress("127.0.0.1", 11211)); }
Results
I am able to set/get with no issues at all. My cache populates and work perfectly well. Just that warning/info message on log4j.
To fix this, I loaded the memcaced without “-l 127.0.0.1”
prompt>$ /usr/bin/memcached -m 64 -U 11211 -p 11211
My memcached still works well, without that message.