You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by 胡海麟 <h...@bulbit.jp> on 2018/06/15 05:47:44 UTC

Memcached compatible mode

Hello,

https://apacheignite.readme.io/docs/memcached-support

I have run php and ruby codes according to the page above, and perl
and golang ones with library using memcache binary protocol, but only
the php codes work.

Especially, I require a piece of workable ruby codes. My test shows
that it can read, but not write.

<client side>
irb(main):001:0> dc = Dalli::Client.new('10.1.14.221:11211')
=> #<Dalli::Client:0x000000000c3a0eb0 @servers=["10.1.14.221:11211"],
@options={}, @ring=nil>
irb(main):002:0> dc.get('foo')
Dalli::Server#connect 10.1.14.221:11211
=> "bar"
irb(main):003:0> dc.set('foo', 'bar')
10.1.14.221:11211 failed (count: 0) EOFError: end of file reached
#<Dalli::NetworkError: Socket operation failed, retrying...>
retrying request with new server
Dalli::Server#connect 10.1.14.221:11211
10.1.14.221:11211 failed (count: 0) EOFError: end of file reached
#<Dalli::NetworkError: Socket operation failed, retrying...>
(infinite loop)

<server side>
[/opt/apache-ignite-fabric-2.5.0-bin]$ less work/log/ignite-5fc8eef4.0.log
......
[05:34:43,827][WARNING][grid-nio-worker-tcp-rest-1-#37][GridTcpRestProtocol]
Closing NIO session because of unhandled exception [cls=class
o.a.i.IgniteCheckedException, msg=Failed to deserialize object with
given class loader: sun.misc.Launcher$AppClassLoader@764c12b6]
[05:34:43,827][WARNING][grid-nio-worker-tcp-rest-1-#37][GridTcpRestProtocol]
Closed client session due to exception [ses=GridSelectorNioSessionImpl
[worker=ByteBufferNioClientWorker
[readBuf=java.nio.HeapByteBuffer[pos=48 lim=48 cap=8192],
super=AbstractNioClientWorker [idx=1, bytesRcvd=0, bytesSent=0,
bytesRcvd0=0, bytesSent0=0, select=true, super=GridWorker
[name=grid-nio-worker-tcp-rest-1, igniteInstanceName=null,
finished=false, hashCode=1088672156, interrupted=false,
runner=grid-nio-worker-tcp-rest-1-#37]]], writeBuf=null, readBuf=null,
inRecovery=null, outRecovery=null, super=GridNioSessionImpl
[locAddr=/10.1.14.221:11211, rmtAddr=/10.1.100.208:47416,
createTime=1529040883822, closeTime=1529040883822, bytesSent=29,
bytesRcvd=72, bytesSent0=29, bytesRcvd0=72,
sndSchedTime=1529040883822, lastSndTime=1529040883822,
lastRcvTime=1529040883822, readsPaused=false,
filterChain=FilterChain[filters=[GridNioCodecFilter
[parser=GridTcpRestParser [marsh=JdkMarshaller
[clsFilter=o.a.i.i.IgniteKernal$5@f73c22f], routerClient=false],
directMode=false]], accepted=true]], msg=Failed to deserialize object
with given class loader: sun.misc.Launcher$AppClassLoader@764c12b6]
[05:34:43,838][WARNING][grid-nio-worker-tcp-rest-2-#38][GridTcpRestProtocol]
Closing NIO session because of unhandled exception [cls=class
o.a.i.IgniteCheckedException, msg=Failed to deserialize object with
given class loader: sun.misc.Launcher$AppClassLoader@764c12b6]
[05:34:43,839][WARNING][grid-nio-worker-tcp-rest-2-#38][GridTcpRestProtocol]
Closed client session due to exception [ses=GridSelectorNioSessionImpl
[worker=ByteBufferNioClientWorker
[readBuf=java.nio.HeapByteBuffer[pos=48 lim=48 cap=8192],
super=AbstractNioClientWorker [idx=2, bytesRcvd=0, bytesSent=0,
bytesRcvd0=0, bytesSent0=0, select=true, super=GridWorker
[name=grid-nio-worker-tcp-rest-2, igniteInstanceName=null,
finished=false, hashCode=113051394, interrupted=false,
runner=grid-nio-worker-tcp-rest-2-#38]]], writeBuf=null, readBuf=null,
inRecovery=null, outRecovery=null, super=GridNioSessionImpl
[locAddr=/10.1.14.221:11211, rmtAddr=/10.1.100.208:47418,
createTime=1529040883833, closeTime=1529040883833, bytesSent=29,
bytesRcvd=72, bytesSent0=29, bytesRcvd0=72,
sndSchedTime=1529040883833, lastSndTime=1529040883833,
lastRcvTime=1529040883833, readsPaused=false,
filterChain=FilterChain[filters=[GridNioCodecFilter
[parser=GridTcpRestParser [marsh=JdkMarshaller
[clsFilter=o.a.i.i.IgniteKernal$5@f73c22f], routerClient=false],
directMode=false]], accepted=true]], msg=Failed to deserialize object
with given class loader: sun.misc.Launcher$AppClassLoader@764c12b6]

Did I miss something?

Re: Memcached compatible mode

Posted by 胡海麟 <h...@bulbit.jp>.
Wow, I got it.
Thank you very much.

On Fri, Jun 15, 2018 at 11:28 PM, ilya.kasnacheev
<il...@gmail.com> wrote:
> Hello!
>
> It turns out that Dalli will marshal data by default, and set 'serialized'
> flag in memcached message.
> Apache Ignite will treat 'serialized' data as Java Serialized Objects, will
> attempt to deserialize, which will promptly fail.
>
> To avoid this, pass :raw => true option:
>
> irb(main):022:0> dc.set('foo', 'bax', nil, :raw => true)
> => 0
> irb(main):023:0> dc.get('foo')
> => "bax"
>
> Alternatively you can try and use https://github.com/kvs/javaobs as
> :serializer :))
>
> Regards,
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Memcached compatible mode

Posted by "ilya.kasnacheev" <il...@gmail.com>.
Hello!

It turns out that Dalli will marshal data by default, and set 'serialized'
flag in memcached message.
Apache Ignite will treat 'serialized' data as Java Serialized Objects, will
attempt to deserialize, which will promptly fail.

To avoid this, pass :raw => true option:

irb(main):022:0> dc.set('foo', 'bax', nil, :raw => true)
=> 0
irb(main):023:0> dc.get('foo')
=> "bax"

Alternatively you can try and use https://github.com/kvs/javaobs as
:serializer :))

Regards,



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/