"HBase Basic Tutorial" 1, hbase single-machine mode and pseudo-distributed mode installation

Source: Internet
Author: User
Tags tmp folder hadoop fs

In this blog, we will describe HBase's stand-alone mode installation and pseudo-distributed installation, as well as a browser view of HBase's user interface. The premise of setting up HBase pseudo-distributed environment is that we have built a fully distributed Hadoop environment and built the Hadoop environment, please refer to: "Basic Hadoop Tutorial" 4, the complete distributed environment of Hadoop construction

Development environment

Hardware environment: Centos 6.5 server 4 (one for master node, three for slave node)
Software Environment: Java 1.7.0_45, Eclipse Juno Service Release 2, hadoop-1.2.1, hbase-0.94.20.

1. HBase Installation

1) Download the installation package

The hbase-090.3.tar.gz version is well-compatible with hadoop-1.2.1, download the hbase-090.3.tar.gz installation package from the official website, and copy the downloaded hbase-090.3.tar.gz to the/home/hadoop directory. HBase Official website: http://archive.apache.org/dist/hbase/
Select the HBase-0.94.20 version and download the HBase releases.

2) Unpack the installation package

[[email protected] ~]$ cd /usr[[email protected] usr]$ sudo tar -xvf /home/hadoop/hbase-090.3.tar.gz   #解压安装源码包[[email protected] usr]$ mv hbase-090.3 hbase    #重命名[[email protected] usr]$ cd hbase[[email protected] hbase]$ sudo chown -R hadoop:hadoop hbase #赋予hbase安装目录下所有文件hadoop权限

3) Configure the installation path

#将hbase下的bin目录添加到系统的path中,在/etc/profile文件尾行添加如下的内容[[email protected] usr]$ sudo vim /etc/profileexport  PATH=$PATH:/usr/hbase/bin#执行source命令使上述配置在当前终端立即生效[[email protected] usr]$ source /etc/profile

4) Verify that the installation is successful

[[email protected] usr]$ hbase version14/07/21 18:01:57 INFO util.VersionInfo: HBase 0.94.2014/07/21 18:01:57 INFO util.VersionInfo: Subversion git://newbunny/home/lars/dev/hbase-0.94 -r 09c60d770f2869ca315910ba0f9a5ee9797b1edc14/07/21 18:01:57 INFO util.VersionInfo: Compiled by lars on Fri May 23 22:00:41 PDT 2014

Seeing the above print message indicates that HBase has been successfully installed, the next step is to configure HBase standalone mode and pseudo-distributed mode respectively.

2. HBase Standalone mode

1) Configuration/conf/hbase-env.sh

Set the Java_home variable to the root of the Java installation, as shown in the following configuration:

[[email protected] hbase]$ vim conf/hbase-env.sh#对hbase-env.sh文件做如下修改:export JAVA_HOME=/usr/java/jdk1.7.0_65  #配置本机的java安装根目录export HBASE_MANAGES_ZK=true        #配置由hbase自己管理zookeeper,不需要单独的zookeeper。

2) configuration/conf/hbase-site.xml

Before starting hbase, you need to set the property Hbase.rootdir, which specifies where hbase data is stored, set to the Hbase-tmp folder (file:///usr/hbase/hbase-tmp) in the HBase installation directory, configured as follows:

[[email protected] hbase]$ vim conf/hbase-site.sh<configuration>    <property>        <name>hbase.rootdir</name>        <value>file:///usr/hbase/hbase-tmp</value>    </property></configuration>

Special Note: Hbase.rootdir defaults to/tmp/hbase-${user.name}, which means that data will be lost every time the system restarts.

3) Start HBase

 [[email protected] hbase]$ start-hbase.sh starting master, logging to /usr/hbase/bin/../logs/hbase-hadoop-master-K-Master.localdomain.out

4) Enter Shell mode

After entering shell mode, the status command looks at the running state of hbase and exits the shell with the Exit command.

[[email protected] hbase]$ hbase shellHBase Shell; enter ‘help<RETURN>‘ for list of supported commands.Type "exit<RETURN>" to leave the HBase ShellVersion 0.94.20, r09c60d770f2869ca315910ba0f9a5ee9797b1edc, Fri May 23 22:00:41 PDT 2014hbase(main):001:0> status1 servers, 0 dead, 2.0000 average loadhbase(main):002:0> exit

5) Stop HBase

