当前位置: 代码迷 >> 综合 >> 大数据Linux环境准备
  详细解决方案

大数据Linux环境准备

热度:48   发布时间:2024-03-06 17:41:06.0

准备环境

我是两台电脑各开2个虚拟机。使用CentOS7.5。网络使用桥接模式。


修改主机名

hostnamectl --static set-hostname hadoop01


配置网络

vi /etc/sysconfig/network-scripts/ifcfg-ens33

DEVICE=ens33

TYPE=Ethernet

ONBOOT=yes

BOOTPROTO=static

NAME=ens33

IPADDR=10.6.207.201

PREFIX=24

GATEWAY=10.6.207.254

DNS1=114.114.114.114


修改主机映射

vi /etc/hosts

末尾增加

10.6.207.201 hadoop01

10.6.207.202 hadoop02

10.6.207.203 hadoop03

10.6.207.204 hadoop04

win10下C:\Windows\System32\drivers\etc\hosts同样增加


关防火墙

systemctl stop firewalld

systemctl disable firewalld


开ssh

systemctl start sshd

systemctl enable sshd


创建用户并具有root权限

useradd user

passwd user

vi /etc/sudoers

## Allow root to run any commands anywhere

root    ALL=(ALL)    ALL

user   ALL=(ALL)    ALL


创建目录用于安装大数据软件

mkdir /opt/module /opt/software

chown user:user /opt/module /opt/software


Linux安装必备软件

yum install -y epel-release

yum install -y psmisc nc net-tools rsync vim lrzsz ntp libzstd openssl-static


克隆

克隆完后需修改主机名和ip。


设置SSH免密登陆

A想免密登陆B,就在A生成密钥对,再把公钥发给B。

root用户和user用户都设置。

ssh-keygen -t rsa

ssh-copy-id hadoop01

ssh-copy-id hadoop02

ssh-copy-id hadoop03

ssh-copy-id hadoop04


设置时间同步

1)关闭所有节点的ntp服务

systemctl stop ntpd

systemctl disable ntpd

2)时间服务器节点vi /etc/ntp.conf

#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap改为

restrict 10.6.207.0 mask 255.255.255.0 nomodify notrap

以下内容全加上#变为

#server 0.centos.pool.ntp.org iburst

#server 1.centos.pool.ntp.org iburst

#server 2.centos.pool.ntp.org iburst

#server 3.centos.pool.ntp.org iburst

末尾添加

server 127.127.1.0

fudge 127.127.1.0 stratum 10

3)时间服务器节点vi /etc/sysconfig/ntpd

改为

SYNC_HWCLOCK=yes

4)时间服务器节点开启ttp服务

systemctl start ntpd

systemctl enable ntpd

5)其余从机每10分钟时间同步

crontab -e

*/10 * * * * /usr/sbin/ntpdate hadoop01