Installation and configuration of HBase

Source: Internet
Author: User

Experiment Introduction

This experiment learns and understands the configuration and installation of hbase in different modes, as well as the subsequent start and stop of HBase.

First, the experimental environment explained

1. Environment Login

No password automatic login, system user name Shiyanlou, password Shiyanlou

2. Introduction to the Environment

This experiment environment uses the Ubuntu Linux environment with the desktop, the experiment will use the program on the desktop:

  • Xfceterminal:linux command line terminal, Open will enter the bash environment, you can use the Linux command;
  • Firefox: Browser, can be used in the need for the front-end interface of the course, only need to open the environment to write the HTML/JS page;
  • GVim: Very useful editor, the simplest usage can refer to the course Vim editor.

3. Use of the environment

Use the Gvim editor to enter the code required for the experiment, and then use the xfceterminal command-line environment to compile and run, view the running results, run and share your experiment results, the lab building provides the backstage, cannot cheat, can prove that you have completed the experiment effectively.

The Experiment records page can be viewed in the "My Course", which contains each experiment and notes, as well as the effective learning time of each experiment (refers to the time of the experiment desktop operation, if there is no action, the system will be recorded as Daze time). These are the proof of authenticity of your studies.

Second, before installation-check the necessary conditions

(1) Java (requires installation of version 1.6.x and above)

In the terminal input java -version to view the Java version on your machine;

(2) Hadoop

The specific installation of Hadoop can be found in our previous courses: Hadoop Deployment and management. It is important to note that in pseudo-distribution mode, the version of HBase is required and the Hadoop version 匹配 , or it is likely to be error prone. You can see the corresponding version of the jar file for Hadoop in the Lib directory of HBase.

Here we use the Hadoop V2.4.1 version as well as the HBase V0.98.11 version.

(3) SSH

The installation of SSH also covers this part of Hadoop deployment and management. SSH is used to manage the remote Hadoop and hbase daemon processes.

In this experiment environment, for everyone's convenience, we have prepared these necessary conditions for everyone, you just need to focus on HBase installation configuration.

III. Installation-Installation and configuration HBase

After confirming the above conditions, we are ready to start installing HBase. Before the experiment starts, you should switch to the Hadoop user:

$ su hadoop

The installation of HBase is usually divided into 3 modes:

1. Stand-alone mode installation

(1) Download and decompress

Stand-alone mode is easy to install and can be used with almost no modifications to the installation files. In stand-alone mode, HBase does not use HDFs, so you can run the installation files almost directly after extracting them. Enter the command to download HBase:

$ wget http://labfile.oss.aliyuncs.com/hbase-0.98.11-hadoop2-bin.tar.gz

Unzip its compressed package:

$ tar zxvf hbase-0.98.11-hadoop2-bin.tar.gz

Since the extracted file name may be very long, it is recommended to modify it to a shorter file name, for example:

$ mv hbase-0.98.11-hadoop2 hbase

(2) Configuration Hbase-site.xml

Before we run, we need to configure HBase. We recommend that you modify the ${hbase-dir}/conf/hbase-site.xml file, because even if you modify the Hbase-default.xml file, it will be overwritten by the configuration in Hbase-site.xml. In other words, the configuration in Hbase-site.xml is the final one. We make the following changes:

<configuration>    <property>        <name>hbase.rootdir</name> <value>file:///tmp/hbase-${user.name}/hbase</value> </property></configuration>

Note: Change ${user.name} to your own Hadoop user name

2. Pseudo-Distribution mode installation

Pseudo-distribution mode is a distributed mode that runs on a single machine. In this mode, hbase all daemons will run on the same node and need to rely on HDFs, so before this must ensure that HDFs has run successfully, refer to our previous lesson: Hadoop pseudo-Distribution mode configuration deployment. Once confirmed, we can begin to configure the parameters of HBase.

(1) Configuring the Hbase-site.xml file

<Configuration><Property><name>hbase.rootdir</name> <value>hdfs://localhost:9000/ Hbase</value> </ property> <property> <name>hbase.cluster.distributed</< Span class= "Hljs-title" >name> <value>true </value> </ property></configuration>  

hbase.rootdir: This parameter formulates the location of the Hreion server, where the data is stored. The primary port number should be consistent with the configuration of Hadoop. hbase.cluster.distributed: The operation mode of HBase. False is a standalone mode, and true is distributed mode. If False, HBase and zookeeper will run inside the same JVM. The default is False.

(2) Setting environment variables

In addition, we need to set some environment variables. Modify the hbase-env.sh file in the Conf directory under HBase (your JDK path may not be the same):

export JAVA_HOME=/usr/local/jdk1.7.0_67export HBASE_MANAGES_ZK=true

export HBASE_MANAGES_ZK=trueThis configuration information, which indicates that the settings are managed by HBase itself zookeeper, does not require a separate zookeeper, which is set to True when HBase is built with its own zookeeper.

Last modified to add path, enter:

$ sudo vim /etc/profile

To modify the/etc/profile file:

# set hbase pathexport PATH=$PATH:/usr/local/hadoop/hbase/bin

3. Fully Distributed mode installation

Since the full distribution mode requires more than one machine, we don't give a demonstration here.

Iv. after installation-run and stop HBase

As we mentioned above, HBase installation is divided into 3 modes, so hbase runs naturally into the same 3 modes.

1. Stand-alone mode operation

(1) Start

HDFs is not required in standalone mode, so you do not need to start Hadoop in advance and start hbase directly. Enter command under Terminal:./start-hbase.sh

Note: The path should be correct , should be: $HBASE _home/bin directory, otherwise you will not find start-hbase.sh this file, there will be an error

(2) View process

We can jps view the current HBase process by:

(3) Stop HBase Service

Input./stop-hbase.sh

2. Pseudo-Distribution mode operation

(1) Start and view processes

As we mentioned earlier, in pseudo-distribution mode, you must first ensure that HDFS is started. So, let's start HDFS and enter the command:./start-all.sh

Use jps the process to view current Hadoop:

After HDFS is successfully started, we start hbase again, as in the method of starting hbase in stand-alone mode, enter the command: ./start-hbase.sh

At this point jps , you can see more of the associated processes for HBase:

(2) Enter HBase Shell

HBase Shell users make it easy to create, delete, and modify tables, add data to tables, list related trusts in tables, and so on.

Input help to see the commands it supports, you can choose according to your needs.

(3) Stop HBase

Depending on the dependency, we need to close HBase first ./stop-hbase.sh :

jpsas you can see, hbase-related processes are gone:

Then close HDFs, ./stop-all.sh .

Finally, jps the process of finding HDFS is also gone:

3. Fully distributed mode operation

Slightly.

Homework

For qualified classmates, you can try the configuration and installation of HBase in full distribution mode.

Reference documents
  • "Hadoop Combat 2nd Edition" Lu Jiaheng, mechanical industry press;
  • Hadoop2.6.0 Pseudo-distributed environment construction
  • Hadoop-2.6.0 Pseudo-Distribution--installation configuration HBase

Installation and configuration of 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.