Ubuntu Install HBase

Source: Internet
Author: User
Tags zookeeper

Download: http://mirror.bit.edu.cn/apache/hbase/stable/

Official Guide: http://abloz.com/hbase/book.html

Installation configuration:

Extract:

TAR-XZVF hbase-0.96.0-hadoop1-bin.tar.gz

Go to $hbase/lib and look at the related Hadoop package to see which version of Hadoop it is.

Only the installation of the pseudo-distributed hbase is logged here.

Configuration parameters, modify Hbase-site.xml:

[HTML]View PlainCopy
  1. <configuration>
  2. ...
  3. <property>
  4. <name>hbase.rootdir</name>
  5. <value>hdfs://localhost:9000/hbase</value>
  6. <description>the directory shared by Regionservers.
  7. </Description>
  8. </Property>
  9. <property>
  10. <name>dfs.replication</name>
  11. <value>1</value>
  12. <description>the replication count for HLog & hfile storage.  should not being greater than HDFS datanode count.
  13. </Description>
  14. </Property>
  15. ...
  16. </configuration>

Pseudo-distributed Startup:

Pseudo-distributed is HDFS-based, so you need to start HDFs first.

After you start hbase

SH start-hbase.sh

No unexpected error:

[Email protected]:/opt/hbase-0.96/bin$ sh start-hbase.sh
start-hbase.sh:79:/opt/hbase-0.96/bin/hbase-config.sh: [[: Not Found
start-hbase.sh:88:/opt/hbase-0.96/bin/hbase-config.sh: [[: Not Found
start-hbase.sh:53: [: false:unexpected operator

Localhost:zookeeper running as Process 24164. Stop it first.
Starting master, logging to/opt/hbase-0.96/bin/. /logs/hbase-dat-master-dat-hp.out
Could not-start ZK at requested port of 2181.  ZK is started at Port:-1. Aborting as clients (e.g. shell) is not being able to find this ZK quorum.

It looks like 2181 is occupied, see the process that occupies 2181 ports:

lsof-i:2181

[Plain]View PlainCopy
    1. [Email protected]:/opt/hbase-0.96/logs$ lsof-i:2181
    2. COMMAND PID USER FD TYPE DEVICE size/off NODE NAME
    3. Java 24164 dat 87u IPv6 2800953 0t0 TCP *:2181 (LISTEN)

Ps-ef|grep 24164

[Plain]View PlainCopy
    1. [Email protected]:/opt/hbase-0.96/logs$ ps-ef|grep 24164
    2. DAT 24164 24151 0 10:09? 00:00:03/opt/jdk1.7.0_25/bin/java-dproc_zookeeper-xx:onoutofmemoryerror=kill-9%p-xmx1000m-xx:+ useconcmarksweepgc-dhbase.log.dir=/opt/hbase-0.96/bin/. /logs-dhbase.log.file=hbase-dat-zookeeper-dat-hp.log-dhbase.home.dir=/opt/hbase-0.96/bin/. -dhbase.id.str=dat-dhbase.root.logger=info,rfa-dhbase.security.logger=info,rfas Org.apache.hadoop.hbase.zookeeper.HQuorumPeer start

Displays the zookeeper service that is already hbase, kills the PID, retries,

[Plain]View PlainCopy
    1. [Email protected]:/opt/hbase-0.96/bin$./start-hbase.sh
    2. Starting master, logging to/opt/hbase-0.96/bin/. /logs/hbase-dat-master-dat-hp.out

Normal start, Detect JPS

[Plain]View PlainCopy
    1. [Email protected]:/opt/hbase-0.96/bin$ JPS
    2. 25644 Hmaster
    3. 23468 Tasktracker
    4. 23199 Secondarynamenode
    5. 23307 Jobtracker
    6. 25849 Jps
    7. 22827 NameNode
    8. 23031 DataNode

Normal...

HBase Shell

Edit/etc/profile Join Hbase_home, re-entry into force, source/etc/profile

[Plain]View PlainCopy
    1. Export pig_install=/opt/pig-0.12.0
    2. Export path= $PATH: $PIG _install/bin
    3. Export pig_classpath=/opt/hadoop-1.2.1/conf
    4. Export hive_home=/opt/hive-0.12.0
    5. Export path= $HIVE _home/bin: $HIVE _home/conf: $PATH
    6. Export Ant_home=/opt/ant
    7. Export path= $PATH: $ANT _home/bin
    8. Export hbase_home=/opt/hbase-0.96
    9. Export path= $PATH: $HBASE _home/bin
HBase Shell Entry:
[Plain]View PlainCopy
    1. [Email protected]:/opt/hbase-0.96/bin$ hbase Shell
    2. HBase Shell; Enter ' help<return> ' for list of supported commands.
    3. Type "exit<return>" to leave the HBase Shell
    4. Version 0.96.0-hadoop1, r1531434, Fri Oct 15:11:29 PDT 2013
    5. HBase (Main):001:0>


Enter Help, which lists the commands supported by the HBase shell

Shutdown is to close the HBase cluster and exit is to exit the HBase shell.

HBase Shell Practice

Build table

HBase (main):006:0> create ' test ', ' CF '

List all Tables

HBase (main):007:0> list
TABLE
Test
1 row (s) in 0.0440 seconds


= = ["Test"]

Inserting data

HBase (main):008:0> put ' test ', ' row1 ', ' cf:a ', ' value1 '
0 row (s) in 0.0750 seconds


HBase (main):009:0> put ' test ', ' row2 ', ' cf:b ', ' value2 '
0 row (s) in 0.0080 seconds


HBase (main):010:0> put ' test ', ' row3 ', ' cf:c ', ' value3 '
0 row (s) in 0.0060 seconds

Check Insert Condition

HBase (main):011:0> scan ' test '
ROW Column+cell
Row1 column=cf:a, timestamp=1386389158263, value=value1
Row2 column=cf:b, timestamp=1386389170821, value=value2
Row3 column=cf:c, timestamp=1386389185954, Value=value3
3 row (s) in 0.0450 seconds

Get Row

HBase (main):012:0> get ' test ', ' row2 '
COLUMN CELL
Cf:b timestamp=1386389170821, Value=value2
1 row (s) in 0.0140 seconds


drop table after disable

HBase (Main):013:0> disable ' test '
0 row (s) in 1.4220 seconds


HBase (Main):014:0> drop ' test '
0 row (s) in 0.2740 seconds


HBase (main):015:0> list
TABLE
0 row (s) in 0.0270 seconds


= []

Ubuntu Install HBase

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.