incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Krishna Chaitanya <bnsk1990r...@gmail.com>
Subject Re: Multiple writers writing to a cassandra node...
Date Sun, 01 Dec 2013 14:27:20 GMT
Hi,
        Thanks for the reply Aaron... There is no error stack! Just a
single exception which says, "terminate called after
IllegalRequestException what(): Default TException. When I try to send the
same amount of data from a single node to a single cassandra node, it works
fine. But, when I split this data and send from multiple nodes to a single
node, it results in this exception. I'm trying to run the same
program(stores data) from multiple nodes to write to a single cassandra
node. What all are the possible reasons for this exception? I don't think
its the load, since if I send the same amount of data from a single node,
it works fine. Is this correct?
I am giving below the cassandra related code of my program. This same
program should run on multiple nodes, but its not. I'm feeling I'm doing
something fundamentally wrong since I'm aware that it's possible to store
to a single cassandra node from multiple sources without using any
locks(Locking isn't required right?). Here is the cassandra related code...

  char mycassa_host[20];
  int mycassa_port(9160);
  const char *password("");
  const char *table_name("ovs_netflow_table");
  const char *context("ntopng_data");
  QtCassandra::QCassandra mycassa;
  int j;
  char str[1500];


  //prompt user to enter the ip of the cassandra node...
  qDebug()<< "Please enter the ip of the cassandra host: \n" ;
  fscanf(stdin,"%s", mycassa_host);
             qDebug() << "using host:port:: "<<mycassa_host << "and
port:9160\n" ;

   if(!mycassa.connect(mycassa_host,mycassa_port,password))   //connecting
to the cassandra cluster...
   {
        qDebug()<<"\nSorry couldnt connect to the db\n";
        exit(1);
   }

    qDebug() << "Working on Cassandra Cluster Named" <<
mycassa.clusterName();
    qDebug() << "Working on Cassandra Protocol Version" <<
mycassa.protocolVersion();

    QSharedPointer<QtCassandra::QCassandraContext>
thiscontext(mycassa.context(context));

    try{
           thiscontext->drop();
           mycassa.synchronizeSchemaVersions();

      }
   catch(...){
   //ignore errors...this happens if the context doesn't exist yet...
   }

   thiscontext->setStrategyClass("SimpleStrategy");
   thiscontext->setReplicationFactor(1);

    QSharedPointer<QtCassandra::QCassandraTable>
tableptr(thiscontext->table(table_name));

    tableptr->setColumnType("Standard");
   tableptr->setComment("This is a store for netflows sent by OVS");
   tableptr->setKeyValidationClass("BytesType");
    tableptr->setDefaultValidationClass("BytesType");
    tableptr->setComparatorType("BytesType");
    tableptr->setKeyCacheSavePeriodInSeconds(14400);
    tableptr->setMemtableFlushAfterMins(60);
    tableptr->setGcGraceSeconds(3600); // 1h.
    tableptr->setMinCompactionThreshold(4);
    tableptr->setMaxCompactionThreshold(22);
    tableptr->setReplicateOnWrite(1);

  thiscontext->create();
      mycassa.synchronizeSchemaVersions();

  while(1)
  {
          //code for reading and storing a netflow packet from memory to a
QByteArray bin;

         QtCassandra::QCassandraValue value(bin);
QByteArray rowkey;
rowkey.append((char)(i));
mycassa["ntopng_data"]["ovs_netflow_table"][rowkey]["col"]= value;

}


Note that this same code runs in multiple systems. Could this be a problem?


Thanks...













On Thu, Nov 28, 2013 at 4:25 PM, Aaron Morton <aaron@thelastpickle.com>wrote:

>    I am a newbie to the Cassandra world. I would like to know if its
> possible for two different nodes to write to a single Cassandra node
>
> Yes.
>
>  Currently, I am getting a IllegalRequestException, what (): Default
> TException on the first system,
>
> What is the full error stack ?
>
>
> Occasionally, also hitting "frame size has negative value" thrift
> exception when the traffic is high and packets are getting stored very fast.
>
> On the client or the server ? Can you post the full error stack ?
>
> Currently using Cassandra 2.0.0 with libQtCassandra library.
>
> Please upgrade to 2.0.3.
>
> Cheers
>
> -----------------
> Aaron Morton
> New Zealand
> @aaronmorton
>
> Co-Founder & Principal Consultant
> Apache Cassandra Consulting
> http://www.thelastpickle.com
>
> On 26/11/2013, at 4:42 am, Krishna Chaitanya <bnsk1990rulz@gmail.com>
> wrote:
>
> Hello,
>    I am a newbie to the Cassandra world. I would like to know if its
> possible for two different nodes to write to a single Cassandra node. I
> have a packet collector software which runs in two different systems. I
> would like both of them to write the packets to a single node(same keyspace
> and columnfamily). Currently using Cassandra 2.0.0 with libQtCassandra
> library.
>                              Currently, I am getting a
> IllegalRequestException, what (): Default TException on the first system,
> the moment I try to store from the second system, but the second system
> works fine. When I restart the program on the first system, the second
> system gets the exception and the first one works fine. Occasionally, also
> hitting "frame size has negative value" thrift exception when the traffic
> is high and packets are getting stored very fast.
>   Can someone please point out what I am doing wrong?  Thanks in advance..
>
>
>


-- 
Regards,
BNSK
*.*

Mime
View raw message