Re: Multiple region servers on the same host

2016-08-24 Thread Ted Yu
One downside is that when the machine crashes, you would lose more than one
region server.

You may need to subclass RSGroupBasedLoadBalancer so that balancing
decision fits your requirement.

Cheers

On Tue, Aug 23, 2016 at 4:53 PM, GuangYang  wrote:

> Hello,We are recently exploring running multiple region servers on the
> same host, some of the potential benefits:1. smaller region server
> instance, thus potential less contention for better performance?2. We are
> running region server groups, thus we can run region server groups with
> different workloads on the same group of hardware.
> We plan to go with cgroups to isolate region servers on the same host,
> mainly because we have had good experience using cgroups within other
> hadoop projects.
> Has anyone played around with running multiple RS on the same host and
> would like to share the experience?
> Thanks,Guang


Upgrade path from 1.1.0 to 1.2.2

2016-08-24 Thread ssharavanan
Can we directly upgrade HBase from 1.1.0 to 1.2.2 being from minor version to
another minor patch version, just checking whether it can be done.?

Planning to follow below steps,
1.Install 1.2.2.
2. Gracefully shutdown 1.1.0.
3. Start 1.2.2. version. 

Do you see any harm in doing this?






--
View this message in context: 
http://apache-hbase.679495.n3.nabble.com/Upgrade-path-from-1-1-0-to-1-2-2-tp4082050.html
Sent from the HBase User mailing list archive at Nabble.com.


Re: Upgrade path from 1.1.0 to 1.2.2

2016-08-24 Thread Ted Yu
You should be able to do rolling upgrade. 

Cheers

> On Aug 24, 2016, at 3:32 AM, ssharavanan  wrote:
> 
> Can we directly upgrade HBase from 1.1.0 to 1.2.2 being from minor version to
> another minor patch version, just checking whether it can be done.?
> 
> Planning to follow below steps,
> 1.Install 1.2.2.
> 2. Gracefully shutdown 1.1.0.
> 3. Start 1.2.2. version. 
> 
> Do you see any harm in doing this?
> 
> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://apache-hbase.679495.n3.nabble.com/Upgrade-path-from-1-1-0-to-1-2-2-tp4082050.html
> Sent from the HBase User mailing list archive at Nabble.com.


How to Speed up Prefix scan on column qualifier

2016-08-24 Thread Manjeet Singh
Hi All,

I have below code where I have row key like 9865327845_#RandomChar
I want to perform prefix scan I tryed with ResultScanner  which has
performance impact
I have seen in some articles people saying about Get and setFilter but its
not working
can anyone suggest me better way, below is my code

