You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Asif Jan <as...@gmail.com> on 2010/09/16 12:48:07 UTC

Getting client only example to work

Hi

I am using 0.7.0-beta1 , and trying to get the contrib/client_only  
example to work.

I am running cassandra on host1, and trying to access it from host2.

When using thirft (via cassandra-cli) and in my application; I am able  
to connect and do all operations as expected.

But I am not able to connect to cassandra when using the code in  
client_only  (or far that matter using contrib/bmt_example). Since my  
test requires to do bulk insertion of about 1.4 TB of data, so I need  
to use a non-thirft interface.

The error that I am getting is follows (the keyspace and the column  
family exist and can be used via Thirft) :

10/09/16 12:35:31 INFO config.DatabaseDescriptor: DiskAccessMode  
'auto' determined to be mmap, indexAccessMode is mmap
10/09/16 12:35:31 INFO service.StorageService: Starting up client gossip
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.testWriting(Ingestor.java:103)
	at gaia.cu7.cassandra.input.Ingestor.main(Ingestor.java:187)

I am using the following code (from client_only example) (also passing  
JVM parameter -Dstorage-config=path_2_cassandra.yaml)



public static void main(String[] args) throws Exception {
	System.setProperty("storage-config","cassandra.yaml");

         testWriting();
}


// from client_only example

  private static void testWriting() throws Exception
	    {
	        StorageService.instance.initClient();
	        // sleep for a bit so that gossip can do its thing.
	        try
	        {
	            Thread.sleep(10000L);
	        }
	        catch (Exception ex)
	        {
	            throw new AssertionError(ex);
	        }

	        // do some writing.
	        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);
	        }
	        System.out.println("Done writing.");
	        StorageService.instance.stopClient();
	    }







Re: Getting client only example to work

Posted by Jonathan Ellis <jb...@gmail.com>.
You can run them both on the same machine, but it's always been the
case that multiple instances of StorageProxy need to be on different
IPs.  So you'll have to override ListenAddress.

On Thu, Sep 16, 2010 at 4:20 PM, Asif Jan <as...@gmail.com> wrote:
> ok, did something about the message service changed in the initClient
> method; essentially now one can not call initClient when a cassandra
> instance is running on the same machine.
>
> thanks
> On Sep 16, 2010, at 3:48 PM, Gary Dusbabek wrote:
>
>> I discovered some problems with the fat client earlier this week when
>> I tried using it.  It needs some fixes to keep up with all the 0.7
>> changes.
>>
>> Gary.
>>
>> On Thu, Sep 16, 2010 at 05:48, Asif Jan <as...@gmail.com> wrote:
>>>
>>> Hi
>>> I am using 0.7.0-beta1 , and trying to get the contrib/client_only
>>> example
>>> to work.
>>> I am running cassandra on host1, and trying to access it from host2.
>>> When using thirft (via cassandra-cli) and in my application; I am able to
>>> connect and do all operations as expected.
>>> But I am not able to connect to cassandra when using the code in
>>> client_only
>>>  (or far that matter using contrib/bmt_example). Since my test requires
>>> to
>>> do bulk insertion of about 1.4 TB of data, so I need to use a non-thirft
>>> interface.
>>> The error that I am getting is follows (the keyspace and the column
>>> family
>>> exist and can be used via Thirft) :
>>> 10/09/16 12:35:31 INFO config.DatabaseDescriptor: DiskAccessMode 'auto'
>>> determined to be mmap, indexAccessMode is mmap
>>> 10/09/16 12:35:31 INFO service.StorageService: Starting up client gossip
>>> 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.testWriting(Ingestor.java:103)
>>> at gaia.cu7.cassandra.input.Ingestor.main(Ingestor.java:187)
>>> I am using the following code (from client_only example) (also passing
>>> JVM
>>> parameter -Dstorage-config=path_2_cassandra.yaml)
>>>
>>>
>>> public static void main(String[] args) throws Exception {
>>> System.setProperty("storage-config","cassandra.yaml");
>>>        testWriting();
>>> }
>>>
>>> // from client_only example
>>>  private static void testWriting() throws Exception
>>>    {
>>>        StorageService.instance.initClient();
>>>        // sleep for a bit so that gossip can do its thing.
>>>        try
>>>        {
>>>            Thread.sleep(10000L);
>>>        }
>>>        catch (Exception ex)
>>>        {
>>>            throw new AssertionError(ex);
>>>        }
>>>        // do some writing.
>>>        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);
>>>        }
>>>        System.out.println("Done writing.");
>>>        StorageService.instance.stopClient();
>>>    }
>>>
>>>
>>>
>>>
>>>
>>>
>
>



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of Riptano, the source for professional Cassandra support
http://riptano.com

