文档章节

HBase0.90.5安装

MT少年
 MT少年
发布于 2017/02/26 21:11
字数 1238
阅读 16
收藏 0

安装环境介绍

Linux:CentOS6.5_x64
JDK:jdk1.7.0_76
Hadoop: hadoop-0.20.2
Hbase: hbase-0.90.5

安装前准备

JDK版本

[hadoop@Hmaster ~]$ java -version
java version "1.7.0_76"
Java(TM) SE Runtime Environment (build 1.7.0_76-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.76-b04, mixed mode)

Hadoop0.20.2完全分布式环境

前期已经部署完成

[hadoop@Hmaster ~]$ hadoop version
Hadoop 0.20.2
Subversion https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20 -r 911707
Compiled by chrisdo on Fri Feb 19 08:07:34 UTC 2010​

HBase版本

hbase-0.90.5

安装步骤

配置hosts

# vim /etc/hosts
192.168.103.237  Hmaster
192.168.103.238  Hslave1
192.168.103.239  Hslave2

解压安装包

Hadoop用户登录

$ tar -zxvf hbase-0.90.5.tar.gz

替换Hadoop核心jar包

[hadoop@Hmaster lib]$ pwd
/home/hadoop/hbase-0.90.5/lib
[hadoop@Hmaster lib]$ mv hadoop-core-0.20-append-r1056497.jar hadoop-core-0.20-append-r1056497.jar.bak
[hadoop@Hmaster lib]$ cp /home/hadoop/hadoop/hadoop-0.20.2-core.jar /home/hadoop/hbase-0.90.5/lib/
[hadoop@Hmaster lib]$ ls -l hadoop-0.20.2-core.jar
-rw-rw-r--. 1 hadoop hadoop 2689741 Dec  3 14:59 hadoop-0.20.2-core.jar
[hadoop@Hmaster lib]$ chmod 775 hadoop-0.20.2-core.jar
[hadoop@Hmaster lib]$ ls -l hadoop-0.20.2-core.jar
-rwxrwxr-x. 1 hadoop hadoop 2689741 Dec  3 14:59 hadoop-0.20.2-core.jar

编辑hbase-env.sh文件

$ cd /home/hadoop/hbase-0.90.5/conf
$ vim hbase-env.sh
# 添加如下内容
export JAVA_HOME=/usr/java/jdk1.7.0_76
export HBASE_CLASSPATH=/home/hadoop/hbase-0.90.5/conf
export HBASE_HOME=/home/hadoop/hbase-0.90.5
export HBASE_LOG_DIR=${HBASE_HOME}/logs
export HBASE_MANAGES_ZK=true

说明:使用独立的ZooKeeper时需要修改HBASE_MANAGES_ZK值为false,为不使用默认ZooKeeper实例(默认为true)。

编辑hbase-site.xml文件

$ vim hbase-site.xml
#添加如下内容
<configuration>
<property>
<name>hbase.rootdir</name> #设置hbase数据库存放数据的目录
<value>hdfs://Hmaster:9000/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>  #打开hbase分布模式
<value>true</value>
</property>
<property>
<name>hbase.master</name> #指定hbase集群主控节点
<value>Hmaster:60000</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>Hmaster,Hslave1,Hslave2</value> #指定zookeeper集群节点名,因为是由zookeeper表决算法决定的
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name> #指zookeeper集群data目录
<value>/home/hadoop/hbase-0.90.5/zookeeper</value>
</property>
</configuration>

编辑regionservers文件

$ vim regionservers
将localhost改为Hslave1和Hslave2
[hadoop@Hmaster conf]$ cat regionservers 
Hslave1
Hslave2

将配置好的hbase-0.90.5目录同步到从节点

$ scp -r /home/hadoop/hbase-0.90.5 hadoop@Hslave1:/home/hadoop/
$ scp -r /home/hadoop/hbase-0.90.5 hadoop@Hslave2:/home/hadoop/

注意:如果主节点上Hbase目录中配置文件修改,那么要同步到其他的从节点。

启动/关闭HBase集群

启动顺序为:先启动Hadoop,后启动Hbase;