public static HashSet  getResultByPreFixFilterScan(String rowkeys){
Scan scan = new Scan();
PrefixFilter prefixFilter = new PrefixFilter(rowkeys.getBytes());
scan.setFilter(prefixFilter);
ResultScanner resultScanner = null;
try {
resultScanner = hTable.getScanner(scan);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

HashSet rowKeySet=new HashSet();
//Result result = table.get(g);
for (Result results : resultScanner) {
for(KeyValue kv : results.raw()){
rowKeySet.add(new String(kv.getRow()));

}
}
return rowKeySet;
}





can we perform prefix by
Filter filter = new QualifierFilter(CompareFilter.CompareOp.EQUAL,  new
BinaryComparator(Bytes.toBytes(rowkeys)));

Thanks
Manjeet

-- 
luv all


Re: How to Speed up Prefix scan on column qualifier

2016-08-24 Thread Ted Yu
Please use the following API to set start row before calling
hTable.getScanner(scan):

  public Scan setStartRow(byte [] startRow) {

On Wed, Aug 24, 2016 at 5:08 AM, Manjeet Singh 
wrote:

> Hi All,
>
> I have below code where I have row key like 9865327845_#RandomChar
> I want to perform prefix scan I tryed with ResultScanner  which has
> performance impact
> I have seen in some articles people saying about Get and setFilter but its
> not working
> can anyone suggest me better way, below is my code
>
> public static HashSet  getResultByPreFixFilterScan(String rowkeys){
> Scan scan = new Scan();
> PrefixFilter prefixFilter = new PrefixFilter(rowkeys.getBytes());
> scan.setFilter(prefixFilter);
> ResultScanner resultScanner = null;
> try {
> resultScanner = hTable.getScanner(scan);
> } catch (IOException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
>
> HashSet rowKeySet=new HashSet();
> //Result result = table.get(g);
> for (Result results : resultScanner) {
> for(KeyValue kv : results.raw()){
> rowKeySet.add(new String(kv.getRow()));
>
> }
> }
> return rowKeySet;
> }
>
>
>
>
>
> can we perform prefix by
> Filter filter = new QualifierFilter(CompareFilter.CompareOp.EQUAL,  new
> BinaryComparator(Bytes.toBytes(rowkeys)));
>
> Thanks
> Manjeet
>
> --
> luv all
>


Re: Upgrade path from 1.1.0 to 1.2.2

2016-08-24 Thread ssharavanan
Thank you very much!!!



--
View this message in context: 
http://apache-hbase.679495.n3.nabble.com/Upgrade-path-from-1-1-0-to-1-2-2-tp4082050p4082056.html
Sent from the HBase User mailing list archive at Nabble.com.


Re: How to Speed up Prefix scan on column qualifier

2016-08-24 Thread Vladimir Rodionov
If you are on HBase 1.+ you can use

Scan API:

setRowPrefixFilter(byte[] rowPrefix)


-Vlad

On Wed, Aug 24, 2016 at 5:28 AM, Ted Yu  wrote:

> Please use the following API to set start row before calling
> hTable.getScanner(scan):
>
>   public Scan setStartRow(byte [] startRow) {
>
> On Wed, Aug 24, 2016 at 5:08 AM, Manjeet Singh  >
> wrote:
>
> > Hi All,
> >
> > I have below code where I have row key like 9865327845_#RandomChar
> > I want to perform prefix scan I tryed with ResultScanner  which has
> > performance impact
> > I have seen in some articles people saying about Get and setFilter but
> its
> > not working
> > can anyone suggest me better way, below is my code
> >
> > public static HashSet  getResultByPreFixFilterScan(String rowkeys){
> > Scan scan = new Scan();
> > PrefixFilter prefixFilter = new PrefixFilter(rowkeys.getBytes());
> > scan.setFilter(prefixFilter);
> > ResultScanner resultScanner = null;
> > try {
> > resultScanner = hTable.getScanner(scan);
> > } catch (IOException e) {
> > // TODO Auto-generated catch block
> > e.printStackTrace();
> > }
> >
> > HashSet rowKeySet=new HashSet();
> > //Result result = table.get(g);
> > for (Result results : resultScanner) {
> > for(KeyValue kv : results.raw()){
> > rowKeySet.add(new String(kv.getRow()));
> >
> > }
> > }
> > return rowKeySet;
> > }
> >
> >
> >
> >
> >
> > can we perform prefix by
> > Filter filter = new QualifierFilter(CompareFilter.CompareOp.EQUAL,  new
> > BinaryComparator(Bytes.toBytes(rowkeys)));
> >
> > Thanks
> > Manjeet
> >
> > --
> > luv all
> >
>


Re: Multiple region servers on the same host

2016-08-24 Thread rahul gidwani
We used multiple regionservers on the same host for a long time.  Our use
case was a little different.

We had a table (1 table on a cluster) that was 99% reads (random gets) and
1% writes.  The table was tall and skinny and we needed really low latency
gets.

To keep everything in the block cache and to minimize GC time we had 5
regionservers per machine instead of one RS with a huge heap.

This worked really well for us, deployment was a bit of a pain as a lot of
the start / stop scripts wont work out of the box (or at least didn't at
the time).

Once bucket cache came around we just reverted back to one regionserver per
machine as it was easier to handle operationally.  But other than the
operational pain, it seemed to work fine for us.



On Wed, Aug 24, 2016 at 2:09 AM, Ted Yu  wrote:

> One downside is that when the machine crashes, you would lose more than one
> region server.
>
> You may need to subclass RSGroupBasedLoadBalancer so that balancing
> decision fits your requirement.
>
> Cheers
>
> On Tue, Aug 23, 2016 at 4:53 PM, GuangYang  wrote:
>
> > Hello,We are recently exploring running multiple region servers on the
> > same host, some of the potential benefits:1. smaller region server
> > instance, thus potential less contention for better performance?2. We are
> > running region server groups, thus we can run region server groups with
> > different workloads on the same group of hardware.
> > We plan to go with cgroups to isolate region servers on the same host,
> > mainly because we have had good experience using cgroups within other
> > hadoop projects.
> > Has anyone played around with running multiple RS on the same host and
> > would like to share the experience?
> > Thanks,Guang
>


Re: How to Speed up Prefix scan on column qualifier

2016-08-24 Thread Manjeet Singh
I am using 1.2.1

I have tried these but actually ResultScanner took long time
is their any way to use Get with filter?
HBase already exposed setFilter method on Get class but its not working

On Wed, Aug 24, 2016 at 10:56 PM, Vladimir Rodionov 
wrote:

> If you are on HBase 1.+ you can use
>
> Scan API:
>
> setRowPrefixFilter(byte[] rowPrefix)
>
>
> -Vlad
>
> On Wed, Aug 24, 2016 at 5:28 AM, Ted Yu  wrote:
>
> > Please use the following API to set start row before calling
> > hTable.getScanner(scan):
> >
> >   public Scan setStartRow(byte [] startRow) {
> >
> > On Wed, Aug 24, 2016 at 5:08 AM, Manjeet Singh <
> manjeet.chand...@gmail.com
> > >
> > wrote:
> >
> > > Hi All,
> > >
> > > I have below code where I have row key like 9865327845_#RandomChar
> > > I want to perform prefix scan I tryed with ResultScanner  which has
> > > performance impact
> > > I have seen in some articles people saying about Get and setFilter but
> > its
> > > not working
> > > can anyone suggest me better way, below is my code
> > >
> > > public static HashSet  getResultByPreFixFilterScan(String rowkeys){
> > > Scan scan = new Scan();
> > > PrefixFilter prefixFilter = new PrefixFilter(rowkeys.getBytes());
> > > scan.setFilter(prefixFilter);
> > > ResultScanner resultScanner = null;
> > > try {
> > > resultScanner = hTable.getScanner(scan);
> > > } catch (IOException e) {
> > > // TODO Auto-generated catch block
> > > e.printStackTrace();
> > > }
> > >
> > > HashSet rowKeySet=new HashSet();
> > > //Result result = table.get(g);
> > > for (Result results : resultScanner) {
> > > for(KeyValue kv : results.raw()){
> > > rowKeySet.add(new String(kv.getRow()));
> > >
> > > }
> > > }
> > > return rowKeySet;
> > > }
> > >
> > >
> > >
> > >
> > >
> > > can we perform prefix by
> > > Filter filter = new QualifierFilter(CompareFilter.CompareOp.EQUAL,
> new
> > > BinaryComparator(Bytes.toBytes(rowkeys)));
> > >
> > > Thanks
> > > Manjeet
> > >
> > > --
> > > luv all
> > >
> >
>



-- 
luv all


Re: How to Speed up Prefix scan on column qualifier

2016-08-24 Thread Ted Yu
Get is used to retrieve single row.

If Get serves your need, you don't need PrefixFilter.

On Wed, Aug 24, 2016 at 11:58 AM, Manjeet Singh 
wrote:

> I am using 1.2.1
>
> I have tried these but actually ResultScanner took long time
> is their any way to use Get with filter?
> HBase already exposed setFilter method on Get class but its not working
>
> On Wed, Aug 24, 2016 at 10:56 PM, Vladimir Rodionov <
> vladrodio...@gmail.com>
> wrote:
>
> > If you are on HBase 1.+ you can use
> >
> > Scan API:
> >
> > setRowPrefixFilter(byte[] rowPrefix)
> >
> >
> > -Vlad
> >
> > On Wed, Aug 24, 2016 at 5:28 AM, Ted Yu  wrote:
> >
> > > Please use the following API to set start row before calling
> > > hTable.getScanner(scan):
> > >
> > >   public Scan setStartRow(byte [] startRow) {
> > >
> > > On Wed, Aug 24, 2016 at 5:08 AM, Manjeet Singh <
> > manjeet.chand...@gmail.com
> > > >
> > > wrote:
> > >
> > > > Hi All,
> > > >
> > > > I have below code where I have row key like 9865327845_#RandomChar
> > > > I want to perform prefix scan I tryed with ResultScanner  which has
> > > > performance impact
> > > > I have seen in some articles people saying about Get and setFilter
> but
> > > its
> > > > not working
> > > > can anyone suggest me better way, below is my code
> > > >
> > > > public static HashSet  getResultByPreFixFilterScan(String rowkeys){
> > > > Scan scan = new Scan();
> > > > PrefixFilter prefixFilter = new PrefixFilter(rowkeys.getBytes());
> > > > scan.setFilter(prefixFilter);
> > > > ResultScanner resultScanner = null;
> > > > try {
> > > > resultScanner = hTable.getScanner(scan);
> > > > } catch (IOException e) {
> > > > // TODO Auto-generated catch block
> > > > e.printStackTrace();
> > > > }
> > > >
> > > > HashSet rowKeySet=new HashSet();
> > > > //Result result = table.get(g);
> > > > for (Result results : resultScanner) {
> > > > for(KeyValue kv : results.raw()){
> > > > rowKeySet.add(new String(kv.getRow()));
> > > >
> > > > }
> > > > }
> > > > return rowKeySet;
> > > > }
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > can we perform prefix by
> > > > Filter filter = new QualifierFilter(CompareFilter.CompareOp.EQUAL,
> > new
> > > > BinaryComparator(Bytes.toBytes(rowkeys)));
> > > >
> > > > Thanks
> > > > Manjeet
> > > >
> > > > --
> > > > luv all
> > > >
> > >
> >
>
>
>
> --
> luv all
>


How to get Last 1000 records from 1 millions records

2016-08-24 Thread Manjeet Singh
Hi all

Hbase didnt provide sorting on column but rowkey store in sorted form
like small value first and greater value last

example
1
2
3
4
5
6
7
and so on

Assume I have 1 Miilions record but i want to look last 1000 records only
Is their any way to do this? I don't want to perform any calculation on
client side so may be any filter can help on it?

Thanks
Manjeet

-- 
luv all


Re: How to Speed up Prefix scan on column qualifier

2016-08-24 Thread Manjeet Singh
Get also support List object

On Thu, Aug 25, 2016 at 12:32 AM, Ted Yu  wrote:

> Get is used to retrieve single row.
>
> If Get serves your need, you don't need PrefixFilter.
>
> On Wed, Aug 24, 2016 at 11:58 AM, Manjeet Singh <
> manjeet.chand...@gmail.com>
> wrote:
>
> > I am using 1.2.1
> >
> > I have tried these but actually ResultScanner took long time
> > is their any way to use Get with filter?
> > HBase already exposed setFilter method on Get class but its not working
> >
> > On Wed, Aug 24, 2016 at 10:56 PM, Vladimir Rodionov <
> > vladrodio...@gmail.com>
> > wrote:
> >
> > > If you are on HBase 1.+ you can use
> > >
> > > Scan API:
> > >
> > > setRowPrefixFilter(byte[] rowPrefix)
> > >
> > >
> > > -Vlad
> > >
> > > On Wed, Aug 24, 2016 at 5:28 AM, Ted Yu  wrote:
> > >
> > > > Please use the following API to set start row before calling
> > > > hTable.getScanner(scan):
> > > >
> > > >   public Scan setStartRow(byte [] startRow) {
> > > >
> > > > On Wed, Aug 24, 2016 at 5:08 AM, Manjeet Singh <
> > > manjeet.chand...@gmail.com
> > > > >
> > > > wrote:
> > > >
> > > > > Hi All,
> > > > >
> > > > > I have below code where I have row key like 9865327845_#RandomChar
> > > > > I want to perform prefix scan I tryed with ResultScanner  which has
> > > > > performance impact
> > > > > I have seen in some articles people saying about Get and setFilter
> > but
> > > > its
> > > > > not working
> > > > > can anyone suggest me better way, below is my code
> > > > >
> > > > > public static HashSet  getResultByPreFixFilterScan(String
> rowkeys){
> > > > > Scan scan = new Scan();
> > > > > PrefixFilter prefixFilter = new PrefixFilter(rowkeys.getBytes());
> > > > > scan.setFilter(prefixFilter);
> > > > > ResultScanner resultScanner = null;
> > > > > try {
> > > > > resultScanner = hTable.getScanner(scan);
> > > > > } catch (IOException e) {
> > > > > // TODO Auto-generated catch block
> > > > > e.printStackTrace();
> > > > > }
> > > > >
> > > > > HashSet rowKeySet=new HashSet();
> > > > > //Result result = table.get(g);
> > > > > for (Result results : resultScanner) {
> > > > > for(KeyValue kv : results.raw()){
> > > > > rowKeySet.add(new String(kv.getRow()));
> > > > >
> > > > > }
> > > > > }
> > > > > return rowKeySet;
> > > > > }
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > can we perform prefix by
> > > > > Filter filter = new QualifierFilter(CompareFilter.CompareOp.EQUAL,
> > > new
> > > > > BinaryComparator(Bytes.toBytes(rowkeys)));
> > > > >
> > > > > Thanks
> > > > > Manjeet
> > > > >
> > > > > --
> > > > > luv all
> > > > >
> > > >
> > >
> >
> >
> >
> > --
> > luv all
> >
>



-- 
luv all


Re: hbase replication : ERROR: Connection refused

2016-08-24 Thread Esteban Gutierrez
Hello Ted,

Great! thanks for keeping us posted.

esteban.


--
Cloudera, Inc.


On Tue, Aug 23, 2016 at 5:42 PM, Ted  wrote:

> thanks, that helped.
>
> It showed it was doing a subsequent call via 127.0.0.1 so I double checked
> all my configs to make sure I used the hostname/dns entries then it all
> worked.
>
> thanks.
>
>
>
> On Tue, Aug 23, 2016 at 2:11 PM, Esteban Gutierrez 
> wrote:
>
> > Hello Ted,
> >
> > the first 2 commands interact with the HBase Master and the third command
> > needs to get the splits from Meta, probably the exception is coming from
> > there but its can you retry the commands but this time launching the
> hbase
> > shell with the -d flag? e.g. "hbase shell -d" that should give us a
> better
> > idea where that connection refused is coming from.
> >
> > cheers,
> > esteban.
> >
> > --
> > Cloudera, Inc.
> >
> >
> > On Tue, Aug 23, 2016 at 1:46 PM, Ted  wrote:
> >
> > > Hi I'm running hbase 1.2.1 and I'm getting an error trying to setup
> > > replication.
> > >
> > > I have 2 hbase systems running fine,
> > > I can connect from both to each other via ssh and on all ports as
> there's
> > > no firewall (this is just a test system).
> > > I can connect from the source to the destination ZK on port 2181
> > >
> > > When I try to enable replication though I get "ERROR: Connection
> refused"
> > > with no other helpful information anywhere.
> > >
> > > ---
> > > hbase(main):002:0> create 'test', 'cf'
> > > 0 row(s) in 2.5390 seconds
> > >
> > > => Hbase::Table - test
> > > hbase(main):003:0> add_peer 'vm2', "vm2:2181:/hbase"
> > > 0 row(s) in 0.1830 seconds
> > >
> > > hbase(main):004:0> enable_table_replication 'test'
> > >
> > > ERROR: Connection refused
> > >
> > > Here is some help for this command:
> > > Enable a table's replication switch.
> > >
> > > Examples:
> > >
> > >   hbase> enable_table_replication 'table_name'
> > >
> > >
> > > hbase(main):005:0>
> > > ---
> > >
> > > There's no errors on the source logs, no log entries written at all
> > during
> > > the enable call.
> > > On the destination logs there are also no errors.
> > > If I do a "zk_dump" on the destination, I can see the source is
> actually
> > > connected.
> > >
> > > No replication is taking place, and other than that "error: connection
> > > refused", I see no error messages.
> > >
> > > Anyone with any ideas on what and where it's trying to connect to? and
> > why
> > > it's being refused?
> > >
> > > --
> > > Ted.
> > >
> >
>
>
>
> --
> Ted.
>


Re: How to get Last 1000 records from 1 millions records

2016-08-24 Thread Ted Yu
The following API should help in your case:

  public Scan setReversed(boolean reversed) {

Cheers

On Wed, Aug 24, 2016 at 12:05 PM, Manjeet Singh 
wrote:

> Hi all
>
> Hbase didnt provide sorting on column but rowkey store in sorted form
> like small value first and greater value last
>
> example
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> and so on
>
> Assume I have 1 Miilions record but i want to look last 1000 records only
> Is their any way to do this? I don't want to perform any calculation on
> client side so may be any filter can help on it?
>
> Thanks
> Manjeet
>
> --
> luv all
>


Re: How to get Last 1000 records from 1 millions records

2016-08-24 Thread Esteban Gutierrez
As long as new rows are added to the latest region that "might" work. But
if the table is using hashed keys or rows are added randomly to the table
then retrieving the last million will be trickier and you will have to scan
based on timestamp (if not modified) and then filter one more time.

esteban.


--
Cloudera, Inc.


On Wed, Aug 24, 2016 at 12:31 PM, Ted Yu  wrote:

> The following API should help in your case:
>
>   public Scan setReversed(boolean reversed) {
>
> Cheers
>
> On Wed, Aug 24, 2016 at 12:05 PM, Manjeet Singh <
> manjeet.chand...@gmail.com>
> wrote:
>
> > Hi all
> >
> > Hbase didnt provide sorting on column but rowkey store in sorted form
> > like small value first and greater value last
> >
> > example
> > 1
> > 2
> > 3
> > 4
> > 5
> > 6
> > 7
> > and so on
> >
> > Assume I have 1 Miilions record but i want to look last 1000 records only
> > Is their any way to do this? I don't want to perform any calculation on
> > client side so may be any filter can help on it?
> >
> > Thanks
> > Manjeet
> >
> > --
> > luv all
> >
>


Re: How to get Last 1000 records from 1 millions records

2016-08-24 Thread Ted Yu
Manjeet didn't mention hashing.
Nor did the example show hashed keys.

Cheers

On Wed, Aug 24, 2016 at 12:36 PM, Esteban Gutierrez 
wrote:

> As long as new rows are added to the latest region that "might" work. But
> if the table is using hashed keys or rows are added randomly to the table
> then retrieving the last million will be trickier and you will have to scan
> based on timestamp (if not modified) and then filter one more time.
>
> esteban.
>
>
> --
> Cloudera, Inc.
>
>
> On Wed, Aug 24, 2016 at 12:31 PM, Ted Yu  wrote:
>
> > The following API should help in your case:
> >
> >   public Scan setReversed(boolean reversed) {
> >
> > Cheers
> >
> > On Wed, Aug 24, 2016 at 12:05 PM, Manjeet Singh <
> > manjeet.chand...@gmail.com>
> > wrote:
> >
> > > Hi all
> > >
> > > Hbase didnt provide sorting on column but rowkey store in sorted form
> > > like small value first and greater value last
> > >
> > > example
> > > 1
> > > 2
> > > 3
> > > 4
> > > 5
> > > 6
> > > 7
> > > and so on
> > >
> > > Assume I have 1 Miilions record but i want to look last 1000 records
> only
> > > Is their any way to do this? I don't want to perform any calculation on
> > > client side so may be any filter can help on it?
> > >
> > > Thanks
> > > Manjeet
> > >
> > > --
> > > luv all
> > >
> >
>


Re: How to Speed up Prefix scan on column qualifier

2016-08-24 Thread Ted Yu
I was talking about Get object.

You were talking about:

  public Result[] get(List gets) throws IOException {

Note: in the above case, it is easy to apply prefix filter over the List of
Get's on the client side.

On Wed, Aug 24, 2016 at 12:05 PM, Manjeet Singh 
wrote:

> Get also support List object
>
> On Thu, Aug 25, 2016 at 12:32 AM, Ted Yu  wrote:
>
> > Get is used to retrieve single row.
> >
> > If Get serves your need, you don't need PrefixFilter.
> >
> > On Wed, Aug 24, 2016 at 11:58 AM, Manjeet Singh <
> > manjeet.chand...@gmail.com>
> > wrote:
> >
> > > I am using 1.2.1
> > >
> > > I have tried these but actually ResultScanner took long time
> > > is their any way to use Get with filter?
> > > HBase already exposed setFilter method on Get class but its not working
> > >
> > > On Wed, Aug 24, 2016 at 10:56 PM, Vladimir Rodionov <
> > > vladrodio...@gmail.com>
> > > wrote:
> > >
> > > > If you are on HBase 1.+ you can use
> > > >
> > > > Scan API:
> > > >
> > > > setRowPrefixFilter(byte[] rowPrefix)
> > > >
> > > >
> > > > -Vlad
> > > >
> > > > On Wed, Aug 24, 2016 at 5:28 AM, Ted Yu  wrote:
> > > >
> > > > > Please use the following API to set start row before calling
> > > > > hTable.getScanner(scan):
> > > > >
> > > > >   public Scan setStartRow(byte [] startRow) {
> > > > >
> > > > > On Wed, Aug 24, 2016 at 5:08 AM, Manjeet Singh <
> > > > manjeet.chand...@gmail.com
> > > > > >
> > > > > wrote:
> > > > >
> > > > > > Hi All,
> > > > > >
> > > > > > I have below code where I have row key like
> 9865327845_#RandomChar
> > > > > > I want to perform prefix scan I tryed with ResultScanner  which
> has
> > > > > > performance impact
> > > > > > I have seen in some articles people saying about Get and
> setFilter
> > > but
> > > > > its
> > > > > > not working
> > > > > > can anyone suggest me better way, below is my code
> > > > > >
> > > > > > public static HashSet  getResultByPreFixFilterScan(String
> > rowkeys){
> > > > > > Scan scan = new Scan();
> > > > > > PrefixFilter prefixFilter = new PrefixFilter(rowkeys.getBytes(
> ));
> > > > > > scan.setFilter(prefixFilter);
> > > > > > ResultScanner resultScanner = null;
> > > > > > try {
> > > > > > resultScanner = hTable.getScanner(scan);
> > > > > > } catch (IOException e) {
> > > > > > // TODO Auto-generated catch block
> > > > > > e.printStackTrace();
> > > > > > }
> > > > > >
> > > > > > HashSet rowKeySet=new HashSet();
> > > > > > //Result result = table.get(g);
> > > > > > for (Result results : resultScanner) {
> > > > > > for(KeyValue kv : results.raw()){
> > > > > > rowKeySet.add(new String(kv.getRow()));
> > > > > >
> > > > > > }
> > > > > > }
> > > > > > return rowKeySet;
> > > > > > }
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > can we perform prefix by
> > > > > > Filter filter = new QualifierFilter(CompareFilter.
> CompareOp.EQUAL,
> > > > new
> > > > > > BinaryComparator(Bytes.toBytes(rowkeys)));
> > > > > >
> > > > > > Thanks
> > > > > > Manjeet
> > > > > >
> > > > > > --
> > > > > > luv all
> > > > > >
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > luv all
> > >
> >
>
>
>
> --
> luv all
>


Re: How to get Last 1000 records from 1 millions records

2016-08-24 Thread Dima Spivak
Hey Manjeet,

How much data are you actually trying to get the last 1000 records for? If
you're dealing at the scale of only millions of rows, HBase may not be the
best choice for this type of problem.

On Wed, Aug 24, 2016 at 12:05 PM, Manjeet Singh 
wrote:

> Hi all
>
> Hbase didnt provide sorting on column but rowkey store in sorted form
> like small value first and greater value last
>
> example
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> and so on
>
> Assume I have 1 Miilions record but i want to look last 1000 records only
> Is their any way to do this? I don't want to perform any calculation on
> client side so may be any filter can help on it?
>
> Thanks
> Manjeet
>
> --
> luv all
>



-- 
-Dima