1.添加hadoop用户
1 | [root@hadoop-01 ~]# useradd hadoop |
2.上传并解压
1 | [root@hadoop-01 software]# rz #上传hadoop-2.8.1.tar.gz |
3.软连接
1 | [root@hadoop-01 software]# ln -s /opt/software/hadoop-2.8.1 /opt/software/hadoop |
4.设置环境变量
1 | [root@hadoop-01 software]# vi /etc/profile |
5.设置用户、用户组
1 | [root@hadoop-01 software]# chown -R hadoop:hadoop hadoop |
6.切换hadoop用户
1 | [root@hadoop-01 software]# su - hadoop |
7.配置文件
1 | [hadoop@hadoop-01 ~]# cd /opt/software/hadoop |
8.配置hadoop用户的ssh信任关系
8.1公钥/密钥 配置无密码登录
1 | [hadoop@hadoop-01 ~]# ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa |
8.2 查看日期,看是否配置成功
1 | [hadoop@hadoop-01 ~]# ssh hadoop-01 date |
9.格式化和启动
1 | [hadoop@hadoop-01 hadoop]# bin/hdfs namenode -format |
9.1解决方法:添加环境变量
1 | [hadoop@hadoop-01 hadoop]# vi etc/hadoop/hadoop-env.sh |
1 | [hadoop@hadoop-01 hadoop]# sbin/start-dfs.sh |
9.2解决方法:添加权限
1 | [hadoop@hadoop-01 hadoop]# exit |
9.3 继续启动
1 | [hadoop@hadoop-01 hadoop]# sbin/start-dfs.sh |
9.4检查是否成功
1 | [hadoop@hadoop-01 hadoop]# jps |
9.5访问: http://192.168.137.130:50070
9.6修改dfs启动的进程,以hadoop-01启动
启动的三个进程:
namenode: hadoop-01 bin/hdfs getconf -namenodes
datanode: localhost datanodes (using default slaves file) etc/hadoop/slaves
secondarynamenode: 0.0.0.0
1 |
|
9.7重启
1 | [hadoop@hadoop-01 hadoop]# sbin/stop-dfs.sh |