2017-02-08 8 views
0

Redis Cloud Memcached에 연결하려고하는데 오류가 발생합니다 (아래). apps.redislabs.com 인터페이스에서 사용자 이름, 비밀번호, 호스트 및 포트가 올바른지 확인했습니다. SASL을 비활성화하고 인증되지 않은 상태로 연결하면 연결할 수 있습니다.Spyemcached에서 Redis Cloud Memcached에 인증하는 방법은 무엇입니까?

어떻게 진단 할 수 있습니까?

(spymemcached 2.11.6를 사용.)

import net.spy.memcached.auth.*; 
import net.spy.memcached.*; 
... 
List<InetSocketAddress> addresses = Collections.singletonList(addr); 
AuthDescriptor ad = new AuthDescriptor(new String[] { "CRAM-MD5", "PLAIN" }, 
     new PlainCallbackHandler(user, password)); 
MemcachedClient mc = new MemcachedClient(new ConnectionFactoryBuilder() 
     .setProtocol(ConnectionFactoryBuilder.Protocol.BINARY) 
     .setAuthDescriptor(ad).build(), 
AddrUtil.getAddresses(host + ":" + port)); 

스택 트레이스 :

net.spy.memcached.MemcachedConnection: Added {QA sa=pub-memcache-14154.us-central1-1-1.gce.garantiadata.com/104.197.191.74:14514, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue 
net.spy.memcached.protocol.binary.BinaryMemcachedNodeImpl: Discarding partially completed op: SASL auth operation 
net.spy.memcached.MemcachedConnection: Reconnecting due to exception on {QA sa=pub-memcache-14154.us-central1-1-1.gce.garantiadata.com/104.197.191.74:14514, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=1} 
java.io.IOException: An existing connection was forcibly closed by the remote host 
    at sun.nio.ch.SocketDispatcher.read0(Native Method) 
    at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43) 
    at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) 
    at sun.nio.ch.IOUtil.read(IOUtil.java:192) 
    at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380) 
    at net.spy.memcached.MemcachedConnection.handleReads(MemcachedConnection.java:820) 
    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) 
net.spy.memcached.MemcachedConnection: Closing, and reopening {QA sa=pub-memcache-14154.us-central1-1-1.gce.garantiadata.com/104.197.191.74:14514, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=1}, attempt 0. 
net.spy.memcached.MemcachedConnection: Could not redistribute to another node, retrying primary node for foo. 

답변

3

AuthDescriptior 선언에 "CRAM-MD5"을 잃게됩니다.

내 테스트의 다음 작품 : (사용자가 통과 및 URL 제거)

AuthDescriptor ad = new AuthDescriptor(new String[] {"PLAIN"}, new PlainCallbackHandler(user, pass)); 
MemcachedClient mc = null; 
    try { 
     mc = new MemcachedClient(
     new ConnectionFactoryBuilder() 
      .setProtocol(ConnectionFactoryBuilder.Protocol.BINARY) 
      .setAuthDescriptor(ad).build(), 
     AddrUtil.getAddresses(host + ":" + port)); 
    } catch (IOException e) { 
     // handle exception 
    } 
mc.set("foo", 0, "bar"); 
String value = (String) mc.get("foo"); 
System.out.println(value); 
+0

영업 이익은 연락을해야 레디 스 연구소 '지원 ... 오, 나는 모두가 어쨌든 여기 참조; 않았다 –

+0

) 그것! PLAIN을 사용하면 보안이 저하됩니까? –