HBase pseudo-distributed installation and simple use

Source: Internet
Author: User
HBase is a Hadoop-based database and runs based on Hadoop. It is a NoSQL database. Features: distributed, multi-version, and column-oriented storage models enable real-time random read/write of large-scale data and direct use of local file systems. Not Suitable: Compared with relational databases, the model is simple and there are few APIS; it is not suitable for small-scale data. The data storage location is

HBase is a Hadoop-based database and runs based on Hadoop. It is a NoSQL database. Features: distributed, multi-version, and column-oriented storage models enable real-time random read/write of large-scale data and direct use of local file systems. Not Suitable: Compared with relational databases, the model is simple and there are few APIS; it is not suitable for small-scale data. The data storage location is

HBase is a Hadoop-based database and runs based on Hadoop. It is a NoSQL database.

Features: distributed, multi-version, and column-oriented storage models enable real-time random read/write of large-scale data and direct use of local file systems.

Not Suitable: Compared with relational databases, the model is simple and there are few APIS; it is not suitable for small-scale data.

The location where data is stored is called a cell. The data can have multiple versions, which are differentiated by timestamp.

Installation:

Tar xfz hbase-0.94.18.tar.gz

Cd hbase *

Cd conf

Vi hbase-env.sh

Export JAVA_HOME =/usr/jdk1.6.0 _ 45

Vi hbase-site.xml

 
  
   
    
Hbase. rootdir
   
   
    
Hdfs: // localhost: 9000/hbase
   
   
    
Data storage location.
   
  
  
   
    
Dfs. replication
   
   
    
1
   
   
    
Specify the number of replicas as 1 because of pseudo-distribution.
   
  
 
After the preceding configuration is complete, start hadoop,

Cd ../hadoop

Bin/start-all.sh

Check whether jps is successfully started.

Then start hbase,

Cd ../hbase *

Bin/start-hbase.sh

Jps checks whether hbase is successfully started,

HMaster will be created successfully

You can also use the browser, http: // localhost: 60010

Bin/hbase shell can be used to access the hbase command line tool.

HBase Shell supports multiple commands
-Generally
? Status, version
-Data Definition Language (DDL)
? Alter, create, describe, disable, drop, enable, exists, is_disabled,
Is_enabled, list
-Data Control Language (DML)
? Count, delete, deleteall, get, get_counter, incr, put, scan, truncate
-Cluster management
? Balancer, close_region, compact, flush, major_compact, move, split,
Unassign, zk_dump, add_peer, disable_peer, enable_peer,
Remove_peer, start_replication, stop_replication
? View the usage of each command
-Hbase> help""

> List # list hbase tables

> Status # Return cluster status information

To create a table, hbase has multiple table creation methods:

-- Hbase> create 't1', {NAME => 'f1', VERSIONS => 5}
-Hbase> create 't1', {NAME => 'f1', VERSIONS => 1,
TTL => 2592000, BLOCKCACHE => true}
-Hbase> create 't1', {NAME => 'f1'}, {NAME => 'F2 '},
{NAME => 'f3 '}
-Hbase> create 't1', 'f1 ', 'F2', 'f3'

For example, create 'blog ', {NAME => 'info'}, {NAME => 'content '}

List to View tables in hbase

After the table is created, add the data to the table.

The format is as follows:

Put 'table', 'row _ id', 'Family: column', 'value'

Put 'blog ', 'Matt-001', 'info: title', 'elephant'
Put 'blog ', 'Matt-001', 'info: author', 'Matt'
Put 'blog ', 'Matt-001', 'info: date', '2017. 100'

Count 'table _ name' to view the number of Columns

Get 'table', 'row _ id' get a column of data in the table

Scan 'table _ name' to return all data of the entire table

Scan 'table', {COLUMNS => ['col1', 'col2']} can also add conditions

Edit data:

The put command is used, that is, when the put column does not exist, the Add command is executed. If the put Column exists, the modification is executed.

The previous version is retained during modification. By default, three copies are retained.

Delete 'table', 'rowid', and 'column 'to delete data. All versions are deleted without any conditions.

To delete a table, first change the table status to offline, disable 'table _ name'

Can be deleted, drop 'table _ name'

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.