我正在查找一个java示例,其中显示了如何避免其中一个节点出现故障时出现Membase异常。Java中的Membase节点错误处理
我有一个“默认”存储桶的两个节点的小集群。它被复制到两台服务器上。我为压力加载编写了一个小测试应用程序。我使用spymemcache 2.7。当我运行它时 - 两台服务器都很忙。当我关闭一个membase实例时,我的java应用程序崩溃了。
这里是异常日志:
2011-06-15 17:32:33.405 INFO net.spy.memcached.MemcachedConnection: Added {QA sa=/192.168.1.9:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue
2011-06-15 17:32:33.407 INFO net.spy.memcached.MemcachedConnection: Added {QA sa=/192.168.1.10:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue
2011-06-15 17:32:33.412 INFO net.spy.memcached.MemcachedConnection: Connection state changed for [email protected]
2011-06-15 17:32:33.413 INFO net.spy.memcached.MemcachedConnection: Connection state changed for [email protected]
2011-06-15 18:20:21.896 INFO net.spy.memcached.MemcachedConnection: Reconnecting due to exception on {QA sa=/192.168.1.9:11211, #Rops=2, #Wops=0, #iq=0, [email protected]75d4, topWop=null, toWrite=0, interested=1}
java.io.IOException: Connection reset by peer
at sun.nio.ch.FileDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:21)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:237)
at sun.nio.ch.IOUtil.read(IOUtil.java:210)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:236)
at net.spy.memcached.MemcachedConnection.handleReads(MemcachedConnection.java:487)
at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:427)
at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:280)
at net.spy.memcached.MemcachedClient.run(MemcachedClient.java:2063)
2011-06-15 18:20:21.897 WARN net.spy.memcached.MemcachedConnection: Closing, and reopening {QA sa=/192.168.1.9:11211, #Rops=2, #Wops=0, #iq=0, [email protected]75d4, topWop=null, toWrite=0, interested=1}, attempt 0.
2011-06-15 18:20:21.898 WARN net.spy.memcached.protocol.binary.BinaryMemcachedNodeImpl: Discarding partially completed op: [email protected]
2011-06-15 18:20:21.899 WARN net.spy.memcached.protocol.binary.BinaryMemcachedNodeImpl: Discarding partially completed op: [email protected]
Exception in thread "main" java.lang.RuntimeException: Exception waiting for value
at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1146)
at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1163)
我做了节点192.168.1.9往下走,但客户没有了解,而坠毁。
任何想法如何正确处理它?
嗨Bobby,我的问题与memcache无关,它是关于membase的。但是谢谢你分享你的经验。 – Worker 2011-07-29 12:52:09