一、上传解压后的Hbase文件。

二、配置:

1、.bash_profile文件:

export HBASE_HOME=/home/kituser/bigdata/hbase-0.94.6-cdh4.5.0
export CLASSPATH=$CLASSPATH:$HBASE_HOME/lib
export PATH=$PATH:$HBASE_HOME/bin:$HBASE_HOME/sbin

2、regionservers文件

kit-b6
kit-b7

3、hbase-env.sh文件

export JAVA_HOME=/usr/java/jdk1.7.0_45
export HBASE_MANAGES_ZK=true

4、hbase-site.xml文件

<configuration>
    <property>   
       <name>hbase.rootdir</name>  
       <value>hdfs://kit-b5:8020/hbase</value> 
    </property>

<property>   
        <name>hbase.cluster.distributed</name>   
        <value>true</value>  
    </property>

<property>  
        <name>hbase.master</name>  
        <value>kit-b5:60000</value>  
    </property>

<property> 
        <name>hbase.zookeeper.quorum</name> 
        <value>kit-b5,kit-b6,kit-b7</value>
     </property>

<property> 
        <name>hbase.zookeeper.property.clientPort</name> 
        <value>2181</value> 
    </property>

<property> 
 
      <name>hbase.zookeeper.property.dataDir</name> 
      <value>/data/kituser_hadoop_tmp/zookeeper</value> 
      <description>Property fromZooKeeper's config zoo.cfg.  The directory where the snapshot isstored. 
      </description> 
 
    </property>

<property>
         <name>hbase.regionserver.lease.period</name>
         <value>120000</value>
     </property>

<property>
         <name>hbase.rpc.timeout</name>
         <value>120000</value>
     </property>

</configuration>

三、验证Hbase安装

1、启动/停止服务

start-hbase.sh

stop-hbase.sh

hbase shell    //启动shell

2、web界面查看:

http://kit-b5:60010/master.jsp

3、命令:

创建表:create 'member','member_id','address','info'

显示表:list

显示表描述:describe 'member'

禁用表:disable 'member'

删除一个列族:alter'member',{NAME=>'member_id',METHOD=>'delete'}

启用表:enable 'member'

删除表:drop 'member'

查询表是否存在:exists 'member'

判断表是否enabled: is_enabled 'member'

判断表是否disable:is_disabled 'member'

插入记录:

  • put'member','scutshuxue','info:age','24'
  • put'member','scutshuxue','info:birthday','1987-06-17'
  • put'member','scutshuxue','info:company','alibaba'
  • put'member','scutshuxue','address:contry','china'
  • put'member','scutshuxue','address:province','zhejiang'
  • put'member','scutshuxue','address:city','hangzhou'
  • put'member','xiaofeng','info:birthday','1987-4-17'
  • put'member','xiaofeng','info:favorite','movie'
  • put'member','xiaofeng','info:company','alibaba'
  • put'member','xiaofeng','address:contry','china'
  • put'member','xiaofeng','address:province','guangdong'
  • put'member','xiaofeng','address:city','jieyang'
  • put'member','xiaofeng','address:town','xianqiao'

获取一个id的所有数据:get 'member','scutshuxue'

获取一个id,一个列族的所有数据:get 'member','scutshuxue','info'

获取一个id,一个列族中一个列的所有数据:get 'member','scutshuxue','info:age'

修改scutshuxue的年龄为99:put 'member','scutshuxue','info:age' ,'99'

通过timestamp来获取两个版本的数据:

  • get 'member','scutshuxue',{COLUMN=>'info:age',TIMESTAMP=>1321586238965}
  • get 'member','scutshuxue',{COLUMN=>'info:age',TIMESTAMP=>1321586571843}

全表扫描:scan 'member'

删除id为temp的值的'info:age'字段:delete 'member','temp','info:age'

删除整行:deleteall 'member','xiaofeng'

查询表中有多少行:count 'member'

给‘xiaofeng’这个id增加'info:age'字段,并使用counter实现递增:

  • incr 'member','xiaofeng','info:age' COUNTER VALUE = 1
  • incr 'member','xiaofeng','info:age' COUNTER VALUE = 2

将整张表清空:truncate 'member'

四、错误及解决:

1、启动时报Name or service not knownstname错误

解决:记不清了,好像是因为regionservers文件GBK、UTF-8编码不对的问题造成的,应该用UTF-8。

2、HMaster启动后,一会就停止,日志中报如下错误:

2014-06-19 16:44:42,296 INFO org.apache.zookeeper.ClientCnxn: Opening socket connection to server kit-b1/172.16.19.151:2181. Will not attempt to authenticate using SASL (unknown error)
2014-06-19 16:44:42,296 WARN org.apache.zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: 拒绝连接
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068)
2014-06-19 16:44:42,397 INFO org.apache.zookeeper.ClientCnxn: Opening socket connection to server kit-b2/172.16.19.152:2181. Will not attempt to authenticate using SASL (unknown error)
2014-06-19 16:44:42,397 WARN org.apache.zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: 拒绝连接
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068)
2014-06-19 16:44:42,498 INFO org.apache.zookeeper.ClientCnxn: Opening socket connection to server kit-b3/172.16.19.153:2181. Will not attempt to authenticate using SASL (unknown error)
2014-06-19 16:44:42,499 WARN org.apache.zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: 拒绝连接
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068)

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

解决:两种方法:1、运行启动两次start-hbase.sh;2、启动一次start-hbase.sh后,到kit-b2、 kit-b3上手动启动localregionservers.sh命令。我是用第1种生效的。第2种是测试时使用的。

Hbase的安装配置的更多相关文章

  1. Hbase简介安装配置

    HBase —— Hadoop Database的简称 ,hbase 是分布式,稀疏的,持久化的,多维有序映射,它基于行键rowkey,列键column key,时间戳timestamp建立索引.它是 ...

  2. HBase 的安装与配置

    实验简介 本次实验学习和了解 HBase 在不同模式下的配置和安装,以及 HBase 后续的启动和停止等. 一.实验环境说明 1. 环境登录 无需密码自动登录,系统用户名shiyanlou,密码shi ...

  3. Hbase 教程-安装

    HBase安装 安装前设置 安装Hadoop在Linux环境下之前,需要建立和使用Linux SSH(安全Shell).按照下面设立Linux环境提供的步骤. 创建一个用户 首先,建议从Unix创建一 ...

  4. HBase基础和伪分布式安装配置

    一.HBase(NoSQL)的数据模型 1.1 表(table),是存储管理数据的. 1.2 行键(row key),类似于MySQL中的主键,行键是HBase表天然自带的,创建表时不需要指定 1.3 ...

  5. hbase单机环境的搭建和完全分布式Hbase集群安装配置

    HBase 是一个开源的非关系(NoSQL)的可伸缩性分布式数据库.它是面向列的,并适合于存储超大型松散数据.HBase适合于实时,随机对Big数据进行读写操作的业务环境. @hbase单机环境的搭建 ...

  6. hbase安装配置(整合到hadoop)

    hbase安装配置(整合到hadoop) 如果想详细了解hbase的安装:http://abloz.com/hbase/book.html 和官网http://hbase.apache.org/ 1. ...

  7. hbase和ZooKeeper集群安装配置

    一:ZooKeeper集群安装配置 1:解压zookeeper-3.3.2.tar.gz并重命名为zookeeper. 2:进入~/zookeeper/conf目录: 拷贝zoo_sample.cfg ...

  8. hbase单机及集群安装配置,整合到hadoop

    问题导读:1.配置的是谁的目录conf/hbase-site.xml,如何配置hbase.rootdir2.如何启动hbase?3.如何进入hbase shell?4.ssh如何达到互通?5.不安装N ...

  9. 网站用户行为分析——HBase的安装与配置

    Hbase介绍 HBase是一个分布式的.面向列的开源数据库,源于Google的一篇论文<BigTable:一个结构化数据的分布式存储系统>.HBase以表的形式存储数据,表有行和列组成, ...

随机推荐

  1. bzoj 2876: [Noi2012]骑行川藏 拉格朗日数乘

    2876: [Noi2012]骑行川藏 Time Limit: 20 Sec  Memory Limit: 128 MBSec  Special JudgeSubmit: 1033  Solved: ...

  2. hdu 4726

    贪心 不是很难  各种细节注意 #include <cstdio> #include <cstring> #include <algorithm> using na ...

  3. firefly的环境搭建(2013年9月25日最新,win下最详图文)

    源地址:http://www.9miao.com/question-15-53785.html 一.安装PythonFirefly是采用Python编写的高性能.分布式游戏服务器框架,所以使用Fire ...

  4. Python的作用域

    Python的作用域 转自:http://www.cnblogs.com/frydsh/archive/2012/08/12/2602100.html Python是静态作用域语言,尽管它自身是一个动 ...

  5. Objective-C 协议(protocol)

    协议(protocol)是Objective-c中一个非常重要的语言特性,从概念上讲,非常类似于JAVA中接口. 一个协议其实就是一系列有关联的方法的集合(为方便后面叙述,我们把这个协议命名为myPr ...

  6. CURL 多线程问题

    http://blog.csdn.net/wslz2001/article/details/12117127 默认情况下libcurl完成一个任务以后,出于重用连接的考虑不会马上关闭 如果没有新的TC ...

  7. centos更新163源并升级内核

    使用说明 首先备份/etc/yum.repos.d/CentOS-Base.repo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/Cen ...

  8. 简单的神经元算法实现(python)

    参考python代码如下 #perceptron x=[[1 ,0, 0],[1,0,1],[1, 1, 0],[1, 1, 1],[0,0,1],[0,1,0],[0,1,1],[0,0,0]] y ...

  9. MarshalByRefObject浅析

    首先了解一下不同应用程序域中的对象的通信方式有两种: 一种是跨应用程序域边界传输对象副本 一种是使用代理交换消息. 简单来讲,继承此类的对象可以跨越应用程序域边界被引用,甚至被远程引用. 当一个对象需 ...

  10. 【HDOJ】4261 Estimation

    挺不错的一道题,基本思路是dp.关键点是如何求区间内的Sigma|A_i-B_i|.线段树做TLE了,优先队列可以过. /* 4261 */ #include <iostream> #in ...