环境要求java、ssh
添加hadoop用户
-
[root@hadoop- 01 ~] # useradd hadoop
-
[root@hadoop- 01 ~] # vi /etc/sudoers
-
# 找到root ALL=(ALL) ALL,添加
-
hadoop ALL=(ALL) NOPASSWD:ALL
-
上传并解压
-
[root@hadoop-01 software]# rz #上传 hadoop-2 .8 .1 .tar .gz
-
[root@hadoop-01 software]# tar -xzvf hadoop-2 .8 .1 .tar .gz
-
设置环境变量
-
[root@hadoop-01 software] # vi /etc/profile
-
export HADOOP_HOME=/opt/software/hadoop
-
export PATH= $HADOOP_HOME/bin: $HADOOP_HOME/sbin: $PROTOC_HOME/bin: $FINDBUGS_HOME/bin: $MAVEN_HOME/bin: $JAVA_HOME/bin: $PATH
-
[root@hadoop-01 software] # source /etc/profile
-
设置用户用户组
-
[root@hadoop-01 software]# chown -R hadoop :hadoop hadoop-2 .8 .1 /*
-
[root@hadoop-01 software]# chown -R hadoop:hadoop hadoop-2.8.1
-
切换用户hadoop
-
[root@hadoop-01 software]# su - hadoop
-
[root@hadoop-01 hadoop]# ll
-
total 32
-
drwxrwxr-x. 2 hadoop hadoop 4096 Jun 2 14 :24 bin
-
drwxrwxr-x. 3 hadoop hadoop 4096 Jun 2 14 :24 etc
-
drwxrwxr-x. 2 hadoop hadoop 4096 Jun 2 14 :24 include
-
drwxrwxr-x. 3 hadoop hadoop 4096 Jun 2 14 :24 lib
-
drwxrwxr-x. 2 hadoop hadoop 4096 Aug 20 13 :59 libexec
-
drwxr-xr-x. 2 hadoop hadoop 4096 Aug 20 13 :59 logs
-
drwxrwxr-x. 2 hadoop hadoop 4096 Jun 2 14 :24 sbin
-
drwxrwxr-x. 4 hadoop hadoop 4096 Jun 2 14 :24 share
-
-
# bin: 可执行文件
-
# etc: 配置文件
-
# sbin: shell脚本,启动关闭 hdfs, yarn等
-
配置文件
-
[hadoop@hadoop-01 ~]# cd /opt/software/hadoop
-
[hadoop@hadoop-01 hadoop]# vi etc/hadoop/core-site.xml
-
<configuration>
-
<property>
-
<name>fs.defaultFS </name>
-
<value>hdfs://192.168.137.130:9000 </value> # 配置自己机器的IP
-
</property>
-
</configuration>
-
-
[hadoop@hadoop-01 hadoop]# vi etc/hadoop/hdfs-site.xml
-
<configuration>
-
<property>
-
<name>dfs.replication </name>
-
<value>1 </value>
-
</property>
-
</configuration>
-
配置hadoop用户的ssh信任关系
-
-
[hadoop@hadoop -01 ~]
-
[hadoop@hadoop -01 ~]
-
[hadoop@hadoop -01 ~]
-
-
-
[hadoop@hadoop -01 ~]
-
The authenticity of host 'hadoop-01 (192.168.137.130)' can't be established.
-
RSA key fingerprint is 09:f6: 4a:f1:a0:bd: 79:fd: 34:e7: 75: 94: 0b: 3c: 83: 5a.
-
Are you sure you want to continue connecting (yes/no)? yes
-
Warning: Permanently added 'hadoop-01,192.168.137.130' (RSA) to the list of known hosts.
-
Sun Aug 20 14: 22: 28 CST 2017
-
-
[hadoop@hadoop -01 ~]
-
Sun Aug 20 14: 22: 29 CST 2017
-
-
[hadoop@hadoop -01 ~]
-
The authenticity of host 'hadoop-01 (192.168.137.130)' can't be established.
-
RSA key fingerprint is 09:f6: 4a:f1:a0:bd: 79:fd: 34:e7: 75: 94: 0b: 3c: 83: 5a.
-
Are you sure you want to continue connecting (yes/no)? yes
-
Warning: Permanently added 'hadoop-01,192.168.137.130' (RSA) to the list of known hosts.
-
Sun Aug 20 14: 22: 28 CST 2017
-
[hadoop@hadoop -01 ~]
-
Sun Aug 20 14: 22: 29 CST 2017
-
格式化和启动
-
[hadoop@hadoop -01 hadoop]
-
[hadoop@hadoop -01 hadoop]
-
ERROR:
-
hadoop -01: Error: JAVA_HOME is not set and could not be found.
-
localhost: Error: JAVA_HOME is not set and could not be found.
-
解决方法:添加环境变量
-
[hadoop@hadoop -01 hadoop]
-
-
export JAVA_HOME=/usr/java/jdk1 .8.0_45
-
-
[hadoop@hadoop -01 hadoop]
-
ERROR:
-
mkdir: cannot create directory `/opt/software/hadoop -2.8.1/logs ': Permission denied
-
解决方法:
-
[hadoop@hadoop -01 hadoop]
-
[root@hadoop -01 hadoop]
-
[root@hadoop -01 software]
-
[root@hadoop -01 software]
-
[root@hadoop -01 ~]
-
-
-
[hadoop@hadoop -01 hadoop]
-
检查是否成功
-
[hadoop@hadoop- 01 hadoop] # jps
-
19536 DataNode
-
19440 NameNode
-
19876 Jps
-
19740 SecondaryNameNode
-