java.net.ConnectException: Connection refused

196 views
Skip to first unread message

Loic

unread,
Jan 22, 2013, 12:16:04 PM1/22/13
to twitter...@googlegroups.com
Hi,
I have a problem with cassie cluster.

I do :
val clusterCassie = new Cluster("host1,host2")
val keyspaceCassie = clusterCassie.mapHostsEvery(10.minutes).keyspace("cassa_teads").connect()

But if one host does'nt respond then i have an error:
com.twitter.finagle.WriteException$$anon$1: java.net.ConnectException: Connection refused

How i can resolve this problem ?
I wish that if one host crash to use an other host.

I replace my code by :
val clusterCassie = new Cluster("host1,host2")
val keyspaceCassie = clusterCassie.mapHostsEvery(10.minutes).keyspace("cassa_teads").fastFail(true).connect()

Can you explain fastFail ?

Thanks

Stu Hood

unread,
Jan 22, 2013, 4:33:17 PM1/22/13
to twitter...@googlegroups.com
fastFail will temporarily remove a cassandra host from the connection pool if it experiences "enough" errors: the failure detection algorithm used (by Finagle) for fastFail is similar to the one used internally in cassandra for gossip.

If you'd like to survive errors on individual hosts, you'll need to enable retries, since they are disabled by default:

...retries(3).fastFail(true)...

Stu Hood

unread,
Jan 22, 2013, 5:30:21 PM1/22/13
to Loïc TALON, twitter...@googlegroups.com

On Tue, Jan 22, 2013 at 2:11 PM, Loïc TALON <lta...@teads.tv> wrote:
Then if I use retries and fastFail as your example I would not have a connected exception ?

You might still see the connected exception periodically, depending on how quickly the failFast's detection of the dead host kicks in. But even if finagle does encounter the exception, the retries will occur on the other hosts in your pool, which will usually cause the exception to be harmless.
Reply all
Reply to author
Forward
0 new messages