Re: Getting client only example to work

Posted by Asif Jan <as...@gmail.com>.
ok, did something about the message service changed in the initClient  
method; essentially now one can not call initClient when a cassandra  
instance is running on the same machine.

thanks
On Sep 16, 2010, at 3:48 PM, Gary Dusbabek wrote:

> I discovered some problems with the fat client earlier this week when
> I tried using it.  It needs some fixes to keep up with all the 0.7
> changes.
>
> Gary.
>
> On Thu, Sep 16, 2010 at 05:48, Asif Jan <as...@gmail.com> wrote:
>>
>> Hi
>> I am using 0.7.0-beta1 , and trying to get the contrib/client_only  
>> example
>> to work.
>> I am running cassandra on host1, and trying to access it from host2.
>> When using thirft (via cassandra-cli) and in my application; I am  
>> able to
>> connect and do all operations as expected.
>> But I am not able to connect to cassandra when using the code in  
>> client_only
>>  (or far that matter using contrib/bmt_example). Since my test  
>> requires to
>> do bulk insertion of about 1.4 TB of data, so I need to use a non- 
>> thirft
>> interface.
>> The error that I am getting is follows (the keyspace and the column  
>> family
>> exist and can be used via Thirft) :
>> 10/09/16 12:35:31 INFO config.DatabaseDescriptor: DiskAccessMode  
>> 'auto'
>> determined to be mmap, indexAccessMode is mmap
>> 10/09/16 12:35:31 INFO service.StorageService: Starting up client  
>> gossip
>> 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.testWriting(Ingestor.java:103)
>> at gaia.cu7.cassandra.input.Ingestor.main(Ingestor.java:187)
>> I am using the following code (from client_only example) (also  
>> passing JVM
>> parameter -Dstorage-config=path_2_cassandra.yaml)
>>
>>
>> public static void main(String[] args) throws Exception {
>> System.setProperty("storage-config","cassandra.yaml");
>>         testWriting();
>> }
>>
>> // from client_only example
>>  private static void testWriting() throws Exception
>>     {
>>         StorageService.instance.initClient();
>>         // sleep for a bit so that gossip can do its thing.
>>         try
>>         {
>>             Thread.sleep(10000L);
>>         }
>>         catch (Exception ex)
>>         {
>>             throw new AssertionError(ex);
>>         }
>>         // do some writing.
>>         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);
>>         }
>>         System.out.println("Done writing.");
>>         StorageService.instance.stopClient();
>>     }
>>
>>
>>
>>
>>
>>


Re: Getting client only example to work

Posted by Gary Dusbabek <gd...@gmail.com>.
I discovered some problems with the fat client earlier this week when
I tried using it.  It needs some fixes to keep up with all the 0.7
changes.

Gary.

On Thu, Sep 16, 2010 at 05:48, Asif Jan <as...@gmail.com> wrote:
>
> Hi
> I am using 0.7.0-beta1 , and trying to get the contrib/client_only example
> to work.
> I am running cassandra on host1, and trying to access it from host2.
> When using thirft (via cassandra-cli) and in my application; I am able to
> connect and do all operations as expected.
> But I am not able to connect to cassandra when using the code in client_only
>  (or far that matter using contrib/bmt_example). Since my test requires to
> do bulk insertion of about 1.4 TB of data, so I need to use a non-thirft
> interface.
> The error that I am getting is follows (the keyspace and the column family
> exist and can be used via Thirft) :
> 10/09/16 12:35:31 INFO config.DatabaseDescriptor: DiskAccessMode 'auto'
> determined to be mmap, indexAccessMode is mmap
> 10/09/16 12:35:31 INFO service.StorageService: Starting up client gossip
> 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.testWriting(Ingestor.java:103)
> at gaia.cu7.cassandra.input.Ingestor.main(Ingestor.java:187)
> I am using the following code (from client_only example) (also passing JVM
> parameter -Dstorage-config=path_2_cassandra.yaml)
>
>
> public static void main(String[] args) throws Exception {
> System.setProperty("storage-config","cassandra.yaml");
>         testWriting();
> }
>
> // from client_only example
>  private static void testWriting() throws Exception
>     {
>         StorageService.instance.initClient();
>         // sleep for a bit so that gossip can do its thing.
>         try
>         {
>             Thread.sleep(10000L);
>         }
>         catch (Exception ex)
>         {
>             throw new AssertionError(ex);
>         }
>         // do some writing.
>         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);
>         }
>         System.out.println("Done writing.");
>         StorageService.instance.stopClient();
>     }
>
>
>
>
>
>