You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@accumulo.apache.org by Jeff Kubina <je...@gmail.com> on 2013/04/11 13:15:00 UTC

Is there a method in the accumulo api to get the total bytes used and/or total key/value pairs for each tablet?

Is there a method in the accumulo api to get the total bytes used and/or
total key/value pairs for each tablet? I believe I can get the total bytes
used per tablet using HDFS file size calls on the tables directory, but
what about the total key/value pairs for each tablet?

Re: Is there a method in the accumulo api to get the total bytes used and/or total key/value pairs for each tablet?

Posted by Eric Newton <er...@gmail.com>.
You might want to run a class called "GetMasterStats":

./bin/accumulo org.apache.accumulo.server.test.GetMasterStats

It's a very simple program that prints out the monitor's information that
comes from the master.

-Eric



On Thu, Apr 11, 2013 at 5:44 PM, Jeff Kubina <je...@gmail.com> wrote:

> So how would I get the info from the master, or could you point me to the
> monitor code? Thanks.
>
> --
> Jeff Kubina
> 410-988-4436
>
>
>
> On Thu, Apr 11, 2013 at 11:06 AM, Keith Turner <ke...@deenlo.com> wrote:
>
>> On Thu, Apr 11, 2013 at 7:15 AM, Jeff Kubina <je...@gmail.com>
>> wrote:
>> > Is there a method in the accumulo api to get the total bytes used and/or
>> > total key/value pairs for each tablet? I believe I can get the total
>> bytes
>> > used per tablet using HDFS file size calls on the tables directory, but
>> what
>> > about the total key/value pairs for each tablet?
>> >
>>
>> I sent a note earlier with some tips about getting this info from the
>> metadata table.  This is not how the monitor obtains this information.
>>   The monitor ask the master for the info.  The master periodically
>> ask tablet servers for the info.    Using this method, the monitor
>> obtains information about whats stored in memory, which is not
>> available via the metadata table.   Also, all of the stats information
>> passed from tserver to master is rolled up by table.  So you would not
>> be able to get more granular info through this mechanism.
>>
>
>

Re: Is there a method in the accumulo api to get the total bytes used and/or total key/value pairs for each tablet?

Posted by Jeff Kubina <je...@gmail.com>.
So how would I get the info from the master, or could you point me to the
monitor code? Thanks.

-- 
Jeff Kubina
410-988-4436



On Thu, Apr 11, 2013 at 11:06 AM, Keith Turner <ke...@deenlo.com> wrote:

> On Thu, Apr 11, 2013 at 7:15 AM, Jeff Kubina <je...@gmail.com>
> wrote:
> > Is there a method in the accumulo api to get the total bytes used and/or
> > total key/value pairs for each tablet? I believe I can get the total
> bytes
> > used per tablet using HDFS file size calls on the tables directory, but
> what
> > about the total key/value pairs for each tablet?
> >
>
> I sent a note earlier with some tips about getting this info from the
> metadata table.  This is not how the monitor obtains this information.
>   The monitor ask the master for the info.  The master periodically
> ask tablet servers for the info.    Using this method, the monitor
> obtains information about whats stored in memory, which is not
> available via the metadata table.   Also, all of the stats information
> passed from tserver to master is rolled up by table.  So you would not
> be able to get more granular info through this mechanism.
>

Re: Is there a method in the accumulo api to get the total bytes used and/or total key/value pairs for each tablet?

Posted by Keith Turner <ke...@deenlo.com>.
On Thu, Apr 11, 2013 at 7:15 AM, Jeff Kubina <je...@gmail.com> wrote:
> Is there a method in the accumulo api to get the total bytes used and/or
> total key/value pairs for each tablet? I believe I can get the total bytes
> used per tablet using HDFS file size calls on the tables directory, but what
> about the total key/value pairs for each tablet?
>

I sent a note earlier with some tips about getting this info from the
metadata table.  This is not how the monitor obtains this information.
  The monitor ask the master for the info.  The master periodically
ask tablet servers for the info.    Using this method, the monitor
obtains information about whats stored in memory, which is not
available via the metadata table.   Also, all of the stats information
passed from tserver to master is rolled up by table.  So you would not
be able to get more granular info through this mechanism.

Re: Is there a method in the accumulo api to get the total bytes used and/or total key/value pairs for each tablet?

Posted by Keith Turner <ke...@deenlo.com>.
On Thu, Apr 11, 2013 at 7:15 AM, Jeff Kubina <je...@gmail.com> wrote:
> Is there a method in the accumulo api to get the total bytes used and/or
> total key/value pairs for each tablet? I believe I can get the total bytes
> used per tablet using HDFS file size calls on the tables directory, but what
> about the total key/value pairs for each tablet?
>

Jeff,

You can scan the metadata table to get this info.  A few pointers :

 * call Connector.tableOperations().tableIdMap() to convert your table
name to table id
 * do "new org.apache.accumulo.core.data.KeyExtent(Text, Text, Text)"
to create a KeyExtent that represents the tablet you are interested
in.
 * call KeyExtent.toMetaDataRange() to get a range to scan the metadata table
 * add the column
org.apache.accumulo.core.Constants.METADATA_DATAFILE_COLUMN_FAMILY to
the metadata table scanner
 * take the value from this scan and create a
org.apache.accumulo.core.util.MetadataTable.DataFileValue object, that
will have info you need

This file data in the metadata table may be an estimate or not
present.    In the case of a split, the children of the split have
estimated file sizes.  The sum of the childrens info is correct until
one of them compacts.  For bulk imported files, there is no info about
file size or #entries.   After a tablet is compacted, all of this info
will be correct.   You could call Connector.tableOperations.compact()
passing in a range that will compact just the tablet you want stats
about.

Keith