hbase安装及程序调试的一些问题

目前测试下来,稳定并兼容的版本是hadoop0.20.2+hbase0.90.5

安装过程:
    首先在各节点安装hadoop0.20.2。
    hadoop-site.xml
        <configuration>
<property>
  <name>dfs.replication</name>
  <value>2</value>
  <description>Default block replication.
  The actual number of replications can be specified when the file is created.
  The default is used if replication is not specified in create time.
  </description>
</property>

<property>
 <name>dfs.support.append</name>
 <value>true</value>
</property>

<property>
 <name>dfs.datanode.max.xcievers</name>
 <value>4096</value>
 <value></value>
</property>

</configuration>

mapred-site.xml
<configuration>
<property>
  <name>mapred.job.tracker</name>
  <value>xxxxxx.xxx.22154311</value>
  <description>The host and port that the MapReduce job tracker runs
  at.  If "local", then jobs are run in-process as a single map
  and reduce task.
  </description>
</property>

<property>
  <name>mapred.map.tasks</name>
  <value>20</value>
  <description>The host and port that the MapReduce job tracker runs
  at.  If "local", then jobs are run in-process as a single map
  and reduce task.
  </description>
</property>

<property>
  <name>mapred.reduce.tasks</name>
  <value>6</value>
  <description>The host and port that the MapReduce job tracker runs
  at.  If "local", then jobs are run in-process as a single map
  and reduce task.
  </description>
</property>


</configuration>

hdfs-site.xml
<configuration>
<property>
  <name>dfs.replication</name>
  <value>2</value>
  <description>Default block replication.
  The actual number of replications can be specified when the file is created.
  The default is used if replication is not specified in create time.
  </description>
</property>

<property>
 <name>dfs.support.append</name>
 <value>true</value>
</property>

<property>
 <name>dfs.datanode.max.xcievers</name>
 <value>4096</value>
 <value></value>
</property>

</configuration>

core-site.xml
<configuration>
<property>
  <name>hadoop.tmp.dir</name>
  <value>/data/hadoop/tmp</value>
  <description>A base for other temporary directories.</description>
</property>

<property>
  <name>fs.default.name</name>
  <value>hdfs://xxx.xxxxxx.221:54310</value>
  <description>The name of the default file system.  A URI whose
  scheme and authority determine the FileSystem implementation.  The
  uri's scheme determines the config property (fs.SCHEME.impl) naming
  the FileSystem implementation class.  The uri's authority is used to
  determine the host, port, etc. for a filesystem.</description>
</property>
</configuration>

    安装好hadoop0.20.2之后,安装zookeeper3.3.2,按xxx.xxx.xxx.221上zookeeper中conf/zoo.cfg文件配置方式配置,配置成功,拷贝其他几台节点,注意建立起myid
    在各节点的/data/zookeeper-3.3.2/data下建立起myid,myid的内容和server.x中的x对应,比如xxx.xxx.xxx.193对应的myid的内容是1
    zoo.cfg
    
    # The number of milliseconds of each tick
tickTime=3000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
dataDir=/data/zookeeper-3.3.2/data
dataLogDir=/data/zookeeper-3.3.2/logs
# the port at which the clients will connect
clientPort=2181
server.1=xxx.xxx.xxx.193:2888:3888
server.2=xxx.xxx.xxx.194:2888:3888
server.3=xxx.xxx.xxx.221:2888:3888


    安装好zookeeper后,安装hbase,配置hbase-site.xml,注意hbase.zookeeper.quorum的值必须是奇数个
    hbase-site.xml
    <configuration>
     <property>  
    <name>hbase.rootdir</name>  
    <value>hdfs://hostname:54310/hbase</value>  
    <description>The directory shared by RegionServers.  must be hostname ,it will error if ip
    </description>  
  </property>  
  <property>  
    <name>hbase.cluster.distributed</name>  
    <value>true</value>  
    <description>The mode the cluster will be in. Possible values are  
      false: standalone and pseudo-distributed setups with managed Zookeeper  
      true: fully-distributed with unmanaged Zookeeper Quorum (see hbase-env.sh)  
    </description>  
  </property>  
  <property>  
    <name>dfs.support.append</name>  
    <value>true</value>
 </property>
  <property>  
    <name>hbase.master.port</name>  
    <value>60000</value>
 </property>
 <property>  
    <name>hbase.zookeeper.property.dataDir</name>  
    <value>/data/john/database1.0/zookeeper-3.3.2</value>
 </property>
 <property>  
    <name>hbase.zookeeper.property.clientPort</name>  
    <value>2181</value>
 </property>
 <property>  
    <name>hbase.zookeeper.quorum</name>  
    <value>xxx.xxx.xxx.193,xxx.xxx.xxx.194,xxx.xxx.xxx.221</value>
    <description>the num of quorum must be odd</description>
 </property>
</configuration>

hbase-env.sh中
<property>
    <name>hbase.cluster.distributed</name>
    <value>true</value>
    <description>The mode the cluster will be in. Possible values are
      false: standalone and pseudo-distributed setups with managed Zookeeper
      true: fully-distributed with unmanaged Zookeeper Quorum (see hbase-env.sh)
    </description>
  </property>
  让Hbase使用一个现有的不被Hbase托管的Zookeep集群,需要设置 conf/hbase-env.sh文件中的HBASE_MANAGES_ZK 属性为 false
    export HBASE_MANAGES_ZK=false
    
 启动hadoop,启动hbase,
 启动hbase步骤:
 1. 首先启动zookeeper:bin/hbase-daemon.sh start zookeeper    
 2. jps一下,看是否有HQuorumPeer进程,没有的话,请查看log解决问题
 3. bin/start-hbase.sh
 
 在hbase中新建了新的数据库,可以在hadoop环境下利用bin/hadoop fs -ls /hbase查看,可以查看到表的名称
 要想知道表的结构,切换到hbase环境,bin/hbase shell  然后利用 describe 表名
 
 
 在安装过程中的问题:
 1. zookeeper节点启动不成功,查看状态后发现有not running,网上的说法是由于脚本中含有nc -q 1导致的,我在安装的过程中发现的解决的方式是:
                 在各节点的/etc/hosts文件中加入各节点的ip hostname,最终解决
 2. 启动hbase不成功,call xxx.xxx.xxx194 xxx的信息,和mismatch异常的问题,是由于当初我选择的hadoop版本是0.20.203,后来换成0.21都不行,最终换成0.20.2问题解决(hbase0.90.5+hadoop0.20.2)
             当然要将hbase中的lib里的hadoop-core-xxx.jar包替换成hadoop中的hadoop-core.jar

 3. 重启hbase是,有台机器的HRegionServer没有启动起来,解决方案:查看一下60020端口是否被占用了,如果没有被占用了,那么同步一下各节点的系统时间,可能是系统时间不同步导致的;如果被占用了,杀死占用的进程,重启hbase,(基本上问题出在系统时间不同步上)



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值