Heroku Connection

150 views
Skip to first unread message

Joao Salcedo

unread,
Jan 30, 2013, 6:10:44 PM1/30/13
to clojure-...@googlegroups.com
Hi All,

Nice project, amazing stuff indeed, I just have a question how can I use it on Heroku.
When I added the Memcached Add-on it provides the following

MEMCACHIER_PASSWORD:   12345678
MEMCACHIER_SERVERS:    dev1.ec2.memcachier.com:11211
MEMCACHIER_USERNAME:   xxxx

How ever when I try to connect 

(defn -main [& args]
    (let [tmc (c/text-connection (utils/get-env "MEMCACHIER_SERVERS"))
          res          (c/set tmc "a-new-key" 300 "a value")]
     (println "RESPO" @res)
))

I have the following error:

lein run -m conejo.memcached.core
2013-01-31 09:59:48.332 INFO net.spy.memcached.MemcachedConnection:  Added {QA sa=dev1.ec2.memcachier.com/54.242.185.88:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue
2013-01-31 09:59:48.339 WARN net.spy.memcached.MemcachedConnection:  Could not redistribute to another node, retrying primary node for a-new-key.
2013-01-31 09:59:48.604 INFO net.spy.memcached.MemcachedConnection:  Connection state changed for sun.nio.ch.SelectionKeyImpl@25071521
2013-01-31 09:59:48.885 INFO net.spy.memcached.MemcachedConnection:  RESPO nil
Reconnecting due to exception on {QA sa=dev1.ec2.memcachier.com/54.242.185.88:11211, #Rops=1, #Wops=0, #iq=0, topRop=Cmd: set Key: a-new-key Flags: 0 Exp: 300 Data Length: 7, topWop=null, toWrite=0, interested=1}
java.io.IOException: Connection reset by peer
at sun.nio.ch.FileDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:21)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:198)
at sun.nio.ch.IOUtil.read(IOUtil.java:166)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:245)
at net.spy.memcached.MemcachedConnection.handleReads(MemcachedConnection.java:484)
at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:380)
at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:242)
at net.spy.memcached.MemcachedConnection.run(MemcachedConnection.java:833)
2013-01-31 09:59:48.886 WARN net.spy.memcached.MemcachedConnection:  Closing, and reopening {QA sa=dev1.ec2.memcachier.com/54.242.185.88:11211, #Rops=1, #Wops=0, #iq=0, topRop=Cmd: set Key: a-new-key Flags: 0 Exp: 300 Data Length: 7, topWop=null, toWrite=0, interested=1}, attempt 0.
2013-01-31 09:59:48.887 WARN net.spy.memcached.protocol.ascii.AsciiMemcachedNodeImpl:  Discarding partially completed op: Cmd: set Key: a-new-key Flags: 0 Exp: 300 Data Length: 7
2013-01-31 09:59:50.889 INFO net.spy.memcached.MemcachedConnection:  Reconnecting {QA sa=dev1.ec2.memcachier.com/54.242.185.88:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0}
2013-01-31 09:59:51.167 INFO net.spy.memcached.MemcachedConnection:  Connection state changed for sun.nio.ch.SelectionKeyImpl@32d8ca48


cheers,

Joao

Michael Klishin

unread,
Jan 31, 2013, 3:38:48 AM1/31/13
to clojure-...@googlegroups.com

2013/1/31 Joao Salcedo <joao.s...@gmail.com>

How ever when I try to connect 

(defn -main [& args]
    (let [tmc (c/text-connection (utils/get-env "MEMCACHIER_SERVERS"))
          res          (c/set tmc "a-new-key" 300 "a value")]
     (println "RESPO" @res)
))

You are not using credentials in this code.

Passing authentication credentials currently requires direct Java interop and a bit of
knowledge of the SpyMemcached API. Feel free to submit a pull request that
makes that better, I believe it belongs to this function:


I hope to look into this for 1.1.0-beta2.
--
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

Michael Klishin

unread,
Jan 31, 2013, 10:38:12 AM1/31/13
to clojure-...@googlegroups.com
Please give 1.1.0-beta2 a try, it includes authentication support
but I haven't tested it with a live instance on Heroku:



2013/1/31 Michael Klishin <michael....@gmail.com>
Reply all
Reply to author
Forward
0 new messages