You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Ruben de Laat <ru...@logic-labs.nl> on 2010/08/27 17:13:43 UTC

Calls block when using Thrift API

Hi,

I am new to cassandra, so maybe I am missing something obvious...
Version: Latest nightly build (2010-08-23_13-57-40), but same results
with 0.7.0b1

Server code (default configuration file):

System.setProperty("cassandra.config", "conf/cassandra.yaml");
EmbeddedCassandraService embeddedCassandraService = new
EmbeddedCassandraService();
embeddedCassandraService.init();

Client code:

Socket socket = new Socket("127.0.0.1", 9160);
TSocket transport = new TSocket(socket);
TBinaryProtocol tBinaryProtocol = new TBinaryProtocol(transport);
Client client = new Client(tBinaryProtocol);
System.out.println(client.describe_cluster_name());

The problem is that it hangs/blocks on the
"client.describe_cluster_name()" call, actually it hangs on any call I
have tried.
I was first trying with the Pelops client, but that one is using the
Thrift API as well, so this is narrowed down.

I have already tried multiple different combination of creating the
client (different transports).
I have also tried with "thrift_framed_transport_size_in_mb: 0"
disabling framed transports.

Starting the client without a running server gives a proper
"Connection refused", so some sort of connection is definitely made.

Thanks and Kind regards,
Ruben

Re: Calls block when using Thrift API

Posted by Gary Dusbabek <gd...@gmail.com>.
If you're only interested in accessing data natively, I suggest you
try the "fat client."  It brings up a node that participates in
gossip, exposes the StorageProxy API, but does not receive a token and
so does not have storage responsibilities.

StorageService.instance.initClient();

in 0.7 you will want to loop until the node receives its storage
definitions via gossip.

Calling SS.instance.initServer() directly bypasses some of the routine
startup operations.  I don't recommend it unless you really know
what's going on (it might work now, but it's not guaranteed to in the
future).

Gary.


On Sun, Aug 29, 2010 at 10:28, Ruben de Laat <ru...@logic-labs.nl> wrote:
> Just for the people looking to run Cassandra embedded and access
> directly (not via Thrift/Avro).
>
> This works:
>
> StorageService.instance.initServer();
>
> And then just use the StorageProxy for data access.
>
> I have no idea if this is the right way, but is works.
>
> Kind regards,
> Ruben
>
>

Re: Calls block when using Thrift API

Posted by Ruben de Laat <ru...@logic-labs.nl>.
Just for the people looking to run Cassandra embedded and access
directly (not via Thrift/Avro).

This works:

StorageService.instance.initServer();

And then just use the StorageProxy for data access.

I have no idea if this is the right way, but is works.

Kind regards,
Ruben


On Fri, Aug 27, 2010 at 8:18 PM, Ruben de Laat <ru...@logic-labs.nl> wrote:
> Thank you Ran, that's working! Should have tried that as well.
>
> There is a difference in the log's, embedded shows:
> INFO 20:16:31,796 Binding thrift service to localhost/127.0.0.1:9160
>
> Batch-file-started one:
> INFO thrift.CassandraDaemon: Listening for thrift clients...
>
> So maybe different classes are being used for thrift commication based
> on how the server is started.
>
> As soon as I figure that out I'll post it.
>
> On Fri, Aug 27, 2010 at 7:57 PM, Ran Tavory <ra...@gmail.com> wrote:
>> did you try connecting to a real cassandra instance, not an embedded one?
>> I use an embedded one for testing and it works, but just to narrow down your
>> problem.
>>
>> On Fri, Aug 27, 2010 at 6:13 PM, Ruben de Laat <ru...@logic-labs.nl> wrote:
>>>
>>> Hi,
>>>
>>> I am new to cassandra, so maybe I am missing something obvious...
>>> Version: Latest nightly build (2010-08-23_13-57-40), but same results
>>> with 0.7.0b1
>>>
>>> Server code (default configuration file):
>>>
>>> System.setProperty("cassandra.config", "conf/cassandra.yaml");
>>> EmbeddedCassandraService embeddedCassandraService = new
>>> EmbeddedCassandraService();
>>> embeddedCassandraService.init();
>>>
>>> Client code:
>>>
>>> Socket socket = new Socket("127.0.0.1", 9160);
>>> TSocket transport = new TSocket(socket);
>>> TBinaryProtocol tBinaryProtocol = new TBinaryProtocol(transport);
>>> Client client = new Client(tBinaryProtocol);
>>> System.out.println(client.describe_cluster_name());
>>>
>>> The problem is that it hangs/blocks on the
>>> "client.describe_cluster_name()" call, actually it hangs on any call I
>>> have tried.
>>> I was first trying with the Pelops client, but that one is using the
>>> Thrift API as well, so this is narrowed down.
>>>
>>> I have already tried multiple different combination of creating the
>>> client (different transports).
>>> I have also tried with "thrift_framed_transport_size_in_mb: 0"
>>> disabling framed transports.
>>>
>>> Starting the client without a running server gives a proper
>>> "Connection refused", so some sort of connection is definitely made.
>>>
>>> Thanks and Kind regards,
>>> Ruben
>>
>>
>

