hadoop集群搭建
1.复制新的两台虚拟机
(三台机器都要确定都修改成功,互信要连接试试)
(1)修改IP:vi /etc/sysconfig/network-scripts/ifcfg-ens33
(2)重启网络:systemctl restart network
(3)设置主机名:homenamectl set-hostname hadoop002
(4)添加hosts:
vi /etc/hosts
可以往远程拷贝此文件:scp /etc/hosts root@hadoop002
(5)添加互信(以下三步都要进行操作)
#生成秘钥:
ssh-keygen -t rsa
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
开启远程登录:
[root@hadoop001 ~]#ssh-copy-id -i .ssh/id_rsa.pub -p22 root@192.168.56.122
三台互相登录一下,查看是否连接成功!!!
2.在主机hadoop001上修改一下配置文件
(在/opt/hadoop目录下输入以下命令)
(1)vi etc/hadoop/hdfs-site.xml
将副本数改成3
将secondary的ip改成第二台机器的ip
<configuration>
<property>
<name>dfs.replication