HBase Import Export, hbase shell basic commands.

Source: Internet
Author: User

Data import


./hbase org.apache.hadoop.hbase.mapreduce.Driver Import table name data file location
Hdfs
The data file location can be prefixed file:///

Otherwise, the HDFs address is accessed.


Data export
./hbase org.apache.hadoop.hbase.mapreduce.Driver Export table name data file location


Enter the shell command.

cd/hbasehome/bin/

CD./hbase Shell

2016-05-20 15:36:32,370 INFO [main] Configuration.deprecation:hadoop.native.lib is deprecated. Instead, use io.native.lib.available
HBase Shell; Enter ' help<return> ' for list of supported commands.
Type "exit<return>" to leave the HBase Shell
Version 0.98.6-zdh2.1.0-snapshot, r112581, Mon Jan 05:25:14 CST 2016

HBase (Main):001:0>

HBase (Main):001:0>

Create an HBase table

Create ' table name ', ' column name 1 ', ' Column Name 2 ', ' Column name n '

HBase (Main): 001:0>create ' Test ', ' name ', ' value '

View Test Table Construction

Enter describe ' table name ' in the shell

HBase (main):003:0> desc ' test '


DESCRIPTION ENABLED
' Test ', {NAME = ' course ', data_block_encoding = ' NONE ', REPL true
Ication = ' 0 ', bloomfilter = ' ROW ', Replication_scope = ' 0 '
, COMPRESSION = ' NONE ', VERSIONS = ' 1 ', min_versions = ' 0 ',
TTL = ' FOREVER ', keep_deleted_cells = ' false ', BLOCKSIZE =
' 65536 ', Encode_on_disk = ' true ', in_memory = ' false ', BLOC
Kcache = ' true '}, {name ' = ' name ', data_block_encoding = ' NO '
NE ', REPLICATION = ' 0 ', bloomfilter = ' ROW ', Replication_sco
PE = ' 0 ', COMPRESSION = ' NONE ', VERSIONS = ' 1 ', min_version
S = ' 0 ', TTL = ' FOREVER ', keep_deleted_cells = ' false ', BLO
cksize = ' 65536 ', Encode_on_disk = ' true ', in_memory = ' fal
Se ', Blockcache = ' true '}
1 row (s) in 0.0820 seconds

HBase (Main):004:0>

Add data

Enter in the shell: Put ' table name ', ' Row name ', ' Column name: ', ' value '

HBase (Main): 005:0>put ' Test ', ' Tom ', ' value:scores ', ' 80 '

0 row (s) in 0.1420 seconds

View data

Enter in the shell: Get ' table name ', ' Row name '

HBase (main):010:0> get ' test ', ' Tom '

COLUMN CELL
Course:math timestamp=1463730444304, value=90
1 row (s) in 0.0140 seconds

HBase (Main):006:0>

View Total Data

Enter: Scan ' table name ' in the shell

HBase (Main): 006:0>scan ' Test '

ROW Column+cell
Tom Column=course:math, timestamp=1463730322512, value=80
1 row (s) in 0.0750 seconds

modifying data

Input in Shell: Put ' table name ', ' Row name ', ' Column name: ', ' Value ' (modified for original value)

HBase (Main): 007:0>put ' Test ', ' Tom ', ' Course:math ', ' 90 '

Put ' test ', ' Tom ', ' Course:math ', ' 90 '

HBase (Main): 007:0>scan ' Test '

ROW Column+cell
Tom Column=course:math, timestamp=1463730444304, value=90
1 row (s) in 0.0140 seconds

There is also a list method. View all the tables.

Count ' table name ' to see the total number of records.

Get here first.

The end

HBase Import Export, hbase shell basic commands.

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.