Hadoop,Hbase,Zookeeper在虚拟机单节点中的整合
近日整合Hadoop,Hbase,Zookeeper时遇到不少问题,经过一番苦战后终于整合成功,现将整合中遇到的一些问题整理一下。
前置说明:
版本:
JDK: 1.6.*
Hadoop: 0.20.2
Hbase: 0.90.4
Zookkeeper: 3.4.3
centOS: CentOS release 5.3
节点数: 1 (虚拟机)
安装配置:
一、安装JDK
二、配置host
修改配置 /etc/hosts 如下:
192.168.0.23 hadoopName
此hostname为hadoop、Hbase、Zookeeper配置文件中共同使用。这一步非常重要。也会涉及到windows中eclipse runonhadoop插件的运行。
二、安装Hadoop
Hadoop安装比较容易,请参考《hadoop权威指南》、陆嘉恒版《hadoop实战》。
三、安装Zookeeper
运行模式为:集群伪分布模式
1、解压Zookeeper,将$ZK_INSTALL/bin加入环境变量。
2、拷贝$ZK_INSTALL/conf下的zoo.example.cfg,分别复制为zoo1.cfg、zoo2.cfg、zoo3.cfg
3、配置zoo*.cfg:
zoo1.cfg
# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.dataDir=/usr/local/zookeeper-3.4.3/snapshot/d_1# the port at which the clients will connectclientPort=2181#the location of the log filedataLogDir=/usr/local/zookeeper-3.4.3/logsserver.[color=red]1[/color]=hadoopName:2887:3887server.[color=red]2[/color]=hadoopName:2888:3888server.[color=red]3[/color]=hadoopName:2889:3889
# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.dataDir=/usr/local/zookeeper-3.4.3/snapshot/d_2# the port at which the clients will connectclientPort=2182#the location of the log filedataLogDir=/usr/local/zookeeper-3.4.3/logsserver.[color=red]1[/color]=hadoopName:2887:3887server.[color=red]2[/color]=hadoopName:2888:3888server.[color=red]3[/color]=hadoopName:2889:3889
# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.dataDir=/usr/local/zookeeper-3.4.3/snapshot/d_3# the port at which the clients will connectclientPort=2183#the location of the log filedataLogDir=/usr/local/zookeeper-3.4.3/logsserver.[color=red]1[/color]=hadoopName:2887:3887server.[color=red]2[/color]=hadoopName:2888:3888server.[color=red]3[/color]=hadoopName:2889:3889
#the location of the log file dataLogDir=/usr/local/zookeeper-3.4.3/[color=red]logs[/color]
2012-02-26 00:06:47,364 [myid:] - INFO [main:QuorumPeerConfig@101] - Reading configuration from: ../conf/zoo3.cfg2012-02-26 00:06:47,372 [myid:] - ERROR [main:QuorumPeerMain@85] - Invalid config, exiting abnormallyorg.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error processing ../conf/zoo3.cfg at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:121) at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:101) at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78)Caused by: [color=red]java.lang.IllegalArgumentException: dataLogDir /usr/local/zookeeper-3.4.3/logs is missing.[/color] at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseProperties(QuorumPeerConfig.java:247) at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:117) ... 2 moreInvalid config, exiting abnormally
<configuration><property> <name>hbase.rootdir</name> <value>hdfs://[color=red]hadoopName[/color]:9000/hbase</value></property><property> <name>hbase.cluster.distributed</name> <value>true</value></property><property> <name>dfs.replication</name> <value>1</value></property><property> <name>hbase.zookeeper.quorum</name> <value>[color=red]hadoopName[/color]</value></property><property> <name>zookeeper.session.timeout</name> <value>60000</value></property>
12/02/26 00:35:02 INFO zookeeper.ClientCnxn: Session establishment complete on server hadoopname/192.168.0.23:2181, sessionid = 0x135b544b002000f, negotiated timeout = 4000012/02/26 00:35:02 INFO client.HConnectionManager$HConnectionImplementation: ZooKeeper available but no active master location found12/02/26 00:35:02 INFO client.HConnectionManager$HConnectionImplementation: getMaster attempt 0 of 1 failed; no more retrying.org.apache.hadoop.hbase.MasterNotRunningException at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getMaster(HConnectionManager.java:357) at org.apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.java:94) at org.apache.hadoop.hbase.master.HMasterCommandLine.stopMaster(HMasterCommandLine.java:163) at org.apache.hadoop.hbase.master.HMasterCommandLine.run(HMasterCommandLine.java:104) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65) at org.apache.hadoop.hbase.util.ServerCommandLine.doMain(ServerCommandLine.java:76) at org.apache.hadoop.hbase.master.HMaster.main(HMaster.java:1078)12/02/26 00:35:02 ERROR master.HMasterCommandLine: Master not running