[HBase HBase installation]

Introduction
HBase is a distributed, column-oriented open source database, the technology comes from Google Fay Chang papers written by "Bigtable: a distributed storage system structured data." HBase Unlike relational database, it is adapted to a database of unstructured data store. Another difference is that HBase based on columns rather than on-line mode. When you need real-time read and write, random access to very large scale data sets, you can use HBase.
Here Insert Picture Description
The figure describes the structure of layers in Hadoop Ecosystem. Wherein, HBase structured storage layer is located, Hadoop HDFS provides a highly reliable support for the underlying storage HBase. Hadoop MapReduce provides high-performance computing power HBase, ZooKeeper HBase to provide a stable service and failover (failover) mechanism. In addition, Pig and Hive also provides a high-level language support for HBase, making statistical data processing becomes very simple in HBase. Sqoop was HBase provides a convenient RDBMS data import function, the database data migration to the traditional in HBase becomes very convenient.
Here Insert Picture Description
As for the architecture of FIG HBase

Any data HBase Master is responsible for managing all HRegion, do not store HBase HBase Master server, HBase table on logic can be divided into multiple HRegion, then stored in HRegion Server group, HBase Master Server stored data from mapping of HRegion Server.

A machine can only run one HRegion server, the operation of recording data Hlog, the data read time, HRegion will first access the cache, if there is no data in the cache before returning to find the Hstore, each column will have a Hstore sets, each set comprising Hstore HstoreFile numerous specific files, which is a B tree structure for quick reading.

Experimental Procedure
1. First, local Linux, the new / data / hbase1 directory for storing the desired file .

mkdir -p / data / hbase1
switching to the directory / data / hbase1, using wget command to download the required installation package HBase hbase-1.0.0-cdh5.4.5.tar.gz.

cd /data/hbase1
wget http://59.74.172.143:60000/allfiles/hbase1/hbase-1.0.0-cdh5.4.5.tar.gz
cd /data/hbase1
wget http://59.74.172.143:60000/allfiles/hbase1/hbase-1.0.0-cdh5.4.5.tar.gz

2. The lower / data / hbase1 directory, HBase installation package hbase-1.0.0-cdh5.4.5.tar.gz, extract to / apps directory.

tar -xzvf /data/hbase1/hbase-1.0.0-cdh5.4.5.tar.gz -C / apps
then switch to the next / apps directory, /apps/hbase-1.0.0-cdh5.4.5/, rename as hbase.

cd /apps
mv /apps/hbase-1.0.0-cdh5.4.5/ /apps/hbase

3. Add HBase environment variables. The first to use vim to open the user environment variables file.

sudo vim ~ / .bashrc
in the environment variable end of the file location, additional HBase bin directory path configuration, and save and exit. Namely the following:

#hbase
export HBASE_HOME=/apps/hbase
export PATH=$HBASE_HOME/bin:$PATH

Source command execution, the environment variables to take effect.

source ~ / .bashrc
then you can call the script in the bin directory of HBase. First take a look at the version information in HBase.

hbase version

4. Start the following configuration HBase. Switching to the directory / apps / hbase / conf directory and use vim editor hbase-env.sh file.

cd / Apps / HBase / conf
vim hbase-env.sh
additional configuration content to hbase-env.sh and save and exit.

export JAVA_HOME=/apps/java
export HBASE_MANAGES_ZK=true
export HBASE_CLASSPATH=/apps/hbase/conf

It is clear:

JAVA_HOME location for the java program;

HBASE_MANAGES_ZK indicating whether to use HBase comes zookeeper environment;

HBASE_CLASSPATH hbase path to the configuration file.

5. The following is vim open hbase-site.xml file.

vim hbase-site.xml
add something between the two, and save and exit.

<property>
<name>hbase.master</name>
<value>localhost</value>
</property>
<property>
<name>hbase.rootdir</name>
<value>hdfs://localhost:9000/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>localhost</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/data/tmp/zookeeper-hbase</value>
</property>

Item Description:

hbase.master: HBase master address.

hbase.rootdir: HBase files are stored.

hbase.cluster.distributed: HBase whether distributed mode.

hbase.zookeeper.quorum: This is where the ZooKeeper server configuration.

hbase.zookeeper.property.dataDir: indicates the position where the data is stored in HBase ZooKeeper.

Note: Here hbase.zookeeper.property.dataDir directory needs to be created in advance.

sudo mkdir -p / data / tmp / zookeeper-hbase
the / data / tmp / zookeeper-hbase content switching zhangyu ordinary users and user groups zhangyu.

sudo chown -R zhangyu:zhangyu /data/tmp/zookeeper-hbase

6. Use vim editor / apps / hbase / conf / regionservers file, which stores the ip address HBase cluster nodes, only one node, it is only necessary to fill in localhost.

vim / apps / hbase / conf / regionservers
modify the contents of the file:

localhost

7. Enter the following jps, view the current process, whether Hadoop process has started.

jps
If not activated, the switch to the next / apps / hadoop / sbin directory, start Hadoop.

cd / Apps / hadoop / sbin
./start-all.sh
When Hadoop-related process starts, enter the HBase bin directory, start HBase service.

cd /apps/hbase/bin/
./start-hbase.sh

8. Enter jps, see HBase related process exists.

jps
output is:

Here Insert Picture Description
We can see HMaster, HRegionServer, HQuorumPeer processes have started.

To further test HBase installation, whether it is normal, into the HBase Shell interface.

hbase shell
Note: If we use SecureCRT Such remote access tools, the wrong command, simply press the Backspace key, not deleted the previous text. Here you can use the Ctrl key + Backspace key to delete the previous mistyped words.

Enter the list command to see which HTable table currently.

list
to create a table tb, the table contains a row cluster mycf.

create 'tb', 'mycf'
input list again, HBase listed in the table.
Here Insert Picture Description

Hbase this installation test all done!

Guess you like

Origin blog.csdn.net/weixin_44039347/article/details/91466585