Re: Calls block when using Thrift API

Posted by Ruben de Laat <ru...@logic-labs.nl>.
Thank you Ran, that's working! Should have tried that as well.

There is a difference in the log's, embedded shows:
INFO 20:16:31,796 Binding thrift service to localhost/127.0.0.1:9160

Batch-file-started one:
INFO thrift.CassandraDaemon: Listening for thrift clients...

So maybe different classes are being used for thrift commication based
on how the server is started.

As soon as I figure that out I'll post it.

On Fri, Aug 27, 2010 at 7:57 PM, Ran Tavory <ra...@gmail.com> wrote:
> did you try connecting to a real cassandra instance, not an embedded one?
> I use an embedded one for testing and it works, but just to narrow down your
> problem.
>
> On Fri, Aug 27, 2010 at 6:13 PM, Ruben de Laat <ru...@logic-labs.nl> wrote:
>>
>> Hi,
>>
>> I am new to cassandra, so maybe I am missing something obvious...
>> Version: Latest nightly build (2010-08-23_13-57-40), but same results
>> with 0.7.0b1
>>
>> Server code (default configuration file):
>>
>> System.setProperty("cassandra.config", "conf/cassandra.yaml");
>> EmbeddedCassandraService embeddedCassandraService = new
>> EmbeddedCassandraService();
>> embeddedCassandraService.init();
>>
>> Client code:
>>
>> Socket socket = new Socket("127.0.0.1", 9160);
>> TSocket transport = new TSocket(socket);
>> TBinaryProtocol tBinaryProtocol = new TBinaryProtocol(transport);
>> Client client = new Client(tBinaryProtocol);
>> System.out.println(client.describe_cluster_name());
>>
>> The problem is that it hangs/blocks on the
>> "client.describe_cluster_name()" call, actually it hangs on any call I
>> have tried.
>> I was first trying with the Pelops client, but that one is using the
>> Thrift API as well, so this is narrowed down.
>>
>> I have already tried multiple different combination of creating the
>> client (different transports).
>> I have also tried with "thrift_framed_transport_size_in_mb: 0"
>> disabling framed transports.
>>
>> Starting the client without a running server gives a proper
>> "Connection refused", so some sort of connection is definitely made.
>>
>> Thanks and Kind regards,
>> Ruben
>
>

Re: Calls block when using Thrift API

Posted by Ran Tavory <ra...@gmail.com>.
did you try connecting to a real cassandra instance, not an embedded one?
I use an embedded one for testing and it works, but just to narrow down your
problem.

On Fri, Aug 27, 2010 at 6:13 PM, Ruben de Laat <ru...@logic-labs.nl> wrote:

> Hi,
>
> I am new to cassandra, so maybe I am missing something obvious...
> Version: Latest nightly build (2010-08-23_13-57-40), but same results
> with 0.7.0b1
>
> Server code (default configuration file):
>
> System.setProperty("cassandra.config", "conf/cassandra.yaml");
> EmbeddedCassandraService embeddedCassandraService = new
> EmbeddedCassandraService();
> embeddedCassandraService.init();
>
> Client code:
>
> Socket socket = new Socket("127.0.0.1", 9160);
> TSocket transport = new TSocket(socket);
> TBinaryProtocol tBinaryProtocol = new TBinaryProtocol(transport);
> Client client = new Client(tBinaryProtocol);
> System.out.println(client.describe_cluster_name());
>
> The problem is that it hangs/blocks on the
> "client.describe_cluster_name()" call, actually it hangs on any call I
> have tried.
> I was first trying with the Pelops client, but that one is using the
> Thrift API as well, so this is narrowed down.
>
> I have already tried multiple different combination of creating the
> client (different transports).
> I have also tried with "thrift_framed_transport_size_in_mb: 0"
> disabling framed transports.
>
> Starting the client without a running server gives a proper
> "Connection refused", so some sort of connection is definitely made.
>
> Thanks and Kind regards,
> Ruben
>