[[email protected] hbase]$ stop-hbase.sh stopping hbase.....................

Special NOTE: If an error occurs during the operation of HBASE, the cause of the error can be viewed through the log file in the logs subdirectory under the {hbase_home} directory (/usr/hbase).

3. HBase Pseudo-distributed mode

1) Configuration/conf/hbase-env.sh

Add the variable Hbase_classpath and set the path to the Conf directory in the native HADOOP installation directory (that is, {hadoop_home}/conf). After the modification is complete, the HBASE-ENV.SH is configured as follows:

[[email protected] hbase]$ vim conf/hbase-env.shexport JAVA_HOME=/usr/java/jdk1.7.0_65export HBASE_CLASSPATH=/usr/hadoop/conf export HBASE_MANAGES_ZK=true

2) configuration/conf/hbase-site.xml

Modify the Hbase.rootdir, point to K-master (consistent with the port of HDFs), and specify the storage path for HBase on HDFs. Set the property hbase.cluter.distributed to True. Suppose the current Hadoop cluster is running in pseudo-distributed mode, and Namenode is running on port 9000;

[[email protected] hbase]$ vim hbase-site.xml <configuration>    <property>        <name>hbase.rootdir</name>        <value>hdfs://K-Master:9000/hbase</value>    </property>    <property>        <name>hbase.cluster.distributed</name>        <value>true</value>    </property></configuration>

3) Start HBase

After completing the above operation, start HBase, start the order: Start hadoop–> and then start HBase, close the order: close hbase–> and then turn off Hadoop.

First step: Start the Hadoop cluster

[[email protected] hbase]$ start-all.sh          #启动hadoop[[email protected] hbase]$ jps               #查看进程9040 DataNode18205 Jps9196 SecondaryNameNode10485 JobTracker10620 TaskTracker8902 NameNode

Special note: Readers can first see if the Hadoop cluster is started with the JPS command, and if the Hadoop cluster is started, the Hadoop cluster boot operation is not required.

Step Two: Start HBase

[[email protected] lib]$ start-hbase.sh          #启动HbaseK-Master: starting zookeeper, logging to /usr/hbase/bin/../logs/hbase-hadoop-zookeeper-K-Master.localdomain.outstarting master, logging to /usr/hbase/bin/../logs/hbase-hadoop-master-K-Master.localdomain.outK-Master: starting regionserver, logging to /usr/hbase/bin/../logs/hbase-hadoop-regionserver-K-Master.localdomain.out[[email protected] lib]$ jps                 #查看进程9040 DataNode18889 HMaster19201 Jps9196 SecondaryNameNode19073 HRegionServer10485 JobTracker10620 TaskTracker18818 HQuorumPeer8902 NameNode

4) Enter Shell mode

After entering shell mode, through the list command to view all the table information of the current database, create a member table with the Creation command, which has member_id,address,info three column families, through the describe command to view the member table structure, Exit the HBase Shell mode with the Exit command.

[[email protected] hadoop]$ hbase shellhbase Shell; Enter ' help<return> ' for list of supported commands. Type "exit<return>" to leave the HBase shellversion 0.94.20, R09c60d770f2869ca315910ba0f9a5ee9797b1edc, Fri 23 2 2:00:41 PDT 2014hbase (main):001:0> create ' member ', ' member_id ', ' address ', ' info ' 0 row (s) in 2.7170 secondshbase (main ):002:0> listtable member 1 row (s) in 0.0550 secondshbase (main):003:0> describe ' member ' DESCRIPTION ENABLED ' mem  ber ', {NAME = ' address ', data_block_encoding = true > ' None ', Bloomfilter = ' None ', Replication_scope = ' 0 ', VERSIONS = ' 3 ', COMPRESSION = ' NONE ', MIN _versions = ' 0 ', TTL = ' 2147483647 ', keep_deleted _cells = > ' false ', BLOCKSIZE = ' 65536 ', in_memory = ' false ', Encode_on_disk = ' true ', Blockcache = ' true '}, { NAME = ' Info ', data_block_encoding = ' None ', Bloomfilter = ' None ', Replication_scope = ' 0 ', VERSIONS =&G T ' 3 ', COMPRESSION = ' NONE ', MIn_ve rsions = ' 0 ', TTL = ' 2147483647 ', keep_deleted_ce LLS = ' false ', BLOCKSIZE = ' 65536 ', In_memory =&gt  ; ' false ', Encode_on_disk = ' true ', Blockcache = ' t rue '}, {NAME = ' member_id ', data_block_encoding = NONE ', Bloomfilter = ' None ', Replication_scope = > ' 0 ', VERSIONS = ' 3 ', COMPRESSION = ' None ', Min_ VERSIONS =&G T ' 0 ', TTL = ' 2147483647 ', keep_deleted_ CELLS = ' false ', BLOCKSIZE = ' 65536 ', in_memory = > ' false ', Encode_ On_disk = ' true ', Blockcache = ' true '}1 row (s) in 0.1040 secondshbase (main):004:0> exit

5) View the HBase database file for HDFs

