这篇文章主要介绍了Hadoop部署的基础设施操作有哪些的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇Hadoop部署的基础设施操作有哪些文章都会有所收获,下面我们一起来看看吧。
官网导读
支持最好的平台:GNU/Linux
依赖的软件:
Java™ must be installed. Recommended Java versions are described at HadoopJavaVersions.Hadoop基于Java开发,Java的移动性好
ssh must be installed and sshd must be running to use the Hadoop scripts that manage remote Hadoop daemons.
部署模式:
Local (Standalone) Mode 单机模式,主要用于debug
Pseudo-Distributed Mode 伪分布式,单节点多角色
Fully-Distributed Mode 完全分布式,多节点多角色
基础设施
操作系统、环境、网络、必须软件
设置IP及主机名
关闭防火墙&selinux
设置hosts映射
时间同步
安装jdk
设置SSH免秘钥
设置IP及主机名
可以正常联网查看IP
[root@localhost ~]# ifconfigens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.0.118 netmask 255.255.255.0 broadcast 192.168.0.255 inet6 fe80::3db1:f589:4820:5457 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:18:10:17 txqueuelen 1000 (Ethernet) RX packets 462062 bytes 670399544 (639.3 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 166351 bytes 11096211 (10.5 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 84 bytes 13940 (13.6 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 84 bytes 13940 (13.6 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255 ether 52:54:00:5a:69:e1 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0// 配置DEVICE=eth0#HWADDR=00:0C:29:42:15:C2TYPE=EthernetONBOOT=yesNM_TROLLED=yesBOOTPROTO=staticIPADDR=192.168.150.11NETMASK=255.255.255.0GATEWAY=192.168.150.2DNS1=223.5.5.5DNS2=114.114.114.114
修改配置文件设置主机名
[root@localhost ~]# vi /etc/sysconfig/network// 设置主机名并保存退出HOSTNAME=node01
关闭防火墙&selinux
//关闭防火墙[root@localhost ~]# systemctl stop firewalld//关闭开机启动防火墙[root@localhost ~]# systemctl disable firewalld.serviceRemoved symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.[root@localhost ~]# [root@localhost ~]# vi /etc/selinux/config//将配置文件中的SELINUX设置为disabledSELINUX=disabled
设置hosts映射
增加映射关系,因为在现在搭建环境的时候,一般会做解耦,不会再软件配置文件中写ip地址,主要使用主机名,就和dns解析一样,避免ip改变时要修改很多配置文件
[root@localhost ~]# vi /etc/hosts// 增加映射关系192.168.0.118 node01192.168.0.119 node02
时间同步
所有节点时间需同步一致,不然未来做心跳的时候会有问题
[root@localhost ~]# dateFri Dec 30 22:23:45 CST 2022// 安装ntp[root@localhost ~]# yum install ntp -yLoaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.163.com * updates: mirrors.163.comPackage ntp-4.2.6p5-29.el7.centos.2.x86_64 already installed and latest versionNothing to do[root@localhost ~]# vi /etc/ntp.conf// 增加配置server ntp1.aliyun.com// 启动ntpd[root@localhost ~]# systemctl start ntpd.service// 配置开机启动ntpd[root@localhost ~]# systemctl enable ntpd.serviceCreated symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.[root@localhost ~]#
安装jdk
设置环境变量的时候要记得设置两次,一次在安装jdk的时候设置,一次在搭建Hadoop的时候设置
去官网下载jdk,最好是rpm包,然后上传到服务器节点中(使用jdk压缩包解压安装需要做很多其他的配置)
这里使用过windows下载,通过scp命令上传到118节点中
F:\workspace\demo>scp C:\Users\43866\Downloads\jdk-8u351-linux-x64.rpm root@192.168.0.118:/usr/jdkroot@192.168.0.118's password: jdk-8u351-linux-aarch74.rpm 100% 59MB 70.1MB/s 00:00 F:\workspace\demo>
在118节点中使用命令安装jdk
[root@node01 jdk]# rpm -i jdk-8u351-linux-x64.rpm warning: jdk-8u351-linux-x64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEYUnpacking JAR files... tools.jar... plugin.jar... javaws.jar... deploy.jar... rt.jar... jsse.jar... charsets.jar... localedata.jar...[root@node01 jdk]#
设置JAVA_HOME环境变量
[root@node01 default]# vi /etc/profile// 追加环境变量并保存文件export JAVA_HOME=/usr/java/defaultexport PATH=$PATH:$JAVA_HOME/bin
设置SSH免秘钥
想要使用Hadoop脚本就必须设置ssh免密
检查是否已设置ssh免密
[root@node01 default]# ssh localhostThe authenticity of host 'localhost (::1)' can't be established.ECDSA key fingerprint is SHA256:rDsunaro1f5LyKkEeNohXfDD9oEglNXtviD/JZtA1dw.ECDSA key fingerprint is MD5:51:38:8d:fc:e4:d2:c7:ce:66:09:c8:f2:e6:9e:a7:f2.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added 'localhost' (ECDSA) to the list of known hosts.root@localhost's password:
通过ssh localhost命令检查发现需要输入密码,说明还未设置ssh免密,而且还可以自动生成.ssh文件,这个文件要创建的话比较麻烦
生成秘钥和公钥
如果118节点想免密登录到118节点(自己):
118节点就要生成公钥和秘钥,且将公钥放到 ~/.ssh/authorized_keys中
[root@node01 .ssh]# ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsaGenerating public/private dsa key pair.Your identification has been saved in /root/.ssh/id_dsa.Your public key has been saved in /root/.ssh/id_dsa.pub.The key fingerprint is:SHA256:GHhKB7GeoYYlNPWJpCZ+VoABUyIgDbdYrjjyAdgui1k root@node01The key's randomart image is:+---[DSA 1024]----+|@BB+o. ||=X=.++. ||*o=.=++ ||=B +.* o ||B.Eo+ . S ||oOo. ||+ . || || |+----[SHA256]-----+[root@node01 .ssh]# cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys[root@node01 .ssh]# [root@node01 .ssh]# ssh 192.168.0.118Last login: Sat Dec 31 13:52:49 2022 from 192.168.0.117[root@node01 ~]#
结论
119节点包含了118节点的公钥,118就可以免密登录
关于“Hadoop部署的基础设施操作有哪些”这篇文章的内容就介绍到这里,感谢各位的阅读!相信大家对“Hadoop部署的基础设施操作有哪些”知识都有一定的了解,大家如果还想学习更多知识,欢迎关注编程网行业资讯频道。