Can I use other memcache java client to talk to membase?
We are using xmemecached(java_memcached-release_2.5.1.jar) to connect to memcached. Can I reuse this client and same code to connect to membase?
Thanks very much MikeW for your reply.
I have switched to spymemcached yesterday. But when I tried to connect to membase server started using shell.bat and pushed a simple string into the server, I got following exception when I tried to get that string back. If I don't call c.get("tets"), no exception happened.
My membase server is installed on windows XP and started using the out-of-box shell.bat. Using the web console, I finished the simple setup successfully, and everything looks fine from the console. But I can't start "membase server service" in service mode. I am not sure if this would cause any harm.
Appreciate any helps/suggestions!
======================
c=new MemcachedClient( new BinaryConnectionFactory(), AddrUtil.getAddresses("localhost:11211"));
c.set("test", 1000, "test_value");
String r = (String)c.get("test");
=======================
2011-06-02 17:50:00.883 INFO net.spy.memcached.MemcachedConnection: Added {QA sa=/127.0.0.1:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue
2011-06-02 17:50:00.883 INFO net.spy.memcached.MemcachedConnection: Connection state changed for sun.nio.ch.SelectionKeyImpl@1493102 2011-06-02 17:50:01.493 INFO net.spy.memcached.auth.AuthThread: Authenticated to /127.0.0.1:11211
2011-06-02 17:50:02.324 ERROR net.spy.memcached.protocol.binary.StoreOperationImpl: Error: Out of memory
2011-06-02 17:50:02.324 WARN net.spy.memcached.protocol.binary.BinaryMemcachedNodeImpl: Discarding partially completed op: net.spy.memcached.protocol.binary.StoreOperationImpl@169a50b
2011-06-02 17:50:02.324 INFO net.spy.memcached.MemcachedConnection: Reconnection due to exception handling a memcached operation on
{QA sa=/127.0.0.1:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=1}. This may be due to an authentication failure. OperationException: SERVER: Out of memory
at net.spy.memcached.protocol.BaseOperationImpl.handleError(BaseOperationImpl.java:132) at net.spy.memcached.protocol.binary.OperationImpl.finishedPayload(OperationImpl.java:148) at net.spy.memcached.protocol.binary.OperationImpl.readFromBuffer(OperationImpl.java:134) at net.spy.memcached.MemcachedConnection.handleReads(MemcachedConnection.java:392) at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:324) at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:199) at net.spy.memcached.MemcachedClient.run(MemcachedClient.java:1622)
2011-06-02 17:50:02.324 WARN net.spy.memcached.MemcachedConnection: Closing, and reopening {QA sa=/127.0.0.1:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=1}, attempt 0.
2011-06-02 17:50:03.326 WARN net.spy.memcached.protocol.binary.BinaryMemcachedNodeImpl: Operation canceled because authentication or reconnection and authentication has taken more than one second to complete. ------------- ---------------- ---------------
If looks like your server is out of memory so the get operation (and probably the set operation too) failed. You didn't get an exception after the set because you didn't check the whether the set was successful or not. How big is you bucket size and how much data have you loaded into it?
I actually think the "out of memory" error is a bug from the 1.6.5.4 version of Membase. In that version, when Moxi has an issue connecting to a Membase server (usually because of a memcached process crashing) it will always return "out of memory" even though that error is incorrect.
1.7 has resolved this, I would encourage you to download that version and verify: http://www.couchbase.org/products/membase/1-7-beta
It's also worth mentioning that we don't currently support Windows XP and actually have some known issues. Can you try on either Windows 7 or Windows 2008 which we know we can support?
Lastly, it seems that you're maybe still using the older version of spymemcached and I would encourage you to download the latest version that Mike was referring to: http://www.couchbase.org/wiki/display/membase/prerelease+spymemcached+vb...
Perry
You can use any client that speaks memcached protocol to talk to Membase so xmemcached will work just fine. With that said we recommend using Spymemcached for three reasons:
1) The next release of Spymemcached (Spymemcached 2.7 coming out early next week) will have support for vBucket maps. This will allow you to bypass moxi by taking the most direct route to each server in the cluster and therefore Spymemcached offers the lowest latencies for Membase operations. Spymemcached is also aware of topology changes in your cluster so when servers are added or removed Spymemcached will recognize this and re-route sever requests correctly.
2) Membase has extra operations that memcached doesn't. This means that if you use a client other than Spymemcached you most likely won't be able to take advantage of these operations.
3) Spymemcached is maintained and supported by Couchbase so you can expect that Spymemcached will always be up to date with the latest advances in Membase.