Hbase是一个分布式的实时数据库,他可以基于hadoop的hdfs,S3等分布式存储系统。而且使用zookeeper来通信(查询元数据和获取数据所在位置等功能)
本文的Hbase使用的是hadoop的hdfs和外部的zookeeper。在这里假设你已经搭建好hadoop和zookeeper。
 
Hbase搭建过程:
1.修改hbase-env.xml文件
export JAVA_HOME=/home/liangjf/app/jdk1.8.0_144     #java安装的根目录
export HBASE_MANAGES_ZK=false #false-使用非hbase自带的zookeeper。true-使用hbase自带的zookeeper
 
2.修改hbase-size.xml文件
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://master:9000/hbase</value>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value> #指明使用完全分布式 false-单机或伪分布式
</property>
<property>
<name>zookeeper.znode.parent</name>
<value>/hbase</value> #注意点1
</property>
<property>
<name>hbase.master</name>
<value>hdfs://master:60000</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>master,slave1</value>
</property>
<property>
<name>dfs.datanode.max.xcievers</name>
<value>4096</value>
</property>
</configuration>
注意点1:hbase是使用zookeeper来完成其功能的。所以肯定是在zookeeper上创建一个节点来存放其必须的信息。因此在启动hbase客户端的之前,必须在zookeeper上创建一个目录来保存数据。这里是/hbase(实际上这里的名字是随意的,不过为了方便使用了/hbase)。
步骤:
进入zookeeper/bin,执行命令 
[liangjf@master bin]$./zkCli.sh
[zk: localhost:2181(CONNECTED) 0] ls /
[zookeeper]
[zk: localhost:2181(CONNECTED) 0] create /hbase "123"
[zk: localhost:2181(CONNECTED) 0] ls /
[zookeeper, hbase]
如果缺少在zookeeper上创建 /hbase这一步( create /hbase "123" ),在使用的时候会出现以下错误。在这里吐槽一下,网上出现这个错误的解决办法真少。
hbase(main):001:0> list
TABLE
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/liangjf/app/hbase-0.98.0-hadoop1/lib/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/liangjf/app/hadoop-1.2.1/lib/slf4j-log4j12-1.4.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
2017-11-18 10:07:38,240 ERROR [main] client.HConnectionManager$HConnectionImplementation: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master.
2017-11-18 10:07:38,344 ERROR [main] client.HConnectionManager$HConnectionImplementation: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master.
2017-11-18 10:07:38,553 ERROR [main] client.HConnectionManager$HConnectionImplementation: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master.
2017-11-18 10:07:38,863 ERROR [main] client.HConnectionManager$HConnectionImplementation: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master.
2017-11-18 10:07:39,369 ERROR [main] client.HConnectionManager$HConnectionImplementation: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master
 
3.分发整个hbase目录到各节点
scp -r /home/liangjf/app/hbase-0.98.0-hadoop1 liangjf@slave1:/home/liangjf/app

 

4.启动hbase
进入 /hbase-0.98.0-hadoop1/bin/ 下, ./start-hbase.sh 
 
5.启动hbase客户端
进入 /hbase-0.98.0-hadoop1/bin/ 下, 执行命令 hbase shell ,进入shell客户端。
 
6.测试
hbase(main):006:0> create 'member','address','info'
0 row(s) in 0.7770 seconds
=> Hbase::Table - member hbase(main):009:0> list
TABLE
member
1 row(s) in 0.0410 seconds
=> ["member"] hbase(main):015:0> describe 'member'
DESCRIPTION ENABLED
'member', {NAME => 'address', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DE true
LETED_CELLS => 'false', DATA_BLOCK_ENCODING => 'NONE', TTL => '2147483647', COMPRESSION => 'NONE',
MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}, {NAME
=> 'info', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'fa
lse', DATA_BLOCK_ENCODING => 'NONE', TTL => '2147483647', COMPRESSION => 'NONE', MIN_VERSIONS => '
0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}
1 row(s) in 0.0560 seconds hbase(main):022:0> put'member','zhangsan','info:age','24'
0 row(s) in 0.1560 seconds
hbase(main):023:0> put'member','lisi','info:birthday','1994-01-01'
0 row(s) in 0.0120 seconds hbase(main):038:0> scan 'member'
ROW COLUMN+CELL
zhangsan column=info:age, timestamp=1511029691288, value=24
lisi column=info:birthday, timestamp=1511029538058, value=1994-01-01
 

