hadoop基本配置完成。在终端中键入hadoop-1.0.3/bin/hadoop namenode -format,没有出现错误提示则成功。
启动hadoop集群,终端键入
hadoop-1.0.3/bin/start-all.sh
出现以下一些信息
Warning: $HADOOP_HOME is deprecated.
starting namenode, logging to /home/martin/hadoop-1.0.3/logs/hadoop-martin-namenode-ubuntu.out
localhost: Warning: $HADOOP_HOME is deprecated.
localhost:
localhost: starting datanode, logging to /home/martin/hadoop-1.0.3/logs/hadoop-martin-datanode-ubuntu.out
localhost: Warning: $HADOOP_HOME is deprecated.
localhost:
localhost: starting secondarynamenode, logging to /home/martin/hadoop-1.0.3/logs/hadoop-martin-secondarynamenode-ubuntu.out
starting jobtracker, logging to /home/martin/hadoop-1.0.3/logs/hadoop-martin-jobtracker-ubuntu.out
localhost: Warning: $HADOOP_HOME is deprecated.
localhost:
localhost: starting tasktracker, logging to /home/martin/hadoop-1.0.3/logs/hadoop-martin-tasktracker-ubuntu.out
查看jps,则可见如下几项。
jpmartin@ubuntu:~$ jps
3452 Jps
3050 JobTracker
2956 SecondaryNameNode
3402 TaskTracker
2222 NameNode
2593 DataNode
使用hadoop前需要格式化namenome,在终端中输入
hadoop-1.0.3/bin/hadoop fs -put conf路径(这里是conf文件夹的路径,我的是/home/martin/hadoop-1.0.3/conf,最好给出绝对路径) input
hadoop-1.0.3/bin/hadoop fs -ls
如果没有出现错误提示,则表明成功了,否则查看配置是否有错。 3.ssh服务安装与配置
在终端键入:
sudo apt-get install openssh-server
安装完成后,配置SSH无密码连接
$ssh-keygen -t dsa -P ‘’ -f ~/.ssh/id_dsa
$cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
$chmod 400 ~/.ssh/authorized_keys
输入ssh localhost后有如下内容:
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)
* Documentation: https://help.ubuntu.com/
0 packages can be updated.
0 updates are security updates.
Last login: Fri Aug 24 11:14:20 2012 from localhost
表示ssh服务安装成功。 4.hbase安装与配置
将hbase-0.92.0.tar.gz拷贝到主文件下,也就是hadoop-1.0.3的位置。在终端输入
tar xzvf hbase-0.92.1.tar.gz
此时会得到hbase-0.92.0的文件夹。打开hbase-0.92.0下的conf文件,配置hbase数据库
打开hbase-env.sh文件,在末尾添加
export JAVA_HOME=/usr/lib/jvm/jdk1.6.0_33
export HBASE_HOME=/home/martin/hbase-0.92.0
export PATH=$PATH:/home/martin/hbase-0.92.0/bin
打开hbase-site.xml文件,加入
hbase.rootdir
file:///home/martin/hbase-0.92.0
hbase.cluster.distributed
true
hbase.zookeeper.quorum
localhost
zookeeper.session.timeout
60000
hbase.zookeeper.property.clientPort
2181
重启电脑,启动hbase服务,在终端键入
hbase-0.92.0/bin/start-hbase.sh
屏幕会出现
martin@ubuntu:~$ hbase-0.92.0/bin/hbase shell
HBase Shell; enter 'help' for list of supported commands.
Type "exit" to leave the HBase Shell
Version 0.92.0, r1231986, Mon Jan 16 13:16:35 UTC 2012
hbase(main):001:0>
查看hbase是否可用,可键入
status
屏幕出现
1 servers, 0 dead, 4.0000 average load
这表明hbase数据库可用,继续进行。。。
5.zookeeper安装与配置
下载zookeeper-3.4.2.tar.gz,这个软件包是hbase要求的版本号,为了避免莫名奇妙的错误,我尽量采用相关的版本号。特别说明一下,hive-0.9.0要求的zookeeper版本号是3.4.3,但是我使用的是3.4.2,不过也没有出错,也就没有管了。
终端中键入
tar xzvf zookeeper-3.4.2
安装完成后,打开zookeeper-3.4.2文件夹下的conf文件夹,里面有3个文件,将zoo-sample.cfg更名为zookeeper.cfg,内容不做任何改动。