您的位置:首页 > 大数据

搭建大数据平台主机环境准备

2018-01-25 08:58 309 查看
主机名配置

查看主机名:
hostname


临时修改:
hostname  maste1


永久修改

vim /etc/sysconfig/network
HOSTNAME=maste1


配置主机映射

修改/etc/host

vim /etc/hosts
134.32.73.3 maste1
134.32.73.4 maste2
134.32.73.5 slave1
134.32.73.6 slave2
134.32.73.7 slave3


防火墙配置

检查防火墙状态

service iptables stauts


关闭防火墙

service iptables stop


禁止开机启动

chkconfig iptables off


禁用IPV6

查看Ipv6是否开启

ifconfig


临时禁用

sh -c 'echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6'


永久禁用

# echo "                   " >> /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


关闭SELINUX

查看状态

/usr/sbin/sestatus -v


关闭

vim /etc/selinux/config


SELINUX=disabled


重启服务器

reboot


创建用户,并进行sudo权限配置

创建组及用户

groupadd hadoop


useradd -mg hadoop hadoop


修改sudoers权限

chmod u+w /etc/sudoers


vim /etc/sudoers


添加下面行:

hadoop  ALL=(ALL)       ALL


配置SSH免密登录

root用户验证设置

vim /etc/ssh/sshd_config


启用

RSAAuthentication yes


PubkeyAuthentication yes


AuthorizedKeysFile      .ssh/authorized_keys


修改完成保存并重启服务

service sshd restart


转到用户的家目录的.ssh目录,并删除所有文件,没有的话自己创建(
mkdir .ssh
)

cd ~.ssh/


rm -r ./*


生成每台机器的秘钥 3次回车

ssh-keygen -t rsa


发送前需要给用户创建密码,此步使用,发送公钥给每台机器,也要发给自己

cd .ssh/


ssh-copy-id hostname


-》登录验证

ssh master2


exit


NTP时间同步(CentOS)

检查ntp服务是否启动

service ntpd status


修改server配置文件/etc/ntp.conf

》1、配置允许哪些网段的机器可以对我进行同步

# Hosts on local network are less restricted.

restrict 134.32.73.0 mask 255.255.255.0 nomodify notrap


》2、由于是内网环境,就不需要这些服务配置,注释

# Please consider joining the pool (http://www.pool.ntp.org/join.html).

#server 0.centos.pool.ntp.org

#server 1.centos.pool.ntp.org

#server 2.centos.pool.ntp.org

》3、如果server匹配不上,默认使用本地时间

server  127.127.1.0     # local clock


fudge   127.127.1.0 stratum 10


启动ntp服务

service ntpd start


开机启动

chkconfig ntpd on


查看端口

netstat -tunlp | grep ntp


查看状态

ntpstat


查看可同步的服务

ntpq -p


修改agent配置文件/etc/ntp.conf

》1-同步server的地址

server 134.32.73.3


》2-允许server修改时间的限制条件

restrict 134.32.73.3 nomodify notrap noquery


-》启动ntp服务

service ntpd start


-》手动的同步

ntpdate -u 134.32.73.3


可以进行crontab配置,定时同步

crontab -e


*/10 * * * * /usr/sbin/ntpdate 134.32.73.3
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: