Install HBase under Mac and detailed

Source: Internet
Author: User
Tags zookeeper hdfs dfs

Mac installs HBase and detailed 1. Introduction to the stereotyped HBase

HBase is a database of Hadoop, and the Hive Database management tool, HBase has 分布式, 可扩展及面向列存储 the features ( based on Google bigtable). HBase can use both the local file system and the HDFs file storage System, which stores loose data (The Key-value mapping relationship ).

HBase is located on the upper level of HDFS, provides storage down, provides operations up

2. HBase Installation

HBase has a single, pseudo-distributed, fully distributed operation mode

Depend on:

    • Match the Hadoop version of HBase
    • Java JDK 1.6+
    • Ssh

Installation

$ brew install hbase# 安装在/usr/local/Cellar/hbase/1.0.0

Configure HBase

In the conf/hbase-env.sh setup Java_home

cd /usr/local/Cellar/hbase/1.0.0/libexec/conf$ vim hbase-env.shexport JAVA_HOME="/usr/bin/java"

In conf/hbase-site.xml setting the core configuration of HBase

$ vim Hbase-site.xml<Configuration><Property><Name>hbase.rootdir</name>//Here Set the place where HBase stores files <value >file:///users/andrew_liu/downloads/hbase</value> Span class= "Hljs-tag" ></property> < property> <name> Hbase.zookeeper.property.datadir</name>// Here set the place where HBase stores the built-in zookeeper files <value>/users/andrew_liu/ Downloads/zookeeper</value> </< Span class= "Hljs-title" >property></configuration>  

/usr/local/Cellar/hbase/1.0.0/bin/start-hbase.shProvides the start of hbase

$ ./start-hbase.sh                                          starting master, logging to /usr/local/Cellar/hbase/1.0.0/libexec/bin/../logs/hbase-andrew_liu-master-Andrew-liudeMacBook-Pro.local.out

Verify that the installation is successful

$ jps3440 Jps3362 HMaster # 有HMaster则说明安装成功1885

Start the HBase Shell

$./bin/hbase ShellHBaseShell; Enter ' help<return> ' for List of supported Commands.type  "exit<return>" to leave the HBase shellversion 1.0.0, r6c98bff7b719efdb16f71606f3b7d8229445eb81, Sat feb 14 19 :49:22 pst 20151.8.7-p357:001 >1.8.7-p357:001 > Exit  #退出shell      

Stop HBase Run

$ ./bin/stop-hbase.shstopping hbase....................
3. Pseudo-distributed mode

HBase must be closed

Modify Hbase-env.sh

true

Modify Hbase-site.xml, set HBase to run with distributed mode

<Configuration><Property><Name>hbase.rootdir</name>//here you had to set the path where you want HBase to Stor e its files. <value>hdfs://localhost:8020/hbase </value> </ property> <property> <name>hbase.cluster.distributed</< Span class= "Hljs-title" >name> <value>true </value></ property></configuration>  

hbase.rootdirThe path must be core-site.xml the same as Fs.default.name in Hadoop

Change the Hbase.rootdir from the local filesystem to the address of your HDFS instance ---offical quick start

How to set up two different places will causeERROR: Can‘t get master address from ZooKeeper; znode data == null错误错误

Before starting HBase, start Hadoop so that it runs

Start HBase

$ ./start-hbase.sh$ jps  #验证是否启动成功, 包含HMaster和HRegionServer说明启动成功6400 DataNode7872 Jps7702 HMaster  7624 HQuorumPeer6315 NameNode6508 SecondaryNameNode6716 NodeManager7804 HRegionServerHBase 6623 ResourceManager

If you start HBase, you are prompted as follows

4667. Stop it first.#请执行以下操作$ kill -9 4667  #这里4667是要杀掉的进程号

Start successfully hbase creates the/hbase directory under HDFs

$ hdfs dfs -ls /hbase
4. HBase Shell
$ hbase Shell#启动HBase Shell#创建表 > Create' Student ',' Description ',' Course '#创建表名为student的表, specify two column names, description and course, respectively#信息明细 >List' Student '#列出list表信息#插入数据 > Put ' student ', ' row1 ', ' description:age ', ' #意思为在student表row1处插入description: The age data for 18> put ' student ', ' row1 ', ' description:name ', ' Liu ' put ' student ', ' row1 ', ' Course:chinese ', '#一次扫描所有数据 > Scan ' student# make the table invalid/active > Disable ' student' > Enable ' Student' #删除表 (disable first) > drop ' student' #退出shell > Quit       
5. HBase and HDFs

HBase is a sparse long-term stored, multidimensional, sorted mapping table that can locate special data by row key, row key + timestamp or row key + column (column family: column modifier)

5.1. HBase Architecture

HBase's server system complies with the simple master-slave server architecture, HRegion服务器群 and HBase服务器构成 the master server manages all hregion servers. All servers in HBase are coordinated by zookeeper and handle errors that may be encountered while the HBase server is running.

The tables on the HBase logic may be partitioned into multiple hregion and then stored on the hregion server.

    • HBase does not involve the direct deletion and updating of data, and the merge operation is triggered when the number of StoreFile in store exceeds the threshold
    • The main task of Hmaster is to tell each hregion server that it wants to maintain those hregion
    • Zookeeper stores the location of the root table and meta table in HBase, and zookeeper is also responsible for monitoring the status of each machine

The Metadata sub-table uses a level three index structure: User table, metadata table, user table, root table

5.2. Java API
    • Hbaseconfiguration, this class is configured for HBase
    • Hbaseadmin provides an interface to manage the table information of the HBase database, provide create, delete tables, List table entries, 使表有效或无效 and add or remove column family members
    • Htabledescriptor, contains the name of the table and the column family of the corresponding table
    • Hcolumndescriptor, maintaining information about the column family
    • Htable, used to communicate with hbase tables
    • Put, which is used to add an action to a single row
    • Get, which is used to get information about a single row
    • Result, a single-line value of the table obtained after a GET or scan operation is stored
6. Reference Links
    • HBase Quick Start
    • Hadoop & Hbase on OSX 10.8 Mountain Lion
    • Hbase-installation
    • <Hadoop Action>
    • Hadoop+hbase pseudo-Distributed installation configuration

Install HBase under Mac and detailed

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.