Hbase0.98.0完全分布式搭建---【使用外部zookeeper】的更多相关文章

  1. HBase-0.98.0和Phoenix-4.0.0分布式安装指南

    目录 目录 1 1. 前言 1 2. 约定 2 3. 相关端口 2 4. 下载HBase 2 5. 安装步骤 2 5.1. 修改conf/regionservers 2 5.2. 修改conf/hba ...

  2. bayaim_hadoop1_2.2.0伪分布式搭建

    ------------------bayaim_hadoop1_2.2.0伪分布式搭建_2018年11月06日09:21:46--------------------------------- 1. ...

  3. hbase-0.98.1-cdh5.1.0 完全分布式搭建

    cdh版与0.98版的配置一样 1.环境 master:c1 slave:c2,c3 CentOS 6.5 x64 ,hadoop-2.3.0-cdh5.1.0,zookeeper-3.4.5-cdh ...

  4. spark1.6.0伪分布式搭建

    环境: hadoop2.6.0 jdk1.8 ubuntu 14.04 64位 1 安装scala环境 版本是scala-2.10.6,官网下载地址http://www.scala-lang.org/ ...

  5. Hadoop2.6.0 完全分布式搭建

    1 搭建这个完全分布式的前提环境: 配置好了jdk环境 配置好了ssh免密码登录(详见我的另外一篇博客,专门说ssh免密码登录) 我这里设置了四台机器,一台做master,另外三台做slave,hos ...

  6. hadoop2.4.0伪分布式搭建以及分布式关机重启后datanode没起来的解决办法

    1.准备Linux环境 1.0点击VMware快捷方式,右键打开文件所在位置 -> 双击vmnetcfg.exe -> VMnet1 host-only ->修改subnet ip ...

  7. hadoop-2.3.0-cdh5.1.0完全分布式搭建(基于centos)

    先参考:<hadoop-2.3.0-cdh5.1.0伪分布安装(基于centos)> http://blog.csdn.net/jameshadoop/article/details/39 ...

  8. hadoop2.2.0伪分布式搭建3--安装Hadoop

    3.1上传hadoop安装包 3.2解压hadoop安装包 mkdir /cloud #解压到/cloud/目录下 tar -zxvf hadoop-2.2.0.tar.gz -C /cloud/ 3 ...

  9. hadoop2.2.0伪分布式搭建1--准备Linux环境

    1.0修改网关 点击VMware快捷方式,右键打开文件所在位置 -> 双击vmnetcfg.exe -> VMnet1 host-only ->修改subnet ip 设置网段:19 ...

随机推荐

  1. Changing Controller Numbers in Solaris

    If you need to change the controller numbers (c#) that a disk has assigned to it, whether it is for ...

  2. 类型:。net;问题:HQL;结果:HQL: Hibernate查询语言

    HQL: Hibernate查询语言 Hibernate配备了一种非常强大的查询语言,这种语言看上去很像SQL.但是不要被语法结构 上的相似所迷惑,HQL是非常有意识的被设计为完全面向对象的查询,它可 ...

  3. C# WinForm 关闭登陆窗体后进程还再内存怎么办?

    问题:我们通常再制作WinForm应用程序的时候,运行程序的第一个窗口一般是登陆窗口.代码如下: 那么这种方式有一个弊端,这种启动方式,其实就是把登陆窗口设置为主窗体.因此,再登陆后,我们通常是调用H ...

  4. php中COM函数的使用

    php里的com类可以操作window系统上的东西 例如:可以在本地打开一个word文档,然后写入东西,只用于window系统 需要加载php_com_dotnet.dll模块   $word = n ...

  5. gym - 101673I Twenty Four, Again (表达式树枚举)

    题意及思路 模拟场上用一般方法枚举非常麻烦,一个小时没写出来,还是自己太菜了...用表达式树枚举有一个好处,判断需不需要加括号非常方便,只有当前节点运算符的优先级高于子节点的时候,才需要给子节点加一个 ...

  6. 通过iOS中的按钮来触发html文件中按钮所触发的函数

    html文件的代码 <!DOCTYPE html> <html> <head> <title>标题</title> </head> ...

  7. 算法Sedgewick第四版-第1章基础-1.4 Analysis of Algorithms-002如何改进算法

    1. package algorithms.analysis14; import algorithms.util.In; import algorithms.util.StdOut; /******* ...

  8. Eclipse报错could not write metadata for '/remotesystemstempfiles'

    1. windows-Preferences  中,在search中输入remote,取消选中reopen remote systems view to previous state'. 2. win ...

  9. 如何使用ArcPy

    ArcPy可以很方便的通过脚本调用ArcGIS的各种函数和功能.在此简单介绍一下.方法包括两种,第一种是直接使用ArcGIS中的命令行,输入一句,执行一句:第二种是创建一个Python脚本,直接执行其 ...

  10. [译]Javascript中闭包的各种例子

    本文翻译youtube上的up主kudvenkat的javascript tutorial播放单 源地址在此: https://www.youtube.com/watch?v=PMsVM7rjupU& ...