Using the Hadoop fs–ls/hbase command to see if the HBase distributed database was successfully created on HDFs, the/hbase/member folder is the location where the member database we established in HDFs is stored in the previous step.

[[email protected] conf]$ hadoop fs -ls /hbaseFound 8 itemsdrwxr-xr-x   - hadoop supergroup  0 2014-07-21 19:46 /hbase/-ROOT-drwxr-xr-x   - hadoop supergroup  0 2014-07-21 19:46 /hbase/.META.drwxr-xr-x   - hadoop supergroup  0 2014-07-22 11:38 /hbase/.logsdrwxr-xr-x   - hadoop supergroup  0 2014-07-22 11:39 /hbase/.oldlogsdrwxr-xr-x   - hadoop supergroup  0 2014-07-22 11:40 /hbase/.tmp-rw-r--r--   1 hadoop supergroup 38 2014-07-21 19:46 /hbase/hbase.id-rw-r--r--   1 hadoop supergroup  3 2014-07-21 19:46 /hbase/hbase.versiondrwxr-xr-x   - hadoop supergroup  0 2014-07-22 11:40 /hbase/member

6) HBase user interface:
Some information about hbase can be accessed through the links below, as shown in the following table:

7) Stop HBase

After you do this, close the hbase operation, close the order: close hbase-> and then turn off Hadoop.

[[email protected] hadoop]$ stop-hbase.sh    #停止Hbasestopping hbase..................K-Master: stopping zookeeper.[[email protected] hadoop]$ stop-all.sh  #停止Hadoopstopping jobtrackerK-Master: stopping tasktrackerstopping namenodeK-Master: stopping datanodeK-Master: stopping secondarynamenode
4. HBase User Interface

1) HDFs home page

Enter the http://{hostname}:50070/dfshealth.jsp Enter the HDFs home page, click on the "Browse the FileSystem" hyperlink on the Home page, select the HBase directory to view HBase generated on HDFS/ HBase directory structure, which is used to store hbase data as shown in;

2) master Page

The associated soap for HBase can be viewed through the address http://{hostname}:60010/master.jsp, as shown in.

The main information includes the following:

    • Attributes information

The Master property information contains the details of the current cluster, from the top down to the version of HBase and the compilation information, the version of Hadoop and the compilation information, the path of the HBase root directory, the average load of the region server, and the address of the Zookeeper quorums.

    • Tables Information

The user table information gives the table information and related attributes in HBase, and the catalog table information contains two table of contents tables:-root-and. META.;

Click the [Details] link to jump to the tables Details interface, as shown in:

    • Region servers Information

The region server information gives the address of all region servers, as shown in;

3) Zookeeper page

Through the link provided by the Master property on the master page, you can enter the Zookeeper page, which shows the root directory of HBase, the primary master address of the province, the address of the region server where the-root-table is saved, The address of other region servers and some internal information for zookeeper, as shown in.

4) User Table page

You can access the user table page as shown in the link http://{host name}:60010/table.jsp?name=user provided by the user table information in the master page. This page gives information about whether the table is currently available and what the table is on the region server. It also provides operations for merging and splitting tables based on row keys.

5) Region Server Page

Through the link provided by the region server information in the master page, you can go to the Region Server page, which shows the basic properties of the server and all the regions information on it, as shown in.



You may like

Single-machine mode and pseudo-distributed mode installation of HBase
Full distributed mode installation of HBase
HBase Shell DDL Operations
HBase Shell DML Operations
HBase API Access
HBase read MapReduce data written to HBase
HBase read hbase data written to HDFs

"HBase Basic Tutorial" 1, hbase single-machine mode and pseudo-distributed mode installation

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.