上次课我们部署的使用的root用户,在生产环境中,不可能给你root用户,我们就创建一个hadoop用户重新部署伪分布式(HDFS)
Hadoop用户重新部署hdfs步骤
1.创建Hadoop用户
-
# useradd hadoop
-
# id hadoop
-
# passwd haddop
-
# vi /etc/sudoers
-
hadoop ALL=(root) NOPASSWD:ALL
2.部署ssh,确保其是运行的
-
查看:默认是已经安装
-
service sshd status
3.删除hadoop之前存储的一些残留文件
-
[root@hadoop- 01 ~] # cd /opt/software
-
[root@hadoop- 01 software] # chown -R hadoop:hadoop hadoop-2.8.1
-
[root@hadoop- 01 software] # kill -9 &(pgrep -f hadoop)
-
[root@hadoop- 01 software] # rm -rf /tmp/hadoop-* /tmp/hsperfdata_*
-
4.配置hadoop用户的ssh的信任关系
-
~]$ ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
-
~]$ cat ~ /.ssh/id_rsa.pub ~ /.ssh/authorized_keys
-
~]$ chmod 0600 ~ /.ssh/authorized_keys
-
.ssh]$ ssh 机器名 date
-
第一次输入需要yes
-
.ssh]$ ssh 机器名 date
-
第二次输入不需要yes
5.修改dfs启动进程用hadoop
第一步:
[hadoop@hadoop-01 hadoop]$ vi hdfs-site.xml
-
<configuration>
-
<property>
-
<name>dfs.replication </name>
-
<value>1 </value>
-
</property>
-
<property>
-
<name>dfs.namenode.secondary.http-address </name>
-
<value> hadoop-01:50090 </value>
-
</property>
-
<property>
-
<name>dfs.namenode.secondary.https-address </name>
-
<value> hadoop-01:50091 </value>
-
</property>
-
</configuration>
-
第二步:
[hadoop@hadoop-01 hadoop]$ vi core-site.xml
-
<configuration>
-
<property>
-
<name>fs.defaultFS </name>
-
<value>hdfs:// hadoop-0 1:9000 </value>
-
</property>
-
</configuration>
-
第三步:
-
-
[hadoop@hadoop-01 ~]# cd/opt/software/hadoop
-
[hadoop@hadoop- 01 hadoop] # echo "hadoop-01" > ./etc/hadoop/slaves
-
[hadoop@hadoop- 01 hadoop] # cat./etc/hadoop/slaves
-
hadoop-01
为什么三个进程要修改为hadoop-01
1、对外提供服务和集群配置
2、第一次启动之前我们配置的是当前hadoop-01的无密码信任