我的经验是最好放在hadoop一块,这样可以做个全盘拷贝与管理。比如之前安装的hadoop在/usr/hadoop目录下,那就把这2个组件放在一 块,比如统一放在:/usr/hadoop/...或 /home/hadoop/...这样以后再有组件也可以放在这里,方便了后续集群的重新部署。为了避开混淆,可以不使用hadoop,如使 用:hdfs,bigdata, cloud,and so on. 1.安装zookeeper,自不必说,需要说明的是配置问题。
(1)在conf目录下,将 zoo_sample.cfg 改名为 zoo.cfg,修改为如下内容:
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 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.
dataDir=/home/hdfs/zookeeper
# the port at which the clients will connect
clientPort=2181
initLimit=5
syncLimit=2
dataLogDir=/home/hdfs/zookeeper/logs
server.1=192.168.1.70:2888:3888
server.2=192.168.1.71:2888:3888
server.3=192.168.1.72:2888:3888
server.4=192.168.1.73:2888:3888
可以通过:http://192.168.1.70:60010/master-status 查看hbase允许状态,也可通过其判断是否成功启动。 4.错误解决及排除
(1)zookeeper遇到的问题:
1)Error contactiong service. It is probably not runnin
查看zookeeper状态时出现:Error contactiong service. It is probably not running
先使用jps查看是否有QuorumPeerMain;
再查看2181端口是否开启: netstat -an | grep 2181
如果这2项都没有问题,原因可能是你只是单机启动,集群中其他计算机并没有启动zookeeper,把集群中其他的启动后再使用此命令。而且此命令功能太过单一,反馈信息也不准确。
(2)Hbase遇到的问题
ERROR: org.apache.hadoop.hbase.MasterNotRunningException: Retried 7 times
问题发生在list 查看表时,通过查看 logs/ 下的日子信息:
stopping hbasecat: /tmp/hbase-mango-master.pid: No such file or directory
发现是HBASE_PID_DIR 没有配置,使用的是默认配置,但是默认配置会在下次启动后自动清除,所以需要手动配置并创建相应的文件。(参考:hbase-env.sh)
(3)hadoop遇到的问题
All directories in dfs.data.dir are invalid
这个问题以前没有遇到过,而且在之前节点启动正常,但这次不知道是何原因。
通过:hadoop dfsadmin -report 发现一个节点没有启动,通过查看此节点的logs信息,发现是文件权限引起的:Invalid directory in dfs.data.dir: Incorrect permission for /hadoop/hadoop-data, expected: rwxr-xr-x, while actual: rwxrwxr-x
更改权限,文件解决:chmod g-w /hadoop/hadoop-data/ (其他节点权限和以前一样却没有出现这问题,好奇怪~~)
Ps:最有效、快速定位错误的方法是看logs,千万不要忽视了哦!