Hadoop2.7.1+Hbase1.1.2集群环境搭建(4)hbase安装准备

(1)hadoop2.7.1源码编译           http://zilongzilong.iteye.com/blog/2246856

(2)hadoop2.7.1安装准备           http://zilongzilong.iteye.com/blog/2253544

(3)hadoop2.7.1安装                   http://zilongzilong.iteye.com/blog/2245547

(4)hbase安装准备                   http://zilongzilong.iteye.com/blog/2254451

(5)hbase安装                   http://zilongzilong.iteye.com/blog/2254460

(6)snappy安装                   http://zilongzilong.iteye.com/blog/2254487

(7)雅虎YCSBC测试hbase性能测试     http://zilongzilong.iteye.com/blog/2248863

 

(8)spring-hadoop实战                   http://zilongzilong.iteye.com/blog/2254491

1.hadoop环境安装

       hbase是建立在Hadoop之上的一个NOSQL数据库,所以你得首先安装Hadoop,安装Hadoop参见http://zilongzilong.iteye.com/blog/2245547

2.zookeeper3.4.6集群安装

       1,hbase regionserver 向zookeeper注册,提供hbase regionserver状态信息(是否在线)

       2,hmaster启动时候会将hbase 系统表-ROOT- 加载到 zookeeper cluster,通过zookeeper cluster可以获取当前系统表.META.的存储所对应的regionserver信息。

1) 下载解压

下载zookeeper-3.4.6.tar.gz到/opt

解压tar -zxvf zookeeper-3.4.6.tar.gz

2) 配置/etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1               localhost.localdomain localhost

::1             localhost6.localdomain6 localhost6

192.168.186.234         inddb1-vip

192.168.186.235         inddb2-vip

192.168.88.22 nmsc2

192.168.88.21 nmsc1

192.168.181.66 nmsc0

3) 创建zookeeper数据文件

sudo rm -r /home/hadoop/zookeeper

cd  /home/hadoop

mkdir zookeeper

4) 配置zoo.cfg

将zookeeper-3.3.4/conf目录下面的 zoo_sample.cfg修改为zoo.cfg,配置文件内容如下所示

# The number of milliseconds of each tick

tickTime=2000

# 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.

# do not use /tmp for storage, /tmp here is just

# example sakes.

dataDir=/home/hadoop/zookeeper

# the port at which the clients will connect

clientPort=2181

# the maximum number of client connections.

# increase this if you need to handle more clients

#maxClientCnxns=60

#

# Be sure to read the maintenance section of the

# administrator guide before turning on autopurge.

#

# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance

#

# The number of snapshots to retain in dataDir

#autopurge.snapRetainCount=3

# Purge task interval in hours

# Set to "0" to disable auto purge feature

#autopurge.purgeInterval=1

server.1=nmsc0:2888:3888

server.2=nmsc1:2888:3888

server.3=nmsc2:2888:3888

5) 远程复制分发安装文件

scp -r /opt/zookeeper-3.3.4 root@nmsc1:/opt/

scp -r /opt/zookeeper-3.3.4 root@nmsc2:/opt/

6) 设置myid必须为数字

ssh nmsc0

echo "1" > /home/hadoop/zookeeper/myid  

ssh nmsc1

echo "2" > /home/hadoop/zookeeper/myid  

ssh nmsc2

echo "3" > /home/hadoop/zookeeper/myid  

7) 启动ZooKeeper集群

cd /opt/zookeeper-3.4.6

bin/zkServer.sh start  

8) 查看单机ZooKeeper是leader还是follower

cd /opt/zookeeper-3.4.6

bin/zkServer.sh status 

9) 停止ZooKeeper集群

cd /opt/zookeeper-3.4.6

bin/zkServer.sh stop 

 

3.时间同步

      注意:集群中机器时间同步很关键,时间最好相差在1秒以下,不然hbase启动会失败

方法一

安装NTP服务,参见http://wenku.baidu.com/link?url=0outiNUpCi-RzCtmWCKgqyVE0S_hyEcc3cjfbes_XHtxDN4wCh3-TXAe8YrtW1iOudzloNbMRMFe6niTS_uODhWEdPjD7MEwimib1a02FVm

 

方法二

我这是公司内部有时间同步的机器,直接从该机器同步数据,执行命令如下:

#从机器192.168.162.23同步系统时间

ntpdate -u 192.168.162.23

 

你可能感兴趣的:(hbase,安装准备)