1.hadoop的僞分佈安裝java
1.1 設置ip地址node
執行命令 service network restart
linux
驗證: ifconfig瀏覽器
1.2 關閉防火牆ssh
執行命令 service iptables stop
oop
驗證: service iptables statusspa
1.3 關閉防火牆的自動運行
rest
執行命令 chkconfig iptables off
code
驗證: chkconfig --list | grep iptablesorm
1.4 設置主機名
執行命令
(1)hostname hadoop
(2)vi /etc/sysconfig/network
1.5 ip與hostname綁定
執行命令 vi /etc/hosts
驗證: ping hadoop
1.6 設置ssh免密碼登錄
執行命令
(1)ssh-keygen -t rsa
(2)cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
驗證: ssh hadoop
1.7 安裝jdk
執行命令
(1)cd /usr/local
(2)chmod u+x jdk-6u24-linux-i586.bin
(3)./jdk-6u24-linux-i586.bin
(4)mv jdk-1.6.0_24 jdk
(5)vi /etc/profile 增長內容以下:
export JAVA_HOME=/usr/local/jdk
export PATH=.:$JAVA_HOME/bin:$PATH
(6)source /etc/profile
驗證: java -version
1.8 安裝hadoop
執行命令
(1)tar -zxvf hadoop-1.1.2.tar.gz
(2)mv hadoop-1.1.2 hadoop
(3)vi /etc/profile 增長內容以下:
export JAVA_HOME=/usr/local/jdk
export HADOOP_HOME=/usr/local/hadoop
export PATH=.:$HADOOP_HOME/bin:$JAVA_HOME/bin:$PATH
(4)source /etc/profile
(5)修改conf目錄下的配置文件hadoop-env.sh、core-site.xml、hdfs-site.xml、mapred-site.xml
1.hadoop-env.sh export JAVA_HOME=/usr/local/jdk/
2.core-site.xml
<configuration> <property> <name>fs.default.name</name> <value>hdfs://hadoop:9000</value> </property> <property> <name>hadoop.tmp.dir</name> <value>/usr/local/hadoop/tmp</value> </property> </configuration>
3.hdfs-site.xml
<configuration> <property> <name>dfs.replication</name> <value>1</value> </property> <property> <name>dfs.permissions</name> <value>false</value> </property> </configuration>
4.mapred-site.xml
<configuration> <property> <name>mapred.job.tracker</name> <value>hadoop:9001</value> </property> </configuration>
(6)hadoop namenode -format
(7)start-all.sh
驗證:
(1)執行命令jps 若是看到5個新的java進程,分別是NameNode、SecondaryNameNode、DataNode、JobTracker、TaskTracker
(2)在瀏覽器查看,http://hadoop:50070 http://hadoop:50030
1.9 啓動時沒有NameNode的可能緣由:
(1)沒有格式化
(2)環境變量設置錯誤
(3)ip與hostname綁定失敗