用于couchbase的SpymeCached java客户端

用于couchbase的SpymeCached java客户端,java,couchbase,spymemcached,Java,Couchbase,Spymemcached,我正在尝试编写一个简单的java客户机,使用SpymeCached库与couchbase交互(根据我的要求,我无法使用couchbase sdk) 我的代码如下所示- AuthDescriptor ad = new AuthDescriptor(new String[] { "PLAIN" }, new PlainCallbackHandler( "****", "****")); MemcachedClient client = new MemcachedCl

我正在尝试编写一个简单的java客户机,使用SpymeCached库与couchbase交互(根据我的要求,我无法使用couchbase sdk)

我的代码如下所示-

AuthDescriptor ad = new AuthDescriptor(new String[] { "PLAIN" },
    new PlainCallbackHandler(
            "****", "****"));

MemcachedClient client = new MemcachedClient(
    new ConnectionFactoryBuilder()
    .setProtocol(ConnectionFactoryBuilder.Protocol.BINARY)
    .setAuthDescriptor(ad)
    .build(),
    AddrUtil.getAddresses(Arrays.asList("127.0.0.1:11211")));

// Store a value (async) for one hour
client.set("someKey", 3600, "someValue");
client.set("otherKey", 3600, 100L);
client.set("1", 3600, 1);
client.set("2", 3600, 2);

// Retrieve a value.
Object myObject = client.get("someKey");
System.out.println(myObject);

Map<String, Object> someKey = client.getBulk("someKey");
for (Map.Entry<String, Object> entry : someKey.entrySet()) {
  System.out.println(entry.getKey());
  System.out.println(entry.getValue());
}

Collection<SocketAddress> servers = client.getAvailableServers();
System.out.println(servers);

client.shutdown();
我还尝试使用telnet和ran stats命令连接到localhost实例,但出现了此错误-
SERVER\u错误未经授权,空bucket


感谢您为解决此问题提供的任何帮助

Couchbase Server 5.0 Beta 2版本出现此问题,当我尝试使用稳定版本Couchbase Server 4.6.0时,它工作正常

    2017-07-24 15:42:58.397 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
    2017-07-24 15:42:58.558 ERROR net.spy.memcached.protocol.binary.SASLAuthOperationImpl:  Error:  Auth failure
    2017-07-24 15:42:58.559 WARN net.spy.memcached.protocol.binary.BinaryMemcachedNodeImpl:  Discarding partially completed op: SASL auth operation
    2017-07-24 15:42:58.560 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: Auth failure
        at net.spy.memcached.protocol.BaseOperationImpl.handleError(BaseOperationImpl.java:192)
        at net.spy.memcached.protocol.binary.OperationImpl.finishedPayload(OperationImpl.java:204)
        at net.spy.memcached.protocol.binary.SASLBaseOperationImpl.finishedPayload(SASLBaseOperationImpl.java:98)
        at net.spy.memcached.protocol.binary.OperationImpl.readPayloadFromBuffer(OperationImpl.java:196)
        at net.spy.memcached.protocol.binary.OperationImpl.readFromBuffer(OperationImpl.java:139)
        at net.spy.memcached.MemcachedConnection.readBufferAndLogMetrics(MemcachedConnection.java:861)
        at net.spy.memcached.MemcachedConnection.handleReads(MemcachedConnection.java:840)
        at net.spy.memcached.MemcachedConnection.handleReadsAndWrites(MemcachedConnection.java:720)
        at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:683)
        at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:436)
        at net.spy.memcached.MemcachedConnection.run(MemcachedConnection.java:1446)
   2017-07-24 15:42:58.561 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.
   2017-07-24 15:42:58.564 WARN net.spy.memcached.MemcachedConnection:  Could not redistribute to another node, retrying primary node for someKey.
   2017-07-24 15:42:58.565 WARN net.spy.memcached.MemcachedConnection:  Could not redistribute to another node, retrying primary node for otherKey.
   2017-07-24 15:42:58.565 WARN net.spy.memcached.MemcachedConnection:  Could not redistribute to another node, retrying primary node for 1.
   2017-07-24 15:42:58.565 WARN net.spy.memcached.MemcachedConnection:  Could not redistribute to another node, retrying primary node for 2.
   2017-07-24 15:42:58.565 WARN net.spy.memcached.MemcachedConnection:  Could not redistribute to another node, retrying primary node for someKey.
   2017-07-24 15:42:58.659 WARN net.spy.memcached.auth.AuthThread:  Authentication failed to /127.0.0.1:11211, Status: {OperationStatus success=false:  cancelled}
   2017-07-24 15:42:58.661 WARN net.spy.memcached.MemcachedConnection:  Could not redistribute to another node, retrying primary node for someKey.
   2017-07-24 15:42:58.661 WARN net.spy.memcached.MemcachedConnection:  Could not redistribute to another node, retrying primary node for otherKey.
   2017-07-24 15:42:58.661 WARN net.spy.memcached.MemcachedConnection:  Could not redistribute to another node, retrying primary node for 1.
   2017-07-24 15:42:58.662 WARN net.spy.memcached.MemcachedConnection:  Could not redistribute to another node, retrying primary node for 2.
   2017-07-24 15:42:58.662 WARN net.spy.memcached.MemcachedConnection:  Could not redistribute to another node, retrying primary node for someKey.