关闭顺序为:先关闭Hbase,后关闭Hadoop;

查看Hadoop启动状态

启动HBase前先检查Hadoop是否已启动

$ hadoop dfsadmin -report
(或 $ /home/hadoop/hadoop/bin/hadoop dfsadmin -report)
Configured Capacity: 307703062528 (286.57 GB)
Present Capacity: 291104432128 (271.11 GB)
DFS Remaining: 154077036544 (143.5 GB)
DFS Used: 137027395584 (127.62 GB)
DFS Used%: 47.07%
Under replicated blocks: 959
Blocks with corrupt replicas: 0
Missing blocks: 0

-------------------------------------------------
Datanodes available: 2 (2 total, 0 dead)

Name: 192.168.103.239:50010
Decommission Status : Normal
Configured Capacity: 153851531264 (143.29 GB)
DFS Used: 68887625728 (64.16 GB)
Non DFS Used: 8209874944 (7.65 GB)
DFS Remaining: 76754030592(71.48 GB)
DFS Used%: 44.78%
DFS Remaining%: 49.89%
Last contact: Thu Dec 03 16:47:48 CST 2015


Name: 192.168.103.238:50010
Decommission Status : Normal
Configured Capacity: 153851531264 (143.29 GB)
DFS Used: 68139769856 (63.46 GB)
Non DFS Used: 8388755456 (7.81 GB)
DFS Remaining: 77323005952(72.01 GB)
DFS Used%: 44.29%
DFS Remaining%: 50.26%
Last contact: Thu Dec 03 16:47:49 CST 2015

启动HBase集群

$ /home/hadoop/hbase-0.90.5/bin/start-hbase.sh
Hslave1: starting zookeeper, logging to /home/hadoop/hbase-0.90.5/logs/hbase-hadoop-zookeeper-Hslave1.out
Hmaster: starting zookeeper, logging to /home/hadoop/hbase-0.90.5/logs/hbase-hadoop-zookeeper-Hmaster.out
Hslave2: starting zookeeper, logging to /home/hadoop/hbase-0.90.5/logs/hbase-hadoop-zookeeper-Hslave2.out
starting master, logging to /home/hadoop/hbase-0.90.5/logs/hbase-hadoop-master-Hmaster.out
Hslave1: starting regionserver, logging to /home/hadoop/hbase-0.90.5/logs/hbase-hadoop-regionserver-Hslave1.out
Hslave2: starting regionserver, logging to /home/hadoop/hbase-0.90.5/logs/hbase-hadoop-regionserver-Hslave2.out

查看主/从节点上的进程

主节点

[hadoop@Hmaster ~]$ jps
11579 HQuorumPeer
11631 HMaster
18024 Jps
4392 NameNode
4545 SecondaryNameNode
4618 JobTracker

从节点

[hadoop@Hslave1 ~]$ jps
17709 HRegionServer
3522 DataNode
544 Jps
17636 HQuorumPeer
3617 TaskTracker
[hadoop@Hslave2 ~]$ jps
17634 HQuorumPeer
3038 DataNode
3133 TaskTracker
17713 HRegionServer
536 Jps

浏览器访问HBase

http://192.168.100.xxx:60010/master.jsp

关闭HBase集群

$ /home/hadoop/hbase-0.90.5/bin/stop-hbase.sh
stopping hbase.......
Hslave1: stopping zookeeper.
Hmaster: stopping zookeeper.
Hslave2: stopping zookeeper.

HBase命令行操作

进入hbase

[hadoop@Hmaster ~]$ /home/hadoop/hbase-0.90.5/bin/hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.90.5, r1212209, Fri Dec  9 05:40:36 UTC 2011

查看hbase状态

hbase(main):004:0> status
2 servers, 0 dead, 1.0000 average load

查看hbase版本

hbase(main):005:0> version
0.90.5, r1212209, Fri Dec  9 05:40:36 UTC 2011

help命令

hbase(main):006:0> help
HBase Shell, version 0.90.5, r1212209, Fri Dec  9 05:40:36 UTC 2011
Type 'help "COMMAND"', (e.g. 'help "get"' -- the quotes are necessary) for help on a specific command.
Commands are grouped. Type 'help "COMMAND_GROUP"', (e.g. 'help "general"') for help on a command group.

COMMAND GROUPS:
  Group name: general
  Commands: status, version

  Group name: ddl
  Commands: alter, create, describe, disable, drop, enable, exists, is_disabled, is_enabled, list

  Group name: dml
  Commands: count, delete, deleteall, get, get_counter, incr, put, scan, truncate

  Group name: tools
  Commands: assign, balance_switch, balancer, close_region, compact, flush, major_compact, move, split, unassign, zk_dump

  Group name: replication
  Commands: add_peer, disable_peer, enable_peer, remove_peer, start_replication, stop_replication

SHELL USAGE:
Quote all names in HBase Shell such as table and column names.  Commas delimit
command parameters.  Type <RETURN> after entering a command to run it.
Dictionaries of configuration used in the creation and alteration of tables are
Ruby Hashes. They look like this:

  {'key1' => 'value1', 'key2' => 'value2', ...}

and are opened and closed with curley-braces.  Key/values are delimited by the
'=>' character combination.  Usually keys are predefined constants such as
NAME, VERSIONS, COMPRESSION, etc.  Constants do not need to be quoted.  Type
'Object.constants' to see a (messy) list of all constants in the environment.

If you are using binary keys or values and need to enter them in the shell, use
double-quote'd hexadecimal representation. For example:

  hbase> get 't1', "key\x03\x3f\xcd"
  hbase> get 't1', "key\003\023\011"
  hbase> put 't1', "test\xef\xff", 'f1:', "\x01\x33\x40"

The HBase shell is the (J)Ruby IRB with the above HBase-specific commands added.
For more on the HBase Shell, see http://hbase.apache.org/docs/current/book.html

© 著作权归作者所有

MT少年
粉丝 6
博文 62
码字总数 26478
作品 0
杭州
程序员
私信 提问
【HBase】 - 单机模式、伪分布式、完全分布式配置

Hbase 简介 Hbase: Hadoop Database Hbase是非关系型数据库,随着现在互联网的数据量越来越多,需求更加多元化,传统的关系型数据库无法满足实际的业务需求,NoSql类型数据库孕育而生。 传统...

ZeroneLove
02/25
17
0

没有更多内容

加载失败,请刷新页面

加载更多

没有更多内容

Excption与Error包结构,OOM 你遇到过哪些情况,SOF 你遇到过哪些情况

Throwable 是 Java 中所有错误与异常的超类,Throwable 包含两个子类,Error 与 Exception 。用于指示发生了异常情况。 Java 抛出的 Throwable 可以分成三种类型。 被检查异常(checked Exc...

Garphy
20分钟前
2
0
计算机实现原理专题--二进制减法器(二)

在计算机实现原理专题--二进制减法器(一)中说明了基本原理,现准备说明如何来实现。 首先第一步255-b运算相当于对b进行按位取反,因此可将8个非门组成如下图的形式: 由于每次做减法时,我...

FAT_mt
昨天
6
0
好程序员大数据学习路线分享函数+map映射+元祖

好程序员大数据学习路线分享函数+map映射+元祖,大数据各个平台上的语言实现 hadoop 由java实现,2003年至今,三大块:数据处理,数据存储,数据计算 存储: hbase --> 数据成表 处理: hive --> 数...

好程序员官方
昨天
7
0
tabel 中含有复选框的列 数据理解

1、el-ui中实现某一列为复选框 实现多选非常简单: 手动添加一个el-table-column,设type属性为selction即可; 2、@selection-change事件:选项发生勾选状态变化时触发该事件 <el-table @sel...

everthing
昨天
6
0
【技术分享】TestFlight测试的流程文档

上架基本需求资料 1、苹果开发者账号(如还没账号先申请-苹果开发者账号申请教程) 2、开发好的APP 通过本篇教程,可以学习到ios证书申请和打包ipa上传到appstoreconnect.apple.com进行TestF...

qtb999
昨天
10
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部