You probably need to switch the server to framed thrift mode.

On Thu, Mar 4, 2010 at 2:02 AM, J T <jt4websi...@googlemail.com> wrote:
> Hi,
> I've been trying to piece together some notion of how to use cassandra from
> an erlang client.
> So far I have managed to come up with the following, but it doesn't work.
> Unfortunately there does not seem to be any decent documentation on the
> subject I can find with googling so I'm hoping some more experienced members
> of this mailing list can point out what I'm doing wrong.
> I'm using cassandra 0.5, and I think the latest version of thrift.
> I generated the thrift erlang client code using:
> $ thrift -r --gen erl cassandra.thrift
> And compiled and copied that into my ebin area, along with the rest of the
> thrift erlc library code.
> I start cassandra using its default config bin/cassandra -f and there are no
> apparent errors:
> $ bin/cassandra -f
> Listening for transport dt_socket at address: 8888
> INFO - Sampling index for
> /var/lib/cassandra/data/system/LocationInfo-9-Data.db
> INFO - Replaying /var/lib/cassandra/commitlog/CommitLog-1267655779083.log
> INFO - Log replay complete
> INFO - Saved Token found: 141354730401634313333347303685581151939
> INFO - Starting up server gossip
> INFO - Cassandra starting up...
> then after a few seconds, it displays this:
> Debugger failed to attach: timeout during handshake
> Then from an erl vm I try the following:
> rr(cassandra_types).
> {ok, C} = thrift_client:start_link("localhost",8888, cassandra_thrift).
> thrift_client:call( C,
>                    'insert',
>                    [ "Keyspace1",
>                      "1",
>                      #columnPath{column_family="Standard1", column="email"},
>                      "t...@example.com",
>                      1,
>                      1
>                      ] ).
> Unfortunately, although I get a cassandra_thrift client connection, the call
> to insert fails with :
> =ERROR REPORT==== 4-Mar-2010::07:57:50 ===
> ** Generic server <0.333.0> terminating
> ** Last message in was {call,insert,
>                              ["Keyspace1","1",
>                               {columnPath,"Standard1",undefined,"email"},
>                               "t...@example.com",1,1]}
> ** When Server state == {state,cassandra_thrift,
>                          {protocol,thrift_binary_protocol,
>                           {binary_protocol,
>                            {transport,thrift_buffered_transport,<0.334.0>},
>                            true,true}},
>                          0}
> ** Reason for termination ==
> ** {{case_clause,{error,closed}},
>     [{thrift_client,read_result,3},
>      {thrift_client,catch_function_exceptions,2},
>      {thrift_client,handle_call,3},
>      {gen_server,handle_msg,5},
>      {proc_lib,init_p_do_apply,3}]}
> ** exception exit: {case_clause,{error,closed}}
>      in function  thrift_client:read_result/3
>      in call from thrift_client:catch_function_exceptions/2
>      in call from thrift_client:handle_call/3
>      in call from gen_server:handle_msg/5
>      in call from proc_lib:init_p_do_apply/3
> Cassandra itself reports nothing.
> -- JT.

Reply via email to