资讯专栏INFORMATION COLUMN

hadoop开发环境搭建2022

白马啸西风 / 603人阅读

hadoop.jpg

1. 环境准备

IP主机名安装的软件

192.168.71.133node01JDK Hadoop

192.168.71.134node01JDK Hadoop

192.168.71.135node03JDK Hadoop

192.168.71.136node04JDK Hadoop

基于centos7系统

使用Vmware虚拟机,选择NAT网络模式

2. 准备


name="node04"
hostnamectl set-hostname $name
echo $name > /etc/hostname
bash
sed -i 's@SELINUX=enforcing@SELINUX=disabled@g' /etc/selinux/config
setenforce 0
getenforce
\cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo "*/5 * * * *  /usr/sbin/ntpdate cn.pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/root
cat>>/etc/security/limits.conf<<EOF
* soft nofile 65535
* hard nofile 65535
EOF
echo "ulimit -SHn 65535">>/etc/rc.local
ulimit -SHn 65535
ulimit -n
systemctl disable firewalld
systemctl stop firewalld
systemctl status firewalld

2.1 修改主机名


[root@localhost ~]# hostnamectl set-hostname node01
[root@localhost ~]# bash
[root@node01 ~]# echo 'node01'> /etc/hostname
[root@node01 ~]#

其他机器相同操作

2.2 selinux关闭


[root@node01 ~]# sed -i 's@SELINUX=enforcing@SELINUX=disabled@g' /etc/selinux/config
[root@node01 ~]# setenforce 0
[root@node01 ~]# getenforce
Permissive

其他机器相同操作

2.3 防火墙关闭


[root@node01 ~]# systemctl disable firewalld  # 开机不自启防火墙
[root@node01 ~]# systemctl stop firewalld
[root@node01 ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

Feb 18 17:10:21 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
Feb 18 17:10:22 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
Feb 18 09:14:35 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
Feb 18 09:14:36 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.
Feb 18 09:14:36 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
Feb 18 09:14:36 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
Feb 19 16:40:39 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
Feb 19 16:40:39 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.

其他机器相同操作

2.4 时间同步


[root@node01 ~]# \cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
[root@node01 ~]# echo "*/5 * * * *  /usr/sbin/ntpdate cn.pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/root
[root@node01 ~]# crontab -l
*/5 * * * *  /usr/sbin/ntpdate cn.pool.ntp.org > /dev/null 2>&1

2.5 修改文件句柄数


cat>>/etc/security/limits.conf<<EOF
* soft nofile 65535
* hard nofile 65535
EOF
echo "ulimit -SHn 65535">>/etc/rc.local
ulimit -SHn 65535

2.6 静态IP


[root@node01 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=1f78f596-4e84-42c4-b5ff-b6056e2cd60a
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.71.133
NETMASK=255.255.255.0
GATEWAY=192.168.71.2
DNS1=223.5.5.5
DNS2=114.114.114.114

固定IP地址为了防止虚拟机网络问题,造成IP地址变动。

其他机器类似操作

2.7 host映射





其他机器相同操作

3. 基础部署

3.1 安装JDK8

JDK8安装参考链接

脚本安装


cd /usr/local/src/
wget 192.168.2.49:10000/caimengzhi/JDK8_112.zip
unzip JDK8_112.zip
sh InstallJDK8.sh
source /etc/profile
java -version





每个机器都要做

3.2 线性关系

免密


[root@node01 ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:1nEuxcQYCBAw7IM3N7Ud63N2IpPO3uKxMmxlDLwE2A0 root@node01
The key's randomart image is:
+---[RSA 2048]----+
| .o+E=.. ..+.    |
|  o.o o o .o.    |
| o   + o o. +    |
|. = o = o. =     |
| . + o =S.o .    |
|      ..X +..    |
|     . =.* o     |
|      = ++       |
|     . =+..      |
+----[SHA256]-----+
------> 免密到node01 也就是自己
[root@node01 ~]# ssh-copy-id root@node01
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'node01 (192.168.71.133)' can't be established.
ECDSA key fingerprint is SHA256:YcLvRKxlm+A/ojEzBNzAJcgCF0ya0Nfd0x5lPc4ZO/I.
ECDSA key fingerprint is MD5:bb:ba:5e:c5:4a:d1:6c:ba:a8:aa:5d:31:b6:cb:17:33.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@node01's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@node01'"
and check to make sure that only the key(s) you wanted were added.

[root@node01 ~]# ssh node01
Last login: Wed Mar 11 20:50:14 2020 from 192.168.71.1
[root@node01 ~]# logout
Connection to node01 closed.

------> 免密到node02
[root@node01 ~]# ssh-copy-id root@node02
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'node02 (192.168.71.134)' can't be established.
ECDSA key fingerprint is SHA256:It4bpZuRcqmOPQlHB7GATIdx5zFa3Qb1FnSfedvBPbU.
ECDSA key fingerprint is MD5:1a:70:54:c0:20:9e:20:37:14:fb:87:7f:cf:f1:79:a4.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@node02's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@node02'"
and check to make sure that only the key(s) you wanted were added.

[root@node01 ~]# ssh node02
Last login: Wed Mar 11 20:55:24 2020 from 192.168.71.1
[root@node02 ~]# logout
Connection to node02 closed.

------> 免密到node03
[root@node01 ~]# ssh-copy-id root@node03
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'node03 (192.168.71.135)' can't be established.
ECDSA key fingerprint is SHA256:hfM32lJMLFKybYxNw+cm3pX5Z9lISpvXm88cob77hqs.
ECDSA key fingerprint is MD5:9b:69:4a:81:28:fe:59:aa:e9:c3:86:8b:2d:f7:67:f2.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@node03's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@node03'"
and check to make sure that only the key(s) you wanted were added.

[root@node01 ~]# ssh node03
Last failed login: Wed Mar 11 21:03:09 CST 2020 from node01 on ssh:notty
There was 1 failed login attempt since the last successful login.
Last login: Wed Mar 11 20:55:29 2020 from 192.168.71.1
[root@node03 ~]# logout
Connection to node03 closed.

------> 免密到node04
[root@node01 ~]# ssh-copy-id root@node04
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'node04 (192.168.71.136)' can't be established.
ECDSA key fingerprint is SHA256:RPhRCeYqNUn2AiUj246zRsHoxuRbvZ1al/lk6yTSjXc.
ECDSA key fingerprint is MD5:d6:4f:15:09:6b:85:7f:ea:14:5c:cc:3c:5f:36:0d:74.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@node04's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@node04'"
and check to make sure that only the key(s) you wanted were added.

[root@node01 ~]# ssh node04
Last login: Wed Mar 11 20:55:33 2020 from 192.168.71.1
[root@node04 ~]# logout
Connection to node04 closed.


文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/127476.html

相关文章

  • cdh替代-这款cdh替代方案你要知道

      痛点:  如今数字化转型,已成为企业界的共识。 从信息时代走向数字时代,大家都希望在生产要素、经济形态发生变革的节点抓住机遇不被淘汰,而绝大多数中小企业又没有财力搞得太折腾太复杂。因此大家不要期待一口气吃成胖子,而要抓住数字化时代的本质是让企业线上的数据流动起来,解决数据的运力和流通问题,也就是数据消费。其实绝大多数企业的核心诉求也是打破数据孤岛,提升数据共享消费的效率,进而实现企业的降本...

    白马啸西风 评论0 收藏0
  • 学习hadoop需要什么基础

    摘要:学习需要什么基础学习需要什么基础这已经不是一个新鲜的话题了,随便上网搜索一下就能找出成百上千篇的文章在讲学习需要掌握的基础。刚开始写的几篇稍微有点乱,其中有一篇就是在说学习需要什么样基础的。 学习hadoop需要什么基础学习hadoop需要什么基础这已经不是一个新鲜的话题了,随便上网搜索一下就能找出成百上千篇的文章在讲学习hadoop需要掌握的基础。再直接的一点的问题就是——学Hado...

    frolc 评论0 收藏0
  • Hadoop入门:Hadoop简介和集群搭建

    摘要:介绍是旗下的一个用语言实现开源软件框架,是一个开发和运行处理大规模数据的软件平台。成本低通过普通廉价的机器组成服务器集群来分发以及处理数据,以至于成本很低。所以的按位存储和处理数据的能力值得人们信赖。会使用台主机组成一个集群。 Hadoop 介绍 Hadoop是Apache旗下的一个用java语言实现开源软件框架,是一个开发和运行处理大规模数据的软件平台。允许使用简单的编程模型在大...

    张金宝 评论0 收藏0
  • Hadoop入门:Hadoop简介和集群搭建

    摘要:介绍是旗下的一个用语言实现开源软件框架,是一个开发和运行处理大规模数据的软件平台。成本低通过普通廉价的机器组成服务器集群来分发以及处理数据,以至于成本很低。所以的按位存储和处理数据的能力值得人们信赖。会使用台主机组成一个集群。 Hadoop 介绍 Hadoop是Apache旗下的一个用java语言实现开源软件框架,是一个开发和运行处理大规模数据的软件平台。允许使用简单的编程模型在大...

    kuangcaibao 评论0 收藏0

发表评论

0条评论

白马啸西风

|高级讲师

TA的文章

阅读更多
最新活动
阅读需要支付1元查看
<