Re: Does securing C*'s CQL native interface (running on port 9042) automatically secure its Thrift API interface (running on port 9160)?
It does, yes. Clients will be required to call the thrift login method with a valid set of credentials before performing any other RPC calls. btw, in versions of C* >= 2.2 the Thrift server is not enabled by default (CASSANDRA-9319). On Mon, Oct 31, 2016 at 4:50 PM, Li, Guangxing <guangxing...@pearson.com> wrote: > Hi, > > I secured my C* cluster by having "authenticator: > org.apache.cassandra.auth.PasswordAuthenticator" in cassandra.yaml. I > know it secures the CQL native interface running on port 9042 because my > code uses such interface. Does this also secure the Thrift API interface > running on port 9160? I searched around the web for answers but could not > find any. I supposed I can write a sample application using Thrift API > interface to confirm it, but wondering if I can get a quick answer from you > experts. > > Thanks. > > George. >
Does securing C*'s CQL native interface (running on port 9042) automatically secure its Thrift API interface (running on port 9160)?
Hi, I secured my C* cluster by having "authenticator: org.apache.cassandra.auth.PasswordAuthenticator" in cassandra.yaml. I know it secures the CQL native interface running on port 9042 because my code uses such interface. Does this also secure the Thrift API interface running on port 9160? I searched around the web for answers but could not find any. I supposed I can write a sample application using Thrift API interface to confirm it, but wondering if I can get a quick answer from you experts. Thanks. George.
Announcement: Thrift API deprecation
Thrift has been officially frozen for almost two years and unofficially for longer. Meanwhile, maintaining Thrift support through changes like 8099 has been a substantial investment. Thus, we are officially deprecating Thrift now and removing support in 4.0, i.e. Nov 2016 if tick-tock goes as planned. (I note that some users have been unable to completely migrate away from Thrift because CQL doesn’t quite provide feature parity. The last such outstanding issue is mixing static and dynamic Thrift “columns” in a single table. We have an issue open to address this [1] and should have it committed for 3.4. In the meantime, I thought it best to give people more notice rather than less.) [1] https://issues.apache.org/jira/browse/CASSANDRA-10857 -- Jonathan Ellis Project Chair, Apache Cassandra co-founder, http://www.datastax.com @spyced
Re: Use Cassnadra thrift API with collection type
Yes, I realized the way to use CQL. I checked the way how map data is represented by using cassandra-cli. For each element in the map, it use the key as part of the column name and value as the column value. I just cannot insert this by using thrift API because I already defined a CompositeType column comparator. Is it a way to run a second program to insert map data with a different comparator? Thanks. On Mon, Jun 23, 2014 at 10:21 AM, Sylvain Lebresne sylv...@datastax.com wrote: On Mon, Jun 23, 2014 at 6:19 PM, James Campbell ja...@breachintelligence.com wrote: Huilang, Since there hasn't been another reply yet, I'll throw out an idea that worked for us as part of a test, though it does not seem exactly like a preferred way since it crosses code-bases. We built the type using straight java type, then used the Datastax v2 driver's DataType class serializer. Concretely, it would look like the following (adapting your code): Column column = new Column(); column.name=columnSerializer.toByteBuffer(colname); // the column name of the map type, it works with other kinds of data type column.value = DataType.map(DataType.ascii, DataType.decimal).serialize(yourMapGoesHere); column.timestamp = new Date().getTime(); ... This is exactly equivalent to what Huiliang posted and will thus not work any better. Collections are internally not store as one thrift column per collection. Each element of the collection is a separate thrift column and the exact encoding depends on the collection. The fact is, updating CQL collection from thrift is technically possible but it is not recommended in any way. I strongly advise you to stick to CQL if you want to use CQL collections. -- Sylvain -- *From:* Huiliang Zhang zhl...@gmail.com *Sent:* Friday, June 20, 2014 10:10 PM *To:* user@cassandra.apache.org *Subject:* Use Cassnadra thrift API with collection type Hi, I have a problem when insert data of the map type into a cassandra table. I tried all kinds of MapSerializer to serialize the Map data and did not succeed. My code is like this: Column column = new Column(); column.name=columnSerializer.toByteBuffer(colname); // the column name of the map type, it works with other kinds of data type column.value = MapSerializer.getInstance(AsciiSerializer.instance, DecimalSerializer.instance).serialize(someMapData); column.timestamp = new Date().getTime(); Mutation mutation = new Mutation(); mutation.column_or_supercolumn = new ColumnOrSuperColumn(); mutation.column_or_supercolumn.column = column; mutationList.add(mutation); The data was input into the cassandra DB however it cannot be retrieved by CQL3 with the following error: ERROR 14:32:48,192 Exception in thread Thread[Thrift:4,5,main] java.lang.AssertionError at org.apache.cassandra.cql3.statements.ColumnGroupMap.getCollection(ColumnGroupMap.java:88) at org.apache.cassandra.cql3.statements.SelectStatement.getCollectionValue(SelectStatement.java:1185) at org.apache.cassandra.cql3.statements.SelectStatement.handleGroup(SelectStatement.java:1169) at org.apache.cassandra.cql3.statements.SelectStatement.processColumnFamily(SelectStatement.java:1076) ... So the question is how to write map data into cassandra by thrift API. Appreciated for any help. Thanks, Huiliang
RE: Use Cassnadra thrift API with collection type
Huilang, Since there hasn't been another reply yet, I'll throw out an idea that worked for us as part of a test, though it does not seem exactly like a preferred way since it crosses code-bases. We built the type using straight java type, then used the Datastax v2 driver's DataType class serializer. Concretely, it would look like the following (adapting your code): Column column = new Column(); column.namehttp://column.name=columnSerializer.toByteBuffer(colname); // the column name of the map type, it works with other kinds of data type ?column.value = DataType.map(DataType.ascii, DataType.decimal).serialize(yourMapGoesHere); column.timestamp = new Date().getTime(); ... From: Huiliang Zhang zhl...@gmail.com Sent: Friday, June 20, 2014 10:10 PM To: user@cassandra.apache.org Subject: Use Cassnadra thrift API with collection type Hi, I have a problem when insert data of the map type into a cassandra table. I tried all kinds of MapSerializer to serialize the Map data and did not succeed. My code is like this: Column column = new Column(); column.namehttp://column.name=columnSerializer.toByteBuffer(colname); // the column name of the map type, it works with other kinds of data type column.value = MapSerializer.getInstance(AsciiSerializer.instance, DecimalSerializer.instance).serialize(someMapData); column.timestamp = new Date().getTime(); Mutation mutation = new Mutation(); mutation.column_or_supercolumn = new ColumnOrSuperColumn(); mutation.column_or_supercolumn.column = column; mutationList.add(mutation); The data was input into the cassandra DB however it cannot be retrieved by CQL3 with the following error: ERROR 14:32:48,192 Exception in thread Thread[Thrift:4,5,main] java.lang.AssertionError at org.apache.cassandra.cql3.statements.ColumnGroupMap.getCollection(ColumnGroupMap.java:88) at org.apache.cassandra.cql3.statements.SelectStatement.getCollectionValue(SelectStatement.java:1185) at org.apache.cassandra.cql3.statements.SelectStatement.handleGroup(SelectStatement.java:1169) at org.apache.cassandra.cql3.statements.SelectStatement.processColumnFamily(SelectStatement.java:1076) ... So the question is how to write map data into cassandra by thrift API. Appreciated for any help. Thanks, Huiliang
Re: Use Cassnadra thrift API with collection type
On Mon, Jun 23, 2014 at 6:19 PM, James Campbell ja...@breachintelligence.com wrote: Huilang, Since there hasn't been another reply yet, I'll throw out an idea that worked for us as part of a test, though it does not seem exactly like a preferred way since it crosses code-bases. We built the type using straight java type, then used the Datastax v2 driver's DataType class serializer. Concretely, it would look like the following (adapting your code): Column column = new Column(); column.name=columnSerializer.toByteBuffer(colname); // the column name of the map type, it works with other kinds of data type column.value = DataType.map(DataType.ascii, DataType.decimal).serialize(yourMapGoesHere); column.timestamp = new Date().getTime(); ... This is exactly equivalent to what Huiliang posted and will thus not work any better. Collections are internally not store as one thrift column per collection. Each element of the collection is a separate thrift column and the exact encoding depends on the collection. The fact is, updating CQL collection from thrift is technically possible but it is not recommended in any way. I strongly advise you to stick to CQL if you want to use CQL collections. -- Sylvain -- *From:* Huiliang Zhang zhl...@gmail.com *Sent:* Friday, June 20, 2014 10:10 PM *To:* user@cassandra.apache.org *Subject:* Use Cassnadra thrift API with collection type Hi, I have a problem when insert data of the map type into a cassandra table. I tried all kinds of MapSerializer to serialize the Map data and did not succeed. My code is like this: Column column = new Column(); column.name=columnSerializer.toByteBuffer(colname); // the column name of the map type, it works with other kinds of data type column.value = MapSerializer.getInstance(AsciiSerializer.instance, DecimalSerializer.instance).serialize(someMapData); column.timestamp = new Date().getTime(); Mutation mutation = new Mutation(); mutation.column_or_supercolumn = new ColumnOrSuperColumn(); mutation.column_or_supercolumn.column = column; mutationList.add(mutation); The data was input into the cassandra DB however it cannot be retrieved by CQL3 with the following error: ERROR 14:32:48,192 Exception in thread Thread[Thrift:4,5,main] java.lang.AssertionError at org.apache.cassandra.cql3.statements.ColumnGroupMap.getCollection(ColumnGroupMap.java:88) at org.apache.cassandra.cql3.statements.SelectStatement.getCollectionValue(SelectStatement.java:1185) at org.apache.cassandra.cql3.statements.SelectStatement.handleGroup(SelectStatement.java:1169) at org.apache.cassandra.cql3.statements.SelectStatement.processColumnFamily(SelectStatement.java:1076) ... So the question is how to write map data into cassandra by thrift API. Appreciated for any help. Thanks, Huiliang
Use Cassnadra thrift API with collection type
Hi, I have a problem when insert data of the map type into a cassandra table. I tried all kinds of MapSerializer to serialize the Map data and did not succeed. My code is like this: Column column = new Column(); column.name=columnSerializer.toByteBuffer(colname); // the column name of the map type, it works with other kinds of data type column.value = MapSerializer.getInstance(AsciiSerializer.instance, DecimalSerializer.instance).serialize(someMapData); column.timestamp = new Date().getTime(); Mutation mutation = new Mutation(); mutation.column_or_supercolumn = new ColumnOrSuperColumn(); mutation.column_or_supercolumn.column = column; mutationList.add(mutation); The data was input into the cassandra DB however it cannot be retrieved by CQL3 with the following error: ERROR 14:32:48,192 Exception in thread Thread[Thrift:4,5,main] java.lang.AssertionError at org.apache.cassandra.cql3.statements.ColumnGroupMap.getCollection(ColumnGroupMap.java:88) at org.apache.cassandra.cql3.statements.SelectStatement.getCollectionValue(SelectStatement.java:1185) at org.apache.cassandra.cql3.statements.SelectStatement.handleGroup(SelectStatement.java:1169) at org.apache.cassandra.cql3.statements.SelectStatement.processColumnFamily(SelectStatement.java:1076) ... So the question is how to write map data into cassandra by thrift API. Appreciated for any help. Thanks, Huiliang
Re: Serial Consistency and Thrift API
On Fri, Mar 14, 2014 at 7:59 PM, Panagiotis Garefalakis panga...@gmail.comwrote: Hello all, I am running some tests in my cluster and I wanted to try some of the new features of Cassandra like lightweight transactions and Serial Writes. Surprisingly I found out that Serial writes are not supported by the Thrift API. They *are* supported by thrift. First, let me remark that both lightweight transactions and Serial Writes are 2 names for the same thing. And in thrift it's supported through the cas() method. -- Sylvain Is there any patch available or the only way to support them is though CQL? Thanks in advance, Panagiotis
Re: Serial Consistency and Thrift API
thanks for sharing that info. I haven't needed to use CAS yet and haven't bothered to look at it. I'll have to document that for hector. On Sat, Mar 15, 2014 at 5:45 AM, Sylvain Lebresne sylv...@datastax.comwrote: On Fri, Mar 14, 2014 at 7:59 PM, Panagiotis Garefalakis panga...@gmail.com wrote: Hello all, I am running some tests in my cluster and I wanted to try some of the new features of Cassandra like lightweight transactions and Serial Writes. Surprisingly I found out that Serial writes are not supported by the Thrift API. They *are* supported by thrift. First, let me remark that both lightweight transactions and Serial Writes are 2 names for the same thing. And in thrift it's supported through the cas() method. -- Sylvain Is there any patch available or the only way to support them is though CQL? Thanks in advance, Panagiotis
Re: Serial Consistency and Thrift API
Thanks for all your replies. I was thinking to modify YCSB to support lightweight transactions in order to measure the overhead introduced. Since YCSB extends thrift api this is the only way to do it. I am not quite sure how to use CAS but I am now looking at it. If there is an easier way to measure the performance of my cluster under different kind of operations please let me know. Panagiotis On Sat, Mar 15, 2014 at 2:52 PM, Peter Lin wool...@gmail.com wrote: thanks for sharing that info. I haven't needed to use CAS yet and haven't bothered to look at it. I'll have to document that for hector. On Sat, Mar 15, 2014 at 5:45 AM, Sylvain Lebresne sylv...@datastax.comwrote: On Fri, Mar 14, 2014 at 7:59 PM, Panagiotis Garefalakis panga...@gmail.com wrote: Hello all, I am running some tests in my cluster and I wanted to try some of the new features of Cassandra like lightweight transactions and Serial Writes. Surprisingly I found out that Serial writes are not supported by the Thrift API. They *are* supported by thrift. First, let me remark that both lightweight transactions and Serial Writes are 2 names for the same thing. And in thrift it's supported through the cas() method. -- Sylvain Is there any patch available or the only way to support them is though CQL? Thanks in advance, Panagiotis
Serial Consistency and Thrift API
Hello all, I am running some tests in my cluster and I wanted to try some of the new features of Cassandra like lightweight transactions and Serial Writes. Surprisingly I found out that Serial writes are not supported by the Thrift API. Is there any patch available or the only way to support them is though CQL? Thanks in advance, Panagiotis
Re: Serial Consistency and Thrift API
On Fri, Mar 14, 2014 at 11:59 AM, Panagiotis Garefalakis panga...@gmail.com wrote: I am running some tests in my cluster and I wanted to try some of the new features of Cassandra like lightweight transactions and Serial Writes. Surprisingly I found out that Serial writes are not supported by the Thrift API. Is there any patch available or the only way to support them is though CQL? Briefly, the only way to support them is via CQL. Some people were working on supporting various CQL features via thrift, but with the proposed freeze of such work in 2.1, most of it has likely stopped. =Rob
Re: Serial Consistency and Thrift API
Recently I added CQL3 support to Hector, but I haven't had time to try out serial writes. On Fri, Mar 14, 2014 at 3:34 PM, Robert Coli rc...@eventbrite.com wrote: On Fri, Mar 14, 2014 at 11:59 AM, Panagiotis Garefalakis panga...@gmail.com wrote: I am running some tests in my cluster and I wanted to try some of the new features of Cassandra like lightweight transactions and Serial Writes. Surprisingly I found out that Serial writes are not supported by the Thrift API. Is there any patch available or the only way to support them is though CQL? Briefly, the only way to support them is via CQL. Some people were working on supporting various CQL features via thrift, but with the proposed freeze of such work in 2.1, most of it has likely stopped. =Rob
Re: Cassandra 1.2 Atomic Batches and Thrift API
Yes, it's called atomic_batch_mutate and is used like batch_mutate. If you don't use thrift directly (which would qualify as a very good idea), you'll need to refer to whatever client library you are using to see if 1) support for that new call has been added and 2) how to use it. If you are not sure what is the best way to contact the developers of you client library, then you may try the Cassandra client mailing list: client-...@cassandra.apache.org. -- Sylvain On Tue, Feb 12, 2013 at 4:44 AM, Drew Kutcharian d...@venarc.com wrote: Hey Guys, Is the new atomic batch feature in Cassandra 1.2 available via the thrift API? If so, how can I use it? -- Drew
RE: Cassandra 1.2 Atomic Batches and Thrift API
Is Cassandra 1.1 Row Level Isolation (a kind of batch-like) related to traditional batch_mutate or atomic_batch_mutate Thrift API ? Thanks for the answer. Dominique De : Sylvain Lebresne [mailto:sylv...@datastax.com] Envoyé : mardi 12 février 2013 10:19 À : user@cassandra.apache.org Objet : Re: Cassandra 1.2 Atomic Batches and Thrift API Yes, it's called atomic_batch_mutate and is used like batch_mutate. If you don't use thrift directly (which would qualify as a very good idea), you'll need to refer to whatever client library you are using to see if 1) support for that new call has been added and 2) how to use it. If you are not sure what is the best way to contact the developers of you client library, then you may try the Cassandra client mailing list: client-...@cassandra.apache.orgmailto:client-...@cassandra.apache.org. -- Sylvain On Tue, Feb 12, 2013 at 4:44 AM, Drew Kutcharian d...@venarc.commailto:d...@venarc.com wrote: Hey Guys, Is the new atomic batch feature in Cassandra 1.2 available via the thrift API? If so, how can I use it? -- Drew
Re: Cassandra 1.2 Atomic Batches and Thrift API
Row level isolation is always there. It work for atomic and non atomic batch_mutate. But it's only within the same row (let's recall that even the non atomic batch_mutate *is* atomic within a single row). -- Sylvain On Tue, Feb 12, 2013 at 11:13 AM, DE VITO Dominique dominique.dev...@thalesgroup.com wrote: Is Cassandra 1.1 Row Level Isolation (a kind of batch-like) related to traditional batch_mutate or atomic_batch_mutate Thrift API ? ** ** Thanks for the answer. ** ** Dominique ** ** ** ** *De :* Sylvain Lebresne [mailto:sylv...@datastax.com] *Envoyé :* mardi 12 février 2013 10:19 *À :* user@cassandra.apache.org *Objet :* Re: Cassandra 1.2 Atomic Batches and Thrift API ** ** Yes, it's called atomic_batch_mutate and is used like batch_mutate. If you don't use thrift directly (which would qualify as a very good idea), you'll need to refer to whatever client library you are using to see if 1) support for that new call has been added and 2) how to use it. If you are not sure what is the best way to contact the developers of you client library, then you may try the Cassandra client mailing list: client-...@cassandra.apache.org. ** ** -- Sylvain ** ** On Tue, Feb 12, 2013 at 4:44 AM, Drew Kutcharian d...@venarc.com wrote:* *** Hey Guys, Is the new atomic batch feature in Cassandra 1.2 available via the thrift API? If so, how can I use it? -- Drew ** **
Re: Cassandra 1.2 Atomic Batches and Thrift API
Thanks Sylvain. BTW, what's the status of the java-driver? When will it be GA? On Feb 12, 2013, at 1:19 AM, Sylvain Lebresne sylv...@datastax.com wrote: Yes, it's called atomic_batch_mutate and is used like batch_mutate. If you don't use thrift directly (which would qualify as a very good idea), you'll need to refer to whatever client library you are using to see if 1) support for that new call has been added and 2) how to use it. If you are not sure what is the best way to contact the developers of you client library, then you may try the Cassandra client mailing list: client-...@cassandra.apache.org. -- Sylvain On Tue, Feb 12, 2013 at 4:44 AM, Drew Kutcharian d...@venarc.com wrote: Hey Guys, Is the new atomic batch feature in Cassandra 1.2 available via the thrift API? If so, how can I use it? -- Drew
Cassandra 1.2 Atomic Batches and Thrift API
Hey Guys, Is the new atomic batch feature in Cassandra 1.2 available via the thrift API? If so, how can I use it? -- Drew
Create column family with Composite key column via thrift API
Hi, I know one way is to execute cql query via thrift client to create a column family having compound primary/composite columns. But is it the only way? Looks like i would end up creating own CQLTranslator/Wrapper to deal with compound primary/composite columns!(Or may be something else in near future). Thrift way of dealing with this is really different, as column family metadata for such column families created on cqlsh is quite different for Thrift! I know, have started little late and these are basic things how CQL/composite column works. But is there anything i am missing/misunderstood on this part? -Vivek
Re: Problems using Thrift API in C
I have had similar issues when I generated Cassandra for Erlang. It seems that Thrift 0.6.1 (the latest stable version) does not work with Cassandra. Using Thrift 0.7 does. I had issues where it would give me run time errors when trying to send an insert (it would not serialize correctly). - Original Message - From: Aleksandrs Saveljevs aleksandrs.savelj...@zabbix.com To: user@cassandra.apache.org Sent: Monday, August 1, 2011 7:41:49 AM Subject: Re: Problems using Thrift API in C No, at least not at the default logging level. However, we have solved the problem by checking out the latest revision of Thrift from the official repository, so it seems that it was not Cassandra's problem. On 07/29/2011 10:13 PM, ruslan usifov wrote: Do you have any error messages in cassandra log? 2011/7/28 Aleksandrs Saveljevs aleksandrs.savelj...@zabbix.com mailto:aleksandrs.savelj...@zabbix.com Dear all, We are considering using Cassandra for storing gathered data in Zabbix (see https://support.zabbix.com/__browse/ZBXNEXT-844 https://support.zabbix.com/browse/ZBXNEXT-844 for more details). Because Zabbix is written in C, we are considering using Thrift API in C, too. However, we are running into problems trying to get even the basic code work. Consider the attached source code. This is essentially a rewrite of the first part of the C++ example given at http://wiki.apache.org/__cassandra/ThriftExamples#C.2B-__.2B- http://wiki.apache.org/cassandra/ThriftExamples#C.2B-.2B- . If we run it under strace, we see that it hangs on the call to recv() when setting keyspace: $ strace -s 64 ./test ... socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3 connect(3, {sa_family=AF_INET, sin_port=htons(9160), sin_addr=inet_addr(127.0.0.1__)}, 16) = 0 send(3, \0\0\0/\200\1\0\1\0\0\0\fset___keyspace\0\0\0\0\v\0\1\0\0\0\__vmy_keyspace\0, 47, 0) = 47 recv(3, ^C unfinished ... If we run the C++ example, it passes this step successfully. Does anybody know where the problem is? We are using Thrift 0.6.1 and Cassandra 0.8.1. Also, what is the current state of Thrift API in C? Can it be considered stable? Has anybody used it successfully? Any examples? Thanks, Aleksandrs
Re: Problems using Thrift API in C
- Original Message - From: Konstantin Naryshkin konstant...@a-bb.net To: user@cassandra.apache.org Cc: Sent: Thursday, August 4, 2011 10:36 AM Subject: Re: Problems using Thrift API in C I have had similar issues when I generated Cassandra for Erlang. It seems that Thrift 0.6.1 (the latest stable version) does not work with Cassandra. Using Thrift 0.7 does. I had issues where it would give me run time errors when trying to send an insert (it would not serialize correctly). I have a problem using thrift on C as well. I'm using thrift 0.5 and if I try to add a row to a column family that doesn't exists the exception I get is Default TException very unspecific. Is that an issue of cassandra? Is there probably something wrong with my setup? I was hoping to get an Column family not found message or something in those lines.
Re: Problems using Thrift API in C
Rafael: Try using the latest version of Thrift (0.7) it seems that older versions cannot talk to Cassandra properly. - Original Message - From: Rafael Almeida almeida...@yahoo.com To: user@cassandra.apache.org Sent: Thursday, August 4, 2011 1:53:20 PM Subject: Re: Problems using Thrift API in C - Original Message - From: Konstantin Naryshkin konstant...@a-bb.net To: user@cassandra.apache.org Cc: Sent: Thursday, August 4, 2011 10:36 AM Subject: Re: Problems using Thrift API in C I have had similar issues when I generated Cassandra for Erlang. It seems that Thrift 0.6.1 (the latest stable version) does not work with Cassandra. Using Thrift 0.7 does. I had issues where it would give me run time errors when trying to send an insert (it would not serialize correctly). I have a problem using thrift on C as well. I'm using thrift 0.5 and if I try to add a row to a column family that doesn't exists the exception I get is Default TException very unspecific. Is that an issue of cassandra? Is there probably something wrong with my setup? I was hoping to get an Column family not found message or something in those lines.
Re: Problems using Thrift API in C
Cassandra 0.8 uses Thrift 0.6+ If you are having problems using thrift 0.6 send over the error. Cheers - Aaron Morton Freelance Cassandra Developer @aaronmorton http://www.thelastpickle.com On 5 Aug 2011, at 03:08, Konstantin Naryshkin wrote: Rafael: Try using the latest version of Thrift (0.7) it seems that older versions cannot talk to Cassandra properly. - Original Message - From: Rafael Almeida almeida...@yahoo.com To: user@cassandra.apache.org Sent: Thursday, August 4, 2011 1:53:20 PM Subject: Re: Problems using Thrift API in C - Original Message - From: Konstantin Naryshkin konstant...@a-bb.net To: user@cassandra.apache.org Cc: Sent: Thursday, August 4, 2011 10:36 AM Subject: Re: Problems using Thrift API in C I have had similar issues when I generated Cassandra for Erlang. It seems that Thrift 0.6.1 (the latest stable version) does not work with Cassandra. Using Thrift 0.7 does. I had issues where it would give me run time errors when trying to send an insert (it would not serialize correctly). I have a problem using thrift on C as well. I'm using thrift 0.5 and if I try to add a row to a column family that doesn't exists the exception I get is Default TException very unspecific. Is that an issue of cassandra? Is there probably something wrong with my setup? I was hoping to get an Column family not found message or something in those lines.
Re: Problems using Thrift API in C
No, at least not at the default logging level. However, we have solved the problem by checking out the latest revision of Thrift from the official repository, so it seems that it was not Cassandra's problem. On 07/29/2011 10:13 PM, ruslan usifov wrote: Do you have any error messages in cassandra log? 2011/7/28 Aleksandrs Saveljevs aleksandrs.savelj...@zabbix.com mailto:aleksandrs.savelj...@zabbix.com Dear all, We are considering using Cassandra for storing gathered data in Zabbix (see https://support.zabbix.com/__browse/ZBXNEXT-844 https://support.zabbix.com/browse/ZBXNEXT-844 for more details). Because Zabbix is written in C, we are considering using Thrift API in C, too. However, we are running into problems trying to get even the basic code work. Consider the attached source code. This is essentially a rewrite of the first part of the C++ example given at http://wiki.apache.org/__cassandra/ThriftExamples#C.2B-__.2B- http://wiki.apache.org/cassandra/ThriftExamples#C.2B-.2B- . If we run it under strace, we see that it hangs on the call to recv() when setting keyspace: $ strace -s 64 ./test ... socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3 connect(3, {sa_family=AF_INET, sin_port=htons(9160), sin_addr=inet_addr(127.0.0.1__)}, 16) = 0 send(3, \0\0\0/\200\1\0\1\0\0\0\fset___keyspace\0\0\0\0\v\0\1\0\0\0\__vmy_keyspace\0, 47, 0) = 47 recv(3, ^C unfinished ... If we run the C++ example, it passes this step successfully. Does anybody know where the problem is? We are using Thrift 0.6.1 and Cassandra 0.8.1. Also, what is the current state of Thrift API in C? Can it be considered stable? Has anybody used it successfully? Any examples? Thanks, Aleksandrs
Re: Problems using Thrift API in C
Do you have any error messages in cassandra log? 2011/7/28 Aleksandrs Saveljevs aleksandrs.savelj...@zabbix.com Dear all, We are considering using Cassandra for storing gathered data in Zabbix (see https://support.zabbix.com/**browse/ZBXNEXT-844https://support.zabbix.com/browse/ZBXNEXT-844for more details). Because Zabbix is written in C, we are considering using Thrift API in C, too. However, we are running into problems trying to get even the basic code work. Consider the attached source code. This is essentially a rewrite of the first part of the C++ example given at http://wiki.apache.org/** cassandra/ThriftExamples#C.2B-**.2B-http://wiki.apache.org/cassandra/ThriftExamples#C.2B-.2B-. If we run it under strace, we see that it hangs on the call to recv() when setting keyspace: $ strace -s 64 ./test ... socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3 connect(3, {sa_family=AF_INET, sin_port=htons(9160), sin_addr=inet_addr(127.0.0.1**)}, 16) = 0 send(3, \0\0\0/\200\1\0\1\0\0\0\fset_**keyspace\0\0\0\0\v\0\1\0\0\0\**vmy_keyspace\0, 47, 0) = 47 recv(3, ^C unfinished ... If we run the C++ example, it passes this step successfully. Does anybody know where the problem is? We are using Thrift 0.6.1 and Cassandra 0.8.1. Also, what is the current state of Thrift API in C? Can it be considered stable? Has anybody used it successfully? Any examples? Thanks, Aleksandrs
Re: Problems using Thrift API in C
On 07/28/2011 05:29 AM, Aleksandrs Saveljevs wrote: essentially a rewrite of the first part of the C++ example given at http://wiki.apache.org/cassandra/ThriftExamples#C.2B-.2B- . If we run it under strace, we see that it hangs on the call to recv() when setting keyspace: $ strace -s 64 ./test ... socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3 connect(3, {sa_family=AF_INET, sin_port=htons(9160), sin_addr=inet_addr(127.0.0.1)}, 16) = 0 send(3, \0\0\0/\200\1\0\1\0\0\0\fset_keyspace\0\0\0\0\v\0\1\0\0\0\vmy_keyspace\0, 47, 0) = 47 recv(3, ^C unfinished ... If we run the C++ example, it passes this step successfully. Does anybody know where the problem is? We are using Thrift 0.6.1 and Cassandra 0.8.1. I didn't know that there were C bindings for thrift with cassandra. We just did some extern stuff and got the C++ bindings to work with our C application. -Eric
thrift API
Hi, can anyone explain why APIs include multiget, batch_insert,get_range_slice are removed in Version above 7.0?
Re: 0.8.0 thrift api?
Thanks for the replies, Krik Robert. I should be able to work with that. cheers, Mike On Apr 23, 2011, at 3:37 PM, Robert Jackson wrote: I have been using: https://github.com/apache/cassandra/blob/cassandra-0.8/interface/cassandra.thrift And yes both the CQL and the counter API are accessible via Thrift. Robert Jackson From: Michael Fortin mi...@m410.us To: user@cassandra.apache.org Sent: Saturday, April 23, 2011 2:38:07 PM Subject: 0.8.0 thrift api? Hi, Were can I find the thrift api documentation for 0.8? What's in the wiki is only for =7. I'm especially inserted in the new query and counter api's. That's accessible via thrift, right? Thanks, Mike
Re: 0.8.0 thrift api?
The best documentation (imo) for the Thrift API, is the cassandra.thrift file in the 'interface' subdirectory of the releas. Because cassandra.thrift is used to generate client bindings, it is always up to date, and usually well commented. The wiki lags behind, but sometimes will have more details on a specific topic. cheers, -kirk On Sat, Apr 23, 2011 at 11:38 AM, Michael Fortin mi...@m410.us wrote: Hi, Were can I find the thrift api documentation for 0.8? What's in the wiki is only for =7. I'm especially inserted in the new query and counter api's. That's accessible via thrift, right? Thanks, Mike -- ⑆gmail.com⑆necrobious⑈
Re: Calls block when using Thrift API
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
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 ran...@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
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
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
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 ran...@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