hbase集群安装

并且已经安装成功Hadoop-0.20.2及以上版本。

安装包准备

需要安装包:

zookeeper-3.3.2.tar.gz(stable版本)

hbase-0.20.2.tar.gz(stable版本)

安装步骤

安装和配置ZooKeeper

HBase从0.20.0开始,需要首先安装ZooKeeper。从apache上下载zookeeper-3.2.1.tar.gz(Stable版本),解压到/home/hdfs/目录下。

(1)在namenode节点新建zookeeper目录,在该目录下新建myid文件。

(2)在zookeeper-3.2.1/conf目录下,拷贝zoo_sample.cfg为zoo.cfg。在zoo.cfg中将dataDir改为/home/hdfs/zookeeper,在文件末位添加所有的主机:

server.1=10.192.1.1:2888:3888

server.2=10.192.1.2:2888:3888

server.3=10.192.1.3:2888:3888

 

(3)用scp命令将namenode节点的的/home/hdfs/ zookeeper-3.2.1和/home/hdfs/ zookeeper拷贝到其余所有主机的/home/hdfs目录下。

(4)参照zoo.cfg中的配置,在各主机myid文件中写入各自的编号。如:10.192.1.1入1,10.192.1.2写入2

(5)在所有节点上执行bin/zkServer.sh start,分别启动。

执行bin/zkCli.sh -server xxx.xxx.xxx.xxx:2181,检查指定服务器是否成功启动。


vi /etc/profile
export HBASE_HOME=/hadoop/hbase
export PATH=$PATH:$HBASE_HOME/bin

export HADOOP_HOME=/hadoop/hadoop
export PATH=$PATH:$HADOOP_HOME/bin

 


安装和配置HBase

tar -zxvf hbase-0.20.6.tar.gz

cd hbase-0.20.6

mv * /hadoop/hbase

下载HBase0.20.1版本,解压到namenode节点的/home/hdfs目录下。

配置说明

(1)系统所有配置项的默认设置在hbase-default.xml中查看,如果需要修改配置项的值,在hbase-site.xml中添加配置项。

在分布式模式下安装HBase,需要添加的最基本的配置项如下:

hbase.rootdir

hdfs://hadoop2-namenode:9000/hbase

The directory shared by region servers.

hbase.cluster.distributed

true

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)



      hbase.zookeeper.property.dataDir
      /hadoop/zookeeper
      Property from ZooKeeper's config zoo.cfg.
      The directory where the snapshot is stored.
     
   
 
      hbase.zookeeper.property.clientPort
      2222
      Property from ZooKeeper's config zoo.cfg.
      The port at which the clients will connect.
     
   


      hbase.zookeeper.quorum
      hadoop2-namenode,hadoop2-datanode1,hadoop2-datanode2
      Comma separated list of servers in the ZooKeeper Quorum.
      For example, "host1.mydomain.com,host2.mydomain.com,host3.mydomain.com".
      By default this is set to localhost for local and pseudo-distributed modes
      of operation. For a fully-distributed setup, this should be set to a full
      list of ZooKeeper quorum servers. If HBASE_MANAGES_ZK is set in hbase-env.sh
      this is the list of servers which we will start/stop ZooKeeper on.
     
   


 


(2)在conf/hbase-env.sh中修改添加配置项:
export JAVA_HOME=/usr/java/jdk1.6.0_22

 

 export HBASE_MANAGES_ZK=true


 
export HADOOP_CONF_DIR=/hadoop/hadoop-config


HADOOP_CLASSPATH 要設hbase 的環境,而HBASE_CLASSPATH要設hadoop的環境,有了這行可以解決編譯hbase 程式時出現run time error

并把~/hadoop-0.20.1/conf/hdfs-site.xml拷贝至~/hbase-3.2.1/conf/目录下。

(3)将ZooKeeper的配置文件zoo.cfg添加到HBase所有主机的CLASSPATH中。

(4)在conf/regionservers中添加hadoop-0.20.1/conf/slaves中所有的datanode节点。
hadoop2-datanode1
hadoop2-datanode2

启动

Hadoop、ZooKeeper和HBase之间应该按照顺序启动和关闭:启动Hadoop—>启动ZooKeeper集群—>启动HBase—>停止HBase—>停止ZooKeeper集

群—>停止Hadoop。

在namenode节点执行bin/hbase-daemon.sh,启动master。执行bin/start-hbase.sh和bin/stop-hbase.sh 脚本启动和停止HBase服务。

/hadoop/hbase/bin/hbase-daemon.sh start master
/hadoop/hbase/bin/hbase-daemon.sh stop master
/hadoop/hbase/bin/start-hbase.sh
/hadoop/hbase/bin/stop-hbase.sh


/hadoop/hbase/bin/hbase shell

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8183550/viewspace-683603/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/8183550/viewspace-683603/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值