get() set() memcached listening on UDP using Python -
question: how get set, memcached listening on udp only, using python (any of production level python bindings)
what have done/tried far:
making memcached listen on udp - specified options in memcached config:
options="-p 0 -u 11211" # -u udp port , -p tcp port verification:
# netstat -nlp|grep memcached udp 0 0 0.0.0.0:11211 0.0.0.0:* 12095/memcached udp6 0 0 :::11211 :::* 12095/memcached the problem is, didn't verify i.e. performing get , set or put i didn't work.
i have looked python memcache bindings- 2 used ones (reliable, used in production) python-memcached , pylibmc. python-memcached didn't find explicit mention specifying upd or check if memcached listening on tcp or udp. pylibmc, though found mention:
to specify udp, server address should prefixed "udp:", in "udp:127.0.0.1"
to verify pylibmc:
>>> import pylibmc >>> mc_tcp = pylibmc.client(["127.0.0.1"], binary=true, behaviors={"tcp_nodelay": true, "ketama": true}) >>> mc_udp = pylibmc.client(["udp:127.0.0.1"], binary=true, behaviors=none) >>> >>> mc_tcp.set('udp_key', 12) traceback (most recent call last): file "<stdin>", line 1, in <module> _pylibmc.connectionerror: error 3 memcached_set: connection failure >>> >>> mc_udp.set('udp_key', 12) true >>> >>> mc_udp.get('udp_key') traceback (most recent call last): file "<stdin>", line 1, in <module> _pylibmc.notsupportederror: error 28 memcached_get(udp_key): action not supported to verify python-memcached:
>>> import memcache >>> mc = memcache.client([('127.0.0.1', 11211)]) >>> mc.set('key', 12) 0 >>> mc.get('key') >>> a similar question - memcached listeing on udp django
Comments
Post a Comment