Hadoop+Ubuntu 学习笔记
——IT 进行时(zhengxianquan AT hotmail )
环备一、境准
Hadoop-0.20.1
Ubuntu 9.10
二、安装JDK6
开终执打端,行以下命令:
sudo apt-get install sun-java6-jdk
按照提示做就是了。
配置JAVA 环变境量:
sudo gedit /etc/environment
在其中添加如下两行:
CLASSPATH=.:/usr/lib/jvm/java-6-sun/lib
JAVA_HOME=/usr/lib/jvm/java-6-sun
执行命令:sudo gedit /etc/jvm,在最前面加入:
/usr/lib/jvm/java-6-sun
三、配置SSH
见方便起,新增hadoop 组户的及其同名用:
zhengxq@zhengxq-desktop:~$ sudo addgroup hadoop
zhengxq@zhengxq-desktop:~$ sudo adduser --ingroup hadoop hadoop  别则请接下来需要做些特的工作(否参考FAQ“xx is not in the sudoers file”):  hadoop@zhengxq-desktop:~$ su
root@zhengxq-desktop:/home/hadoop# ls -l /etc/sudoers
-r--r----- 1 root root 557 2009-11-10 22:01 /etc/sudoers
root@zhengxq-desktop:/home/hadoop# chmod u+w /etc/sudoers
root@zhengxq-desktop:/home/hadoop# ls -l /etc/sudoers
-rw-r----- 1 root root 557 2009-11-10 22:01 /etc/sudoers
root@zhengxq-desktop:/home/hadoop# gedit /etc/sudoers
在root ALL=(ALL) ALL后面添加:hadoop ALL=(ALL) ALL
root@zhengxq-desktop:/home/hadoop# chmod u-w /etc/sudoers
root@zhengxq-desktop:/home/hadoop# exit
安装openssh-server:
$ sudo apt-get install openssh-server
建立SSH KEY:
zhengxq@zhengxq-desktop:~$ su hadoop
hadoop@zhengxq-desktop:/home/zhengxq$ ssh-keygen -t rsa -P ""
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hadoop/.ssh/id_rsa):
Created directory '/home/hadoop/.ssh'.
Your identification has been saved in /home/hadoop/.ssh/id_rsa.
Your public key has been saved in /home/hadoop/.ssh/id_rsa.pub.
The key fingerprint is:
f4:5f:6a:f4:e5:bf:1d:c8:08:28:1c:88:b4:31:4a:a0 hadoop@zhengxq-desktop ……
启用SSH KEY:
hadoop@zhengxq-desktop:~$ cat $HOME/.ssh/id_rsa.pub >>
$HOME/.ssh/authorized_keys
hadoop@zhengxq-desktop:~$ sudo /etc/init.d/ssh reload
* Reloading OpenBSD Secure Shell server's configuration sshd                      [ OK ]
验证SSH的配置:
hadoop@zhengxq-desktop:~$ ssh localhost
The authenticity of host 'localhost (::1)' can't be established.
RSA key fingerprint is 52:9b:e2:62:93:01:88:e6:46:a8:16:68:52:91:8a:ea.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (RSA) to the list of known hosts.
Linux zhengxq-desktop 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16
14:04:26 UTC 2009 i686
……
四、安装配置hadoop
下及安装
4.1载
下一个0.20.1版本;
到/i/hadoop/core/载
下,并改所有者hadoop:
tar压缩
或者直接解到/usr/local/hadoop/变为
zhengxq@zhengxq-desktop:/usr/local$ sudo chown -R hadoop:hadoop hadoop
4.2配置
4.2.1配置$HADOOP_HOME/conf/hadoop-env.sh
zhengxq@zhengxq-desktop:/usr/local/hadoop$ cd had*
zhengxq@zhengxq-desktop:/usr/local/hadoop/hadoop-0.20.1$ gedit conf/hadoop-
env.sh
zhengxq@zhengxq-desktop:/usr/local/hadoop/hadoop-0.20.1$ sudo gedit
conf/hadoop-env.sh
修改点:
export JAVA_HOME=/usr/lib/jvm/java-6-sun
4.2.2配置$HADOOP_HOME/l
zhengxq@zhengxq-desktop:/usr/local/hadoop/hadoop-0.20.1$ sudo gedit
l
空的,内容加上:
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
<property>
<name&plication</name>
<value>1</value>
</property>
<property>
<name&p.dir</name>
<value>/home/hadoop/tmp</value>
</property>
</property>
注:如没有配置p.dir时统认临时录为
参数,此系默的目:/tmp/hadoop-
才行,否会出。
。而个目在次重启后都会被干掉,必重新行format则错hadoop这录每须执
4.2.3配置$HADOOP_HOME/l
同l。
加上:
<property>
<name>acker</name>
<value>localhost:9001</value>
</property>
4.2.4格式化namenode
zhengxq@zhengxq-desktop:/usr/local/hadoop/hadoop-0.20.1$ ./bin/hadoop namenode -format
启及
4.3动验证
启命令:
hadoop@zhengxq-desktop:/usr/local/hadoop/hadoop-0.20.1$ ./bin/start-all.sh
验证。方法一:
hadoop@zhengxq-desktop:/usr/local/hadoop/hadoop-0.20.1$ jps
6605 TaskTracker
6707 Jps
6447 JobTracker
6385 SecondaryNameNode
6109 NameNode
hadoop@zhengxq-desktop:/usr/local/hadoop/hadoop-0.20.1$
方法二:
hadoop@zhengxq-desktop:/usr/local/hadoop/hadoop-0.20.1$ bin/hadoop dfsadmin -report
Configured Capacity: 4995207168 (4.65 GB)
Present Capacity: 1255460864 (1.17 GB)
DFS Remaining: 1252446208 (1.17 GB)
DFS Used: 3014656 (2.88 MB)
DFS Used%: 0.24%hadoop安装详细步骤linux
Under replicated blocks: 6

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。