HBase Quick Start--shell operation

Source: Internet
Author: User
Tags hadoop mapreduce

I. INTRODUCTION

HBase is a distributed, column-oriented, open-source database derived from a Google paper, BigTable: A distributed storage system of structured data. HBase is an open source implementation of Google BigTable, which leverages Hadoop HDFs as its file storage system, leverages Hadoop MapReduce to handle massive amounts of data in HBase, and leverages zookeeper as a collaborative service.  

HBase stores data in the form of a table. The table is made up of rows and columns. The columns are divided into a number of column family/column families (column family).

As shown, Key1, Key2, Key3 are the only row key values for three records, Column-family1, Column-family2, Column-family3 are three column families, and several columns are included under each column family. For example column-family1 This column family consists of two columns, the name is Column1 and Column2. T1:ABC,T2:GDXDF is a cell that is uniquely determined by row Key1 and Column-family1-column1. There are two data in this cell, ABC and GDXDF. The timestamp of two values is different, t1,t2, and HBase returns the value of the most recent time to the requestor.

Two. Installation

Download the latest HBase version and put it in the appropriate directory, such as/usr/local or/opt

Then unzip

TAR-ZXVF hbase-x.y.z tar.gz

Three. command-line Operations

Enter the unpacked directory, open HBase, and start the hbase shell

Bin/start-hbase.shbin/hbase Shell

Enter help to see the group of commands

Partial command List

Below Group example

General operations

Query server state Status

Querying HBase versions version

DDL operations

1. Create a table

Create ' table1 ', ' tab1_id ', ' tab1_add ', ' tab1_info '

2. List all the tables

List

3. Get a description of the table

Describe "table1"

4. Delete a column family disable alter enable

Disable ' table1 ' alter ' table1 ', {name=> ' Tab1_add ', method=> ' delete '}enable ' table1 '

5. See if the table exists

Exists ' table2 '

6. Determine if the table is ' enable '

is_enabled ' table1 '

Determine if the table is ' disable '

is_disabled ' table1 '

7. Delete a table

Disable ' table1 ' drop ' table1 '

DML operations

1. Insert several records

123456 put ‘member‘‘scutshuxue‘‘info:age‘‘24‘put ‘member‘‘scutshuxue‘‘info:birthday‘‘1987-06-17‘put ‘member‘‘scutshuxue‘‘info:company‘‘alibaba‘put ‘member‘‘scutshuxue‘‘address:contry‘‘china‘put ‘member‘‘scutshuxue‘‘address:province‘‘zhejiang‘put ‘member‘‘scutshuxue‘‘address:city‘‘hangzhou‘

2. Full table Scan

3. Get Data get

3.1 Get all data for a row

3.2 Getting all the data for a row, a column family

3.3 Getting all the data for a row, a column family, a column

4. Update a record put (change Scutshuxue age to 99)

Put ' member ', ' Scutshuxue ', ' Info:age ', 99

5. Remove Delete, DeleteAll

5.1 (delete Row ' Scutshuxue ', the column family is the value of age in ' info ')

Delete ' member ', ' Scutshuxue ', ' info:age '

5.2 Deleting an entire row

DeleteAll ' member ', ' Scutshuxue '

6. How many rows are in the query table

Count ' member '

7. Add ' info:age ' field to ' xiaoming ' ID and increment with counter

INCR ' member ',  ' xiaoming ', ' info:age '   

8. Empty the entire table

Truncate ' member '

Tools Operations

1. Create a table

Four. Reference

http://smallwildpig.iteye.com/blog/1705718

HBase Quick Start--shell operation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.