cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roshan Dawrani <roshandawr...@gmail.com>
Subject Re: Embedded Cassandra server startup question
Date Fri, 21 Jan 2011 07:12:35 GMT
Ok, got a Cassandra client from Hector and changed my clean-up to be
truncate() based.

Here is how I did it, if it could be any use to anyone:

=============================================
HConnectionManager connectionManager = cassandraCluster.connectionManager
Collection<ConcurrentHClientPool> activePools =
connectionManager.activePools

ConcurrentHClientPool pool = activePools.iterator().next()
HThriftClient client = pool.borrowClient()

Cassandra.Client c = client.getCassandra()
c.set_keyspace(keyspaceName)

cfsToTrucate.each {cf ->
    c.truncate(cf)
}
=============================================

Thanks to everyone who shared their inputs.

-- 
Roshan
Blog: http://roshandawrani.wordpress.com/
Twitter: @roshandawrani <http://twitter.com/roshandawrani>
Skype: roshandawrani

On Fri, Jan 21, 2011 at 10:35 AM, Roshan Dawrani <roshandawrani@gmail.com>wrote:

> Back to square one on using CliMain/CliClient vs Cassandra/Hector API for
> cleanuup.
>
> It seems CliClient uses Antlr 3.1+ for parsing the statements passed to it,
> but I am using Grails that uses Antlr 2.7.7 (used by groovy code parsing),
> so I can't mix the two for programmatic use.
>
> Someone please tell how I can truncate my column families in my Hector
> based environment? Does it expose a thrift Cassandra.Client somewhere so I
> can make calls that its API does not cover yet?
>
> Thanks.
>
> On Fri, Jan 21, 2011 at 9:12 AM, Roshan Dawrani <roshandawrani@gmail.com>wrote:
>
>> On Fri, Jan 21, 2011 at 8:56 AM, Roshan Dawrani <roshandawrani@gmail.com>wrote:
>>
>>> On Fri, Jan 21, 2011 at 8:52 AM, Maxim Potekhin <potekhin@bnl.gov>wrote:
>>>
>>>>  You can script the actions you need and pipe the file into
>>>> Cassandra-CLI.
>>>> Works for me.
>>>>
>>>
>>>
>> Probably CliMain / CliClient will help me there doing it as per your
>> suggestion.
>>
>> Still would like to confirm if I cannot do it through Hector API at this
>> point of time, when there  is no direct Hector API call for truncate().
>> Anyway I can still reach Cassandra's truncate() call?
>>
>> Thanks.
>>
>
>
>
> --
> Roshan
> Blog: http://roshandawrani.wordpress.com/
> Twitter: @roshandawrani <http://twitter.com/roshandawrani>
> Skype: roshandawrani
>
>

Mime
View raw message