Failover support in hector

25 views
Skip to first unread message

apple

unread,
Jun 26, 2010, 5:03:50 AM6/26/10
to hector-users
Hi,

I have just started using hector, and was going through
ExampleClient.java
http://github.com/rantav/hector/blob/master/src/main/java/me/prettyprint/cassandra/service/ExampleClient.java

I have a 2 node cluster with RF=2
inserts and reads are working fine with both the nodes up
but when I put one node down, it says -

Exception in thread "main"
org.apache.thrift.transport.TTransportException: Cannot write to null
outputStream
at
org.apache.thrift.transport.TIOStreamTransport.write(TIOStreamTransport.java:
137)
at
org.apache.thrift.protocol.TBinaryProtocol.writeI32(TBinaryProtocol.java:
152)
at
org.apache.thrift.protocol.TBinaryProtocol.writeMessageBegin(TBinaryProtocol.java:
80)
at org.apache.cassandra.thrift.Cassandra
$Client.send_get(Cassandra.java:324)
at org.apache.cassandra.thrift.Cassandra$Client.get(Cassandra.java:
318)
at me.prettyprint.cassandra.service.KeyspaceImpl
$16.execute(KeyspaceImpl.java:529)
at me.prettyprint.cassandra.service.KeyspaceImpl
$16.execute(KeyspaceImpl.java:523)
at
me.prettyprint.cassandra.service.Operation.executeAndSetResult(FailoverOperator.java:
354)
at
me.prettyprint.cassandra.service.FailoverOperator.operateSingleIteration(FailoverOperator.java:
171)
at
me.prettyprint.cassandra.service.FailoverOperator.operate(FailoverOperator.java:
84)
at
me.prettyprint.cassandra.service.KeyspaceImpl.operateWithFailover(KeyspaceImpl.java:
151)
at
me.prettyprint.cassandra.service.KeyspaceImpl.getColumn(KeyspaceImpl.java:
538)
at ExampleClient.main(ExampleClient.java:38)

Also, when I read with both the nodes up, it shows warnings-
log4j:WARN No appenders could be found for logger
(me.prettyprint.cassandra.service.CassandraClientPoolFactory).
log4j:WARN Please initialize the log4j system properly

Please let me know if I am missing something

Thanks

Ran Tavory

unread,
Jun 26, 2010, 9:41:20 AM6/26/10
to hector...@googlegroups.com
if RF=2 and one of the nodes is down and you're using the default consistency level (quorum) then writes and reads should actually fail b/c the cluster can't reach a quorum of nodes with the data (in your case it's all nodes).

Regarding the logging error - are you initializing log4j in some way? Have any log4j.properties or log4j.xml in your classpath? I haven't seen this error before.

Haifeng Zhang

unread,
Sep 23, 2012, 5:42:49 PM9/23/12
to hector...@googlegroups.com, sna...@gmail.com
Hey,
I encountered the same problem as you. Have you solved this problem?

if there were two nodes, A and B.  once A is down, writes are not working properly, only some of the lines will be 

written into node B, it always say " not enough replicas for the consistency level."

my RF=1 and CL=ANY.

any ideas?  thanks in advance.

Patricio Echagüe

unread,
Sep 23, 2012, 7:30:19 PM9/23/12
to hector...@googlegroups.com, sna...@gmail.com
this is not a problem.

You need RF = 2 and Read/writes = ONE

Nate McCall

unread,
Sep 24, 2012, 11:25:23 AM9/24/12
to hector...@googlegroups.com
By default, the consistency level is QUORUM for read and write.

Where N is the replication factor, the QUORUM of N is calculated by: N / 2 + 1

For small numbers of N, you are effectively operating at consistency level ALL.
Reply all
Reply to author
Forward
0 new messages