Question

I'm new to use astyanax connecting to cassandra(1.2.8). I downloaded astyanax from [https://github.com/Netflix/astyanax] and cassandra from [http://www.apache.org/dyn/closer.cgi?path=/cassandra/1.2.8/apache-cassandra-1.2.8-bin.tar.gz]. Everything is installed/built based on instruction and keep default settings(like conf/cassandra.yaml). Now I try to run the sample code [https://github.com/Netflix/astyanax/blob/master/astyanax-examples/src/main/java/com/netflix/astyanax/examples/AstCQLClient.java], and a disgusting error keeps bothering me(showed at eclipse):

Caused by: com.netflix.astyanax.connectionpool.exceptions.PoolTimeoutException: PoolTimeoutException: [host=127.0.0.1(127.0.0.1):9160, latency=5021(5021), attempts=1]Timed out waiting for connection

As I enable cassandra debug mode, the below is showed on the terminal:

DEBUG 17:06:48,968 Thrift transport error occurred during processing of message. org.apache.thrift.transport.TTransportException: Cannot read. Remote side has closed. Tried to read 4 bytes, but only got 0 bytes. (This is often indicative of an internal error on the server side. Please check your server logs.) at org.apache.thrift.transport.TTransport.readAll(TTransport.java:86) at org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.java:378) at org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.java:297) at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:204) at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:22) at org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:199) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724)

Just to emphasize, I don't change anything in cassandra.yaml(actually I don't know what they mean); all the libs from astyanax and from cassandra-1.2.8 are all imported to the java project. I guess the problem is due to that connections will shut down when I try to flush through frame transform... I'm a noob to database. I do appreciate to all the helps!

ps. I'm waiting on stackoverflow. If any logs you need to check(please also give me the directory to find it. I'm noob>_<), just say and I'll fetch it. Thanks a lot!!

Was it helpful?

Solution

Even though this is an old question and I'm not sure if my suggestion will help anyone but I faced the same error and here is how I solved it. Hopefully this will help another poor soul.

I was seeing the same error "cannot read remote side has closed" , but I was using csharp, Apache.Cassandra namespace and Thrift.dll.

The following is a working snippet,

    TSocket socket = null;
    TTransport transport = null;

    socket = new TSocket("localhost", 9160);


    transport = new TFramedTransport(socket);
    TProtocol protocol = new TBinaryProtocol(transport);
    CassandraClient cassandraClient = new CassandraClient(protocol);
    cassandraClient.InputProtocol.Transport.Open();

The trick was to use cassandraClient.InputProtocol.Transport.Open(); rather than transport.open()

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top