Showing posts with label hbase tutorial. Show all posts
Showing posts with label hbase tutorial. Show all posts

Thursday, April 5, 2012

Commands Available on HBase Shell


Groups of commands and explanation :
  1. General Commands:
    1. status : Shows server status, example
        1 servers, 0 dead, 10.0000 average load
    2. version : Shows version of hbase
        0.90.4, r1150278, Sun Jul 24 15:53:29 PDT 2011
  2. DDL Commands:
    1. alter : Using this commmand you can alter the table
Alter column family schema; pass table name and a dictionary
specifying new column family schema. Dictionaries are described
on the main help command output. Dictionary must include name
of column family to alter. For example,
To change or add the 'f1' column family in table 't1' from defaults
to instead keep a maximum of 5 cell VERSIONS, do:
hbase> alter 't1', NAME => 'f1', VERSIONS => 5
To delete the 'f1' column family in table 't1', do:
hbase> alter 't1', NAME => 'f1', METHOD => 'delete'
or a shorter version:
hbase> alter 't1', 'delete' => 'f1'
You can also change table-scope attributes like MAX_FILESIZE
MEMSTORE_FLUSHSIZE, READONLY, and DEFERRED_LOG_FLUSH.
For example, to change the max size of a family to 128MB, do:
hbase> alter 't1', METHOD => 'table_att', MAX_FILESIZE => '134217728'
There could be more than one alteration in one command:
hbase> alter 't1', {NAME => 'f1'}, {NAME => 'f2', METHOD => 'delete'}

Tuesday, January 24, 2012

How to delete a specific row or given rows in hbase using java code

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package witsml131;

import java.io.IOException;
import java.util.ArrayList;
import javax.security.auth.login.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.util.Bytes;

/**
 *
 * @author shashwat
 */
public class DeleteFromHbase {

    public static void main(String[] args) throws IOException {

        HTable table = new HTable("well");
        ArrayList<String> rowsToDelete = new ArrayList(); //array with all rows names to delete.
        Delete del = new Delete(Bytes.toBytes("2"));//for single row named 2

        table.delete(del);
      
        //deleting all rows in rowsToDelete in array list rowsToDelete
        for (String rows : rowsToDelete) {
            del = new Delete(Bytes.toBytes(rows));//for single row named 2

            table.delete(del);
        }
        table.close();
    }
}

Sunday, December 18, 2011

HBase Schema Design - Things you need to know

 

When designing schemas for HBase, be it from scratch or porting an existing application over from a relational database for example, there are a set of architectural constraints that a user should be aware of to avoid common pitfalls. This session discusses the basic underlying concepts of the storage

Friday, November 11, 2011

Hadoop : HBase


Copyright © 2011 Apache Software Foundation

Chapter 1. Getting Started

1.1. Introduction

Section 1.2, “Quick Start” will get you up and running on a single-node instance of HBase using the local filesystem. Chapter 2, Configuration describes setup of HBase in distributed mode running on top of HDFS.

1.2. Quick Start

This guide describes setup of a standalone HBase instance that uses the local filesystem. It leads you through creating a table, inserting rows via the HBaseshell, and then cleaning up and shutting down your standalone HBase instance. The below exercise should take no more than ten minutes (not including download time).

Featured Posts

Kali Linux Remote Desktop: Access GNOME from Windows Using Native RDP

  Kali Linux + GNOME 50 + GNOME Remote Desktop + Windows Remote Desktop (MSTSC) Getting a full GNOME desktop remotely on Kali Linux can be ...