That repo for libcassandra works for cassandra 0.7.x due to changes in the
thrift interface we have faced some problems in the past.

May be you can take a look to my fork of libcassandra https://github.com/axs
-mvd/libcassandra that we are using with cassandra 1.1.11.

Besides that, I recommend that you use the cassandra-cli to create
keyspacesand column families because that operations fails if some of
your nodes is
down, so by using cassandra-cli you force, in a way, the supervision of a
human being :D.

good luck!


On Wed, Jul 3, 2013 at 9:12 AM, Shubham Mittal <smsmitta...@gmail.com>wrote:

> Hey,
>
> I found out that the problem is caused by this line :
> c->createKeyspace(ks_def);
>
> because the below code works fine.
>
> #include <string.h>
> #include <sstream>
> #include <iostream>
> #include <stdlib.h>
> #include <set>
> #include <string>
> #include <stdio.h>
> #include <vector>
>
> #include <libcassandra/cassandra_factory.h>
> #include <libcassandra/cassandra.h>
> #include <libcassandra/column_family_definition.h>
> #include <libcassandra/keyspace.h>
> #include <libcassandra/keyspace_definition.h>
>
> using namespace std;
> using namespace libcassandra;
>
> static string host("127.0.0.1");
> static int port= 9160;
>
> int main()
> {
>
>     CassandraFactory cf(host, port);
>     tr1::shared_ptr<Cassandra> c(cf.create());
>
>     KeyspaceDefinition ks_def;
>     ks_def.setName("demo");
>     return 0;
> }
>
>
> On Wed, Jul 3, 2013 at 5:22 PM, Shubham Mittal <smsmitta...@gmail.com>wrote:
>
>> no Jordan, the cassandra version I have is Cassandra 1.1.12
>>
>>
>> On Wed, Jul 3, 2013 at 5:21 PM, Shubham Mittal <smsmitta...@gmail.com>wrote:
>>
>>> This is the gdb output
>>>
>>> [Thread debugging using libthread_db enabled]
>>> terminate called after throwing an instance of
>>> 'org::apache::cassandra::InvalidRequestException'
>>>   what():  Default TException.
>>>
>>> Program received signal SIGABRT, Aborted.
>>> 0x00007ffff70a0b25 in raise () from /lib/libc.so.6
>>>
>>>
>>>
>>>
>>> On Wed, Jul 3, 2013 at 8:38 AM, Jeremiah D Jordan <
>>> jeremiah.jor...@gmail.com> wrote:
>>>
>>>> If you are using 1.2, I would checkout https://github.com/mstump/libcql
>>>>
>>>> -Jeremiah
>>>>
>>>> On Jul 2, 2013, at 5:18 AM, Shubham Mittal <smsmitta...@gmail.com>
>>>> wrote:
>>>>
>>>> I am trying to run below code, but it gives this error. It compiles
>>>> without any errors.  Kindly help me.
>>>> (source of the code :
>>>> http://posulliv.github.io/2011/02/27/libcassandra-sec-indexes/)
>>>>
>>>> terminate called after throwing an instance of
>>>> 'org::apache::cassandra::InvalidRequestException'
>>>>   what():  Default TException.
>>>> Aborted
>>>>
>>>>
>>>> #include <string.h>
>>>> #include <sstream>
>>>> #include <iostream>
>>>> #include <stdlib.h>
>>>> #include <set>
>>>> #include <string>
>>>> #include <stdio.h>
>>>> #include <vector>
>>>>
>>>> #include <libcassandra/cassandra_factory.h>
>>>> #include <libcassandra/cassandra.h>
>>>> #include <libcassandra/column_family_definition.h>
>>>> #include <libcassandra/keyspace.h>
>>>> #include <libcassandra/keyspace_definition.h>
>>>>
>>>> using namespace std;
>>>> using namespace libcassandra;
>>>>
>>>> static string host("127.0.0.1");
>>>> static int port= 9160;
>>>>
>>>> int main()
>>>> {
>>>>
>>>>     CassandraFactory cf(host, port);
>>>>     tr1::shared_ptr<Cassandra> c(cf.create());
>>>>
>>>>     KeyspaceDefinition ks_def;
>>>>     ks_def.setName("demo");
>>>>     c->createKeyspace(ks_def);
>>>>
>>>>     ColumnFamilyDefinition cf_def;
>>>>     cf_def.setName("users");
>>>>     cf_def.setKeyspaceName(ks_def.getName());
>>>>
>>>>     ColumnDefinition name_col;
>>>>     name_col.setName("full_name");
>>>>     name_col.setValidationClass("UTF8Type");
>>>>
>>>>     ColumnDefinition sec_col;
>>>>     sec_col.setName("birth_date");
>>>>     sec_col.setValidationClass("LongType");
>>>>     sec_col.setIndexType(org::apache::cassandra::IndexType::KEYS);
>>>>
>>>>     ColumnDefinition third_col;
>>>>     third_col.setName("state");
>>>>     third_col.setValidationClass("UTF8Type");
>>>>     third_col.setIndexType(org::apache::cassandra::IndexType::KEYS);
>>>>
>>>>     cf_def.addColumnMetadata(name_col);
>>>>     cf_def.addColumnMetadata(sec_col);
>>>>     cf_def.addColumnMetadata(third_col);
>>>>
>>>>     c->setKeyspace(ks_def.getName());
>>>>     c->createColumnFamily(cf_def);
>>>>
>>>>     return 0;
>>>> }
>>>>
>>>>
>>>>
>>>
>>
>

Reply via email to