You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flume.apache.org by Sri Ramya <ra...@gmail.com> on 2013/02/14 05:35:36 UTC

Unique row key

hi,

How to generate a unique row key for every event in flume- ng??
So that i can store data into cassandra.

Thank you

Re: Unique row key

Posted by Ralph Goers <ra...@dslextreme.com>.
See https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEvent.java and then look at the addGuid method. 

Ralph


On Feb 13, 2013, at 8:35 PM, Sri Ramya wrote:

> hi,
> 
> How to generate a unique row key for every event in flume- ng??
> So that i can store data into cassandra.
> 
> Thank you


Re: Unique row key

Posted by "Bhaskar V. Karambelkar" <bh...@gmail.com>.
Twitter had opensourced snowflake back in 2010
https://github.com/twitter/snowflake
The repo hasn't been updated in a while, but I do see a fork, which
has been fairly actively developed.
https://github.com/dgkim84/snowflake



On Thu, Feb 14, 2013 at 8:45 AM, Ralph Goers <rg...@apache.org> wrote:
> Only on a single machine with a single cpu. Multiple machines could still generate the same value. Multiple threads on the same machine could generate the same value.
>
> The uuid log4j 2 uses accounts for this. The Cassandra FAQ wiki page discusses using a uuid but the project it references is unfortunately not thread safe - at least the last I checked.
>
> Ralph
>
> On Feb 14, 2013, at 5:11 AM, Madhu Gmail <ma...@gmail.com> wrote:
>
>> you can use time stamp along with nano seconds  which would give unique row key.
>>
>> Madhu  Munagala
>> (214)679-2872
>>
>> On Feb 13, 2013, at 10:35 PM, Sri Ramya <ra...@gmail.com> wrote:
>>
>>> hi,
>>>
>>> How to generate a unique row key for every event in flume- ng??
>>> So that i can store data into cassandra.
>>>
>>> Thank you

Re: Unique row key

Posted by Ralph Goers <rg...@apache.org>.
Only on a single machine with a single cpu. Multiple machines could still generate the same value. Multiple threads on the same machine could generate the same value. 

The uuid log4j 2 uses accounts for this. The Cassandra FAQ wiki page discusses using a uuid but the project it references is unfortunately not thread safe - at least the last I checked.

Ralph

On Feb 14, 2013, at 5:11 AM, Madhu Gmail <ma...@gmail.com> wrote:

> you can use time stamp along with nano seconds  which would give unique row key.
> 
> Madhu  Munagala
> (214)679-2872
> 
> On Feb 13, 2013, at 10:35 PM, Sri Ramya <ra...@gmail.com> wrote:
> 
>> hi,
>> 
>> How to generate a unique row key for every event in flume- ng?? 
>> So that i can store data into cassandra.
>> 
>> Thank you

Re: Unique row key

Posted by Ralph Goers <rg...@apache.org>.
Only on a single machine with a single cpu. Multiple machines could still generate the same value. Multiple threads on the same machine could generate the same value. 

The uuid log4j 2 uses accounts for this. The Cassandra FAQ wiki page discusses using a uuid but the project it references is unfortunately not thread safe - at least the last I checked.

Ralph

On Feb 14, 2013, at 5:11 AM, Madhu Gmail <ma...@gmail.com> wrote:

> you can use time stamp along with nano seconds  which would give unique row key.
> 
> Madhu  Munagala
> (214)679-2872
> 
> On Feb 13, 2013, at 10:35 PM, Sri Ramya <ra...@gmail.com> wrote:
> 
>> hi,
>> 
>> How to generate a unique row key for every event in flume- ng?? 
>> So that i can store data into cassandra.
>> 
>> Thank you

Re: Unique row key

Posted by Madhu Gmail <ma...@gmail.com>.
you can use time stamp along with nano seconds  which would give unique row key.

Madhu  Munagala
(214)679-2872

On Feb 13, 2013, at 10:35 PM, Sri Ramya <ra...@gmail.com> wrote:

> hi,
> 
> How to generate a unique row key for every event in flume- ng?? 
> So that i can store data into cassandra.
> 
> Thank you

Re: Unique row key

Posted by Madhu Gmail <ma...@gmail.com>.
you can use time stamp along with nano seconds  which would give unique row key.

Madhu  Munagala
(214)679-2872

On Feb 13, 2013, at 10:35 PM, Sri Ramya <ra...@gmail.com> wrote:

> hi,
> 
> How to generate a unique row key for every event in flume- ng?? 
> So that i can store data into cassandra.
> 
> Thank you