专家指导 如何实现Hadoop集群搭建

本节继续向大家介绍Hadoop集群搭建的步骤,希望通过本节的介绍你对如何进行Hadoop集群搭建有一定的认识,欢迎大家一起来学习Hadoop集群搭建搭建方面的知识。

一、建立Master到每一台Slave的SSH受信证书

1、伪分布式免密码ssh设置
?现在确认能否不输入口令就用ssh登录localhost:
$sshlocalhost

如果不输入口令就无法用ssh登陆localhost,执行下面的命令:
$ssh-keygen-tdsa-P''-f~/.ssh/id_dsa
$cat~/.ssh/id_dsa.pub>>~/.ssh/authorized_keys

?安装ssh,并生成公钥和私钥
?运行ssh-keygen-trsa,根据屏幕提示直接选择“回车”
?会在用户目录~/.ssh/产生两个文件,id_rsa,id_rsa.pub
?cat~/.ssh/id_dsa.pub>>~/.ssh/authorized_keys

2、Hadoop集群搭建的SSH设置
master:
[fan@fan001~]$ssh-keygen-trsa
[fan@fan001~]$sshfan@fan002"mkdir.ssh;chmod0700.ssh"(重复)
[fan@fan001~]$scp~/.ssh/id_rsa.pubfan@fan002:.ssh/id_rsa.pub(重复)
[fan@fan001~]$cd.ssh
[[email protected]]$cpid_rsa.pubauthorized_keys
[[email protected]]$chmod600authorized_keys

slave:
[fan@fan002~]$touch.ssh/authorized_keys
[fan@fan002~]$cd.ssh
[[email protected]]$catid_rsa.pub>>authorized_keys
[[email protected]]$chmod600authorized_keys
OK,完成免密码ssh设置

二、启动Hadoop

1、伪分布式的启动:
格式化一个新的分布式文件系统:$bin/hadoopnamenode-format
启动Hadoop守护进程:$bin/start-all.sh
Hadoop守护进程的日志写入到${HADOOP_LOG_DIR}目录(默认是${HADOOP_HOME}/logs).

相关推荐