incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Asif Jan <asif....@gmail.com>
Subject connect to cassandra using java
Date Tue, 07 Sep 2010 15:20:00 GMT


> Hi
>
> I need to use the low level java API in order to test bulk ingestion  
> to cassandra. I have already looked at the code in contrib/ 
> bmt_example and contrib/client_only.
>
> When I try and run the following code, I get following exception ;  
> using cassandra-cli I am able to see the "Keyspace1' and column  
> family 'Standard1' .
>
> 10/09/07 17:13:30 INFO config.DatabaseDescriptor: DiskAccessMode  
> 'auto' determined to be mmap, indexAccessMode is mmap
> Exception in thread "main" java.lang.IllegalArgumentException:  
> Unknown ColumnFamily Standard1 in keyspace Keyspace1
> 	at  
> org 
> .apache 
> .cassandra 
> .config.DatabaseDescriptor.getComparator(DatabaseDescriptor.java:1009)
> 	at  
> org 
> .apache.cassandra.db.ColumnFamily.getComparatorFor(ColumnFamily.java: 
> 418)
> 	at gaia.cu7.cassandra.input.Ingestor.main(Ingestor.java:93)
>
> How can I ensure that my program is connecting to already running  
> cassandra and not starting one in process. My program (taken from  
> client_only/bmt examples) is follows:
>
>         	System.setProperty("cassandra.config","/user/test/apache- 
> cassandra-0.7.0-beta1/conf/cassandra.yaml");
>                 final AbstractType comp =  
> ColumnFamily.getComparatorFor("Keyspace1", "Standard1", null);
>             for (int i = 0; i < 100; i++)
>             {
>                 RowMutation change = new RowMutation("Keyspace1",  
> ("key" + i).getBytes());
>                 ColumnPath cp = new  
> ColumnPath("Standard1").setColumn(("colb").getBytes());
>                 change.add(new QueryPath(cp), ("value" +  
> i).getBytes(), new TimestampClock(0));
>
>                 // don't call change.apply().  The reason is that is  
> makes a static call into Table, which will perform
>                 // local storage initialization, which creates local  
> directories.
>                 // change.apply();
>
>                 StorageProxy.mutate(Arrays.asList(change));
>                 System.out.println("wrote key" + i);
>             }
>
>
>
> I am using 0.7.0-beta1. Thanks a lot for your reply,
>
> Asif
>
>
>
>
>
>
>
>
>


Mime
View raw message