1
我一直在嘗試使用Elasticsearch作爲替代Memcached的替代品。我已經安裝了memcached傳輸,它看起來很好,並且在正確的端口上。但是,如果我嘗試使用java spy.memcahed客戶端庫,我無法緩存東西。Elasticsearch作爲Memcached的替代品
相反,我得到這樣的錯誤:
2014-10-01 08:22:31.579 INFO net.spy.memcached.MemcachedConnection: Added {QA sa=localhost/127.0.0.1:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue
2014-10-01 08:22:31.586 INFO net.spy.memcached.MemcachedConnection: Connection state changed for [email protected]
2014-10-01 08:22:31.679 INFO net.spy.memcached.MemcachedConnection: Reconnecting due to exception on {QA sa=localhost/127.0.0.1:11211, #Rops=2, #Wops=0, #iq=0, topRop=Cmd: 2 Opaque: 2 Key: foo Cas: 0 Exp: 1000 Flags: 0 Data Length: 3, topWop=null, toWrite=0, interested=1}
java.io.IOException: Disconnected unexpected, will reconnect.
一遍又一遍。
在Elasticsearch方面我得到的
[2014-10-01 08:22:31,675][ERROR][memcached.netty ] [Living Hulk] Unsupported opcode [0x2], ignoring and closing connection
這裏的錯誤是我的客戶端配置:
ConnectionFactoryBuilder factory = new ConnectionFactoryBuilder();
factory.setProtocol(ConnectionFactoryBuilder.Protocol.BINARY);
SerializingTranscoder t = new SerializingTranscoder(1000000);
t.setCompressionThreshold(1024);
factory.setTranscoder(t);
factory.setOpTimeout(1000);
factory.setTimeoutExceptionThreshold(1998);
factory.setHashAlg(DefaultHashAlgorithm.KETAMA_HASH);
factory.setLocatorType(ConnectionFactoryBuilder.Locator.CONSISTENT);
factory.setFailureMode(FailureMode.Redistribute);
factory.setUseNagleAlgorithm(false);
哇,只是想說,我從來沒有想過使用ElasticSearch到目前爲止: - } – Ashalynd 2014-10-02 01:44:00