从零开始搭建大数据平台系列之(1)——环境准备

版权声明:本文为博主原创文章,转载请注明出处。 https://blog.csdn.net/gongxifacai_believe/article/details/81541697

1、机器准备

(1)物理机配置
处理器:Intel(R) Core(TM) i7 处理器
内存:8.00GB
系统类型:64 位操作系统,基于 x64 的处理器
操作系统:Windows 10 专业版

(2)磁盘阵列
常用磁盘阵列类型:RAID 0,RAID 1,RAID 10,RAID 01
由于本系列是在虚拟机上搭建大数据平台,因此本系列使用 RAID 0,即不设置冗余磁盘。

(3)虚拟机配置
内存:2.00 GB
处理器:Intel(R) Core(TM) i7 单核处理器
硬盘:SCSI 硬盘,50GB 容量
网络适配器:NAT
操作系统:CentOS release 6.4 (Final)

2、系统管理

(1)主机名配置

step1. 进入 /etc/hosts 文件,修改 IP 地址和主机名的映射如下:

127.0.0.1       localhost.localdomain   localhost
::1     localhost6.localdomain6 localhost6
192.168.74.132  bigdata-senior.ibeifeng.com     bigdata-senior

step2. 进入 /etc/sysconfig/network,设置如下:

NETWORKING=yes
HOSTNAME=bigdata-senior.ibeifeng.com
GATEWAY=192.168.74.1

step3. 以 Administrator 用户打开物理机 C:\Windows\System32\drivers\etc\hosts 文件,添加 IP 地址和主机名的映射如下:

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost
    192.168.74.128  hadoop-senior.ibeifeng.com
    192.168.74.131  hadoop-senior02.ibeifeng.com
    192.168.74.130  hadoop-senior03.ibeifeng.com
    192.168.74.132  bigdata-senior.ibeifeng.com

step4. 执行reboot命令重启虚拟机。

(2)用户权限管理

step1. 添加普通用户 beifeng:

# adduser beifeng
# passwd beifeng

step2. 为普通用户 beifeng 添加 sudo 权限:

[beifeng@bigdata-senior ~]$ cd /opt
[beifeng@bigdata-senior opt]$ ls
lost+found  rh
[beifeng@bigdata-senior opt]$ su
Password: 
[root@bigdata-senior opt]# chmod u+w /etc/sudoers
[root@bigdata-senior opt]# vim /etc/sudoers
beifeng ALL=(root)NOPASSWD:ALL
[root@bigdata-senior opt]# chmod u-w /etc/sudoers

(3)禁用 IPv6

向配置文件 /etc/modprobe.d/dist.conf 中添加如下两行:

# echo "alias net-pf-10 off" >> /etc/modprobe.d/dist.conf
# echo "alias ipv6 off" >> /etc/modprobe.d/dist.conf

(4)关闭防火墙

$ sudo chkconfig --list | grep iptables
iptables        0:off   1:off   2:on    3:on    4:on    5:on    6:off
$ sudo service iptables stop
$ sudo chkconfig iptables off
$ sudo chkconfig --list | grep iptables
iptables        0:off   1:off   2:off   3:off   4:off   5:off   6:off

其中,0~6 对应 Linux 系统启动的 7 个级别。

(5)禁用 Selinux

$ sudo vim /etc/sysconfig/selinux
SELINUX=disabled

(6)卸载 OpenJDK

$ sudo rpm -qa | grep java
java-1.7.0-openjdk-devel-1.7.0.9-2.3.4.1.el6_3.x86_64
tzdata-java-2012j-1.el6.noarch
java-1.7.0-openjdk-1.7.0.9-2.3.4.1.el6_3.x86_64
libvirt-java-0.4.9-1.el6.noarch
java-1.6.0-openjdk-1.6.0.0-1.50.1.11.5.el6_3.x86_64
java-1.6.0-openjdk-devel-1.6.0.0-1.50.1.11.5.el6_3.x86_64
libvirt-java-devel-0.4.9-1.el6.noarch

$ sudo rpm -e --nodeps tzdata-java-2012j-1.el6.noarch
$ sudo rpm -e --nodeps java-1.7.0-openjdk-devel-1.7.0.9-2.3.4.1.el6_3.x86_64
$ sudo rpm -e --nodeps java-1.7.0-openjdk-1.7.0.9-2.3.4.1.el6_3.x86_64
$ sudo rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-1.50.1.11.5.el6_3.x86_64
$ sudo rpm -e --nodeps java-1.6.0-openjdk-devel-1.6.0.0-1.50.1.11.5.el6_3.x86_64

(7)设置文件打开数量和用户最大进程数

step1. 临时设置文件打开数量:

$ ulimit -a 

step2. 临时设置用户最大进程数:

$ ulimit -u

step3. 配置文件中设置文件打开数量和用户最大进程数:

$ sudo vi /etc/security/limits.conf 
* soft nofile 65535
* hard nofile 65535
* soft nproc 32000
* hard nproc 32000 

3、设置集群时间同步

将本机 bigdata-senior.ibeifeng.com 作为时间服务器。

$ sudo rpm -qa | grep ntp
fontpackages-filesystem-1.41-1.1.el6.noarch
ntpdate-4.2.4p8-3.el6.centos.x86_64
ntp-4.2.4p8-3.el6.centos.x86_64

$ sudo vim /etc/ntp.conf
restrict 192.168.74.0 mask 255.255.255.0 nomodify notrap
#server 0.centos.pool.ntp.org
#server 1.centos.pool.ntp.org
#server 2.centos.pool.ntp.org
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10

$ sudo vim /etc/sysconfig/ntpd
# Drop root to id 'ntp:ntp' by default.
SYNC_HWCLOCK=yes
OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid -g"

$ sudo service ntpd status
ntpd (pid  1589) is running...

$ sudo service ntpd start
$ sudo chkconfig ntpd on

$ sudo chkconfig --list | grep ntpd
ntpd            0:off   1:off   2:on    3:on    4:on    5:on    6:off
ntpdate         0:off   1:off   2:off   3:off   4:off   5:off   6:off

客户端同步。
设置定时任务 Linux Crontab(每 10 分钟进行一次时间同步):

# crontab -e
##sync time
0-59/10 * * * * /usr/sbin/ntpdate bigdata-senior.ibeifeng.com

猜你喜欢

转载自blog.csdn.net/gongxifacai_believe/article/details/81541697