You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@accumulo.apache.org by Mike Hugo <mi...@piragua.com> on 2013/02/27 05:51:26 UTC

Suggestions on modeling a composite row key

I need to build up a row key that consists of two parts, the first being a
URL (e.g. http://foo.com/dir/page%20name.htm) and the second being a number
(e.g. "12").

To date we've been using \u0000 to delimit these two pieces of the key, but
that has some headaches associated with it.

I'm curious to know how other people have delimited composite row keys.
 Any best practices or suggestions?

Thanks,

Mike

Re: Suggestions on modeling a composite row key

Posted by Mike Hugo <mi...@piragua.com>.
Excellent, thanks everyone for all the suggestions!

Mike


On Wed, Feb 27, 2013 at 9:50 AM, Keith Turner <ke...@deenlo.com> wrote:

> On Wed, Feb 27, 2013 at 3:03 AM, Christopher <ct...@apache.org> wrote:
> > Check out Typo: https://github.com/keith-turner/typo
> > What you're describing is the motivation for that little utility API.
>
> Also, you do not have to use the Typo API.  You could use the
> Lexicoders that you need inorder to encode things so that they sort
> properly lexicographically.
>
>
> https://github.com/keith-turner/typo/blob/master/src/main/java/org/apache/accumulo/typo/encoders/Lexicoder.java
>
> https://github.com/keith-turner/typo/blob/master/src/main/java/org/apache/accumulo/typo/encoders/PairLexicoder.java
>
>
> >
> > Alternatively, if you don't care about the overhead costs or human
> > readability, you could use a modified base64 encoding of your binary
> > key components that preserves the ordering (such as
> > http://iharder.sourceforge.net/current/java/base64/ which I found with
> > Google just now), encode them individually, and join them using a
> > delimiter of your choosing (so long as your delimiter is
> > lexicographically ordered prior to all the bytes in the output bytes
> > of your order-preserving encoding).
> >
> > --
> > Christopher L Tubbs II
> > http://gravatar.com/ctubbsii
> >
> >
> > On Tue, Feb 26, 2013 at 8:51 PM, Mike Hugo <mi...@piragua.com> wrote:
> >> I need to build up a row key that consists of two parts, the first
> being a
> >> URL (e.g. http://foo.com/dir/page%20name.htm) and the second being a
> number
> >> (e.g. "12").
> >>
> >> To date we've been using \u0000 to delimit these two pieces of the key,
> but
> >> that has some headaches associated with it.
> >>
> >> I'm curious to know how other people have delimited composite row keys.
>  Any
> >> best practices or suggestions?
> >>
> >> Thanks,
> >>
> >> Mike
>

Re: Suggestions on modeling a composite row key

Posted by Keith Turner <ke...@deenlo.com>.
On Wed, Feb 27, 2013 at 3:03 AM, Christopher <ct...@apache.org> wrote:
> Check out Typo: https://github.com/keith-turner/typo
> What you're describing is the motivation for that little utility API.

Also, you do not have to use the Typo API.  You could use the
Lexicoders that you need inorder to encode things so that they sort
properly lexicographically.

https://github.com/keith-turner/typo/blob/master/src/main/java/org/apache/accumulo/typo/encoders/Lexicoder.java
https://github.com/keith-turner/typo/blob/master/src/main/java/org/apache/accumulo/typo/encoders/PairLexicoder.java


>
> Alternatively, if you don't care about the overhead costs or human
> readability, you could use a modified base64 encoding of your binary
> key components that preserves the ordering (such as
> http://iharder.sourceforge.net/current/java/base64/ which I found with
> Google just now), encode them individually, and join them using a
> delimiter of your choosing (so long as your delimiter is
> lexicographically ordered prior to all the bytes in the output bytes
> of your order-preserving encoding).
>
> --
> Christopher L Tubbs II
> http://gravatar.com/ctubbsii
>
>
> On Tue, Feb 26, 2013 at 8:51 PM, Mike Hugo <mi...@piragua.com> wrote:
>> I need to build up a row key that consists of two parts, the first being a
>> URL (e.g. http://foo.com/dir/page%20name.htm) and the second being a number
>> (e.g. "12").
>>
>> To date we've been using \u0000 to delimit these two pieces of the key, but
>> that has some headaches associated with it.
>>
>> I'm curious to know how other people have delimited composite row keys.  Any
>> best practices or suggestions?
>>
>> Thanks,
>>
>> Mike

Re: Suggestions on modeling a composite row key

Posted by Jared Winick <ja...@gmail.com>.
And if you weren't already aware, if you do something like Christopher
mentions, or anything that makes your Keys less than human friendly, check
out the Formatter interface
http://accumulo.apache.org/1.4/apidocs/org/apache/accumulo/core/util/format/Formatter.html.
This will let you write a Formatter to turn the keys back into a human
readable format in the shell (type "formatter --help" in the shell for more
info).


On Wed, Feb 27, 2013 at 1:03 AM, Christopher <ct...@apache.org> wrote:

> Check out Typo: https://github.com/keith-turner/typo
> What you're describing is the motivation for that little utility API.
>
> Alternatively, if you don't care about the overhead costs or human
> readability, you could use a modified base64 encoding of your binary
> key components that preserves the ordering (such as
> http://iharder.sourceforge.net/current/java/base64/ which I found with
> Google just now), encode them individually, and join them using a
> delimiter of your choosing (so long as your delimiter is
> lexicographically ordered prior to all the bytes in the output bytes
> of your order-preserving encoding).
>
> --
> Christopher L Tubbs II
> http://gravatar.com/ctubbsii
>
>
> On Tue, Feb 26, 2013 at 8:51 PM, Mike Hugo <mi...@piragua.com> wrote:
> > I need to build up a row key that consists of two parts, the first being
> a
> > URL (e.g. http://foo.com/dir/page%20name.htm) and the second being a
> number
> > (e.g. "12").
> >
> > To date we've been using \u0000 to delimit these two pieces of the key,
> but
> > that has some headaches associated with it.
> >
> > I'm curious to know how other people have delimited composite row keys.
>  Any
> > best practices or suggestions?
> >
> > Thanks,
> >
> > Mike
>

Re: Suggestions on modeling a composite row key

Posted by Christopher <ct...@apache.org>.
Check out Typo: https://github.com/keith-turner/typo
What you're describing is the motivation for that little utility API.

Alternatively, if you don't care about the overhead costs or human
readability, you could use a modified base64 encoding of your binary
key components that preserves the ordering (such as
http://iharder.sourceforge.net/current/java/base64/ which I found with
Google just now), encode them individually, and join them using a
delimiter of your choosing (so long as your delimiter is
lexicographically ordered prior to all the bytes in the output bytes
of your order-preserving encoding).

--
Christopher L Tubbs II
http://gravatar.com/ctubbsii


On Tue, Feb 26, 2013 at 8:51 PM, Mike Hugo <mi...@piragua.com> wrote:
> I need to build up a row key that consists of two parts, the first being a
> URL (e.g. http://foo.com/dir/page%20name.htm) and the second being a number
> (e.g. "12").
>
> To date we've been using \u0000 to delimit these two pieces of the key, but
> that has some headaches associated with it.
>
> I'm curious to know how other people have delimited composite row keys.  Any
> best practices or suggestions?
>
> Thanks,
>
> Mike

RE: TSDB on Accumulo row key

Posted by dl...@comcast.net.
https://github.com/ericnewton/accumulo-opentsdb

 

 

From: Ranjan Sen [mailto:ranjan_sen@hotmail.com] 
Sent: Monday, July 20, 2015 6:25 PM
To: user@accumulo.apache.org
Subject: TSDB on Accumulo row key

 

Hi All, 

Is there something like TSDB (Time series database) on Accumulo?

 

Thanks 
Ranjan


RE: TSDB on Accumulo row key

Posted by Ranjan Sen <ra...@hotmail.com>.
I am running tsdb first time, I set up the configuration but not sure how to configure accumulo in place of hbase. I am getting the following error when I start tsdb








2015-07-22 09:51:49,568 INFO  [main] ZooKeeper: Client environment:user.dir=/opt/opentsdb-2.1.0
2015-07-22 09:51:49,570 INFO  [main] ZooKeeper: Initiating client connection, connectString=172.16.210.132,172.16.210.133,172.16.210.134 sessionTimeout=5000 watcher=org.hbase.async.HBaseClient$ZKClient@d1d6176
2015-07-22 09:51:49,581 INFO  [main] HBaseClient: Need to find the -ROOT- region
2015-07-22 09:51:49,581 INFO  [main-SendThread()] ClientCnxn: Opening socket connection to server /172.16.210.132:2181
2015-07-22 09:51:49,587 INFO  [main-SendThread(SndBgDDBPLNX03.sandlot.local:2181)] ClientCnxn: Socket connection established to SndBgDDBPLNX03.sandlot.local/172.16.210.132:2181, initiating session
2015-07-22 09:51:49,610 INFO  [main-SendThread(SndBgDDBPLNX03.sandlot.local:2181)] ClientCnxn: Session establishment complete on server SndBgDDBPLNX03.sandlot.local/172.16.210.132:2181, sessionid = 0x14d1fe80e0a1522, negotiated timeout = 5000
2015-07-22 09:51:49,621 ERROR [main-EventThread] HBaseClient: The znode for the -ROOT- region doesn't exist!
2015-07-22 09:51:50,644 ERROR [main-EventThread] HBaseClient: The znode for the -ROOT- region doesn't exist!
2015-07-22 09:51:51,664 ERROR [main-EventThread] HBaseClient: The znode for the -ROOT- region doesn't exist!
2015-07-22 09:51:52,684 ERROR [main-EventThread] HBaseClient: The znode for the -ROOT- region doesn't exist!

From: mdrob@apache.org
Date: Mon, 20 Jul 2015 17:27:29 -0500
Subject: Re: TSDB on Accumulo row key
To: user@accumulo.apache.org

Our very own Eric Newton has a port of OpenTSDB running on Accumulo, might be what you're looking for.

https://github.com/ericnewton/accumulo-opentsdb

On Mon, Jul 20, 2015 at 5:25 PM, Ranjan Sen <ra...@hotmail.com> wrote:



Hi All, Is there something like TSDB (Time series database) on Accumulo?
Thanks 
Ranjan 		 	   		  

 		 	   		  

Re: TSDB on Accumulo row key

Posted by Eric Newton <er...@gmail.com>.
This appears to be using the HBase back-end for OpenTSDB, which is the
normal configuration.  In order to minimize the changes to be made to TSDB,
I basically re-wrote the async hbase api to make accumulo calls (which
leads to confusion, I know).

You will need to follow the README instructions at

https://github.com/ericnewton/accumulo-opentsdb

It's probably going to be tricky. Feel free to private message me.  For
one, your connection string has to look like the one at the bottom of the
README, and contain a username and password.

-Eric

On Wed, Jul 22, 2015 at 6:04 PM, Ranjan Sen <ra...@hotmail.com> wrote:

> Thanks.
> I followed the README along the TSDB documentation. I am having difficulty
> configuring the Accumulo user and password, Anyone can provide me with an
> example configuration file for using TSDB with Accumulo?
> Thanks
> Ranjan
>
> ------------------------------
> From: mdrob@apache.org
> Date: Mon, 20 Jul 2015 17:27:29 -0500
> Subject: Re: TSDB on Accumulo row key
> To: user@accumulo.apache.org
>
> Our very own Eric Newton has a port of OpenTSDB running on Accumulo, might
> be what you're looking for.
>
> https://github.com/ericnewton/accumulo-opentsdb
>
> On Mon, Jul 20, 2015 at 5:25 PM, Ranjan Sen <ra...@hotmail.com>
> wrote:
>
> Hi All,
> Is there something like TSDB (Time series database) on Accumulo?
>
> Thanks
> Ranjan
>
>
>

RE: TSDB on Accumulo row key

Posted by Ranjan Sen <ra...@hotmail.com>.
Thanks. I followed the README along the TSDB documentation. I am having difficulty configuring the Accumulo user and password, Anyone can provide me with an example configuration file for using TSDB with Accumulo?Thanks 
Ranjan

From: mdrob@apache.org
Date: Mon, 20 Jul 2015 17:27:29 -0500
Subject: Re: TSDB on Accumulo row key
To: user@accumulo.apache.org

Our very own Eric Newton has a port of OpenTSDB running on Accumulo, might be what you're looking for.

https://github.com/ericnewton/accumulo-opentsdb

On Mon, Jul 20, 2015 at 5:25 PM, Ranjan Sen <ra...@hotmail.com> wrote:



Hi All, Is there something like TSDB (Time series database) on Accumulo?
Thanks 
Ranjan 		 	   		  

 		 	   		  

Re: TSDB on Accumulo row key

Posted by Mike Drob <md...@apache.org>.
Our very own Eric Newton has a port of OpenTSDB running on Accumulo, might
be what you're looking for.

https://github.com/ericnewton/accumulo-opentsdb

On Mon, Jul 20, 2015 at 5:25 PM, Ranjan Sen <ra...@hotmail.com> wrote:

> Hi All,
> Is there something like TSDB (Time series database) on Accumulo?
>
> Thanks
> Ranjan
>

TSDB on Accumulo row key

Posted by Ranjan Sen <ra...@hotmail.com>.
Hi All, Is there something like TSDB (Time series database) on Accumulo?
Thanks 
Ranjan 		 	   		  

Re: Suggestions on modeling a composite row key

Posted by Adam Fuchs <af...@apache.org>.
At sqrrl, we tend to use a Tuple class that implements List<String>
(List<ByteBuffer> would also work), and has conversions to and from
ByteBuffer. To encode the tuple into a byte buffer, change all the "\1"s to
"\1\2", change all the "\0"s to "\1\1", and put a "\0" byte between
elements. "\1" is used as an escape character for all of the "\1"s and
"\0"s appearing in the the unencoded form. To decode, just split on "\0"
and reverse the escaping. This encoding preserves hierarchical,
lexicographical ordering of tuple elements.

Cheers,
Adam



On Tue, Feb 26, 2013 at 11:51 PM, Mike Hugo <mi...@piragua.com> wrote:

> I need to build up a row key that consists of two parts, the first being a
> URL (e.g. http://foo.com/dir/page%20name.htm) and the second being a
> number (e.g. "12").
>
> To date we've been using \u0000 to delimit these two pieces of the key,
> but that has some headaches associated with it.
>
> I'm curious to know how other people have delimited composite row keys.
>  Any best practices or suggestions?
>
> Thanks,
>
> Mike
>