CDH6.2.0安装(二)

CDH6.2.0安装(二)

虚拟机设置

Step1: 安装虚拟机

Step2: 设置网络

image

  • 进入/etc/sysconfig/network-scripts/目录,编辑ifcfg-enp0s3文件(名称可能不一样)
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
############改动部分开始############
#动态IP
#BOOTPROTO="dhcp"

#静态IP
BOOTPROTO="static"
IPADDR=192.168.0.222
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
DNS1=114.114.114.114
############改动部分结束############
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="enp0s3"
UUID="73ab5a69-9070-4c5a-a0b9-c5a6250af943"
DEVICE="enp0s3"
ONBOOT="yes
  • 修改文件后保存退出,使用命令 service network restart 重启网卡服务,即可
Step3:设置hosts(后续操作均以root用户执行)
  • 确定各节点hostname 正确设置:

    vi /etc/hostname
    
  • 设置hosts:

    vi /etc/hosts:
    192.168.31.110	master
    192.168.31.111	slave1
    192.168.31.112 	slave2
    
Step4:关闭SELinux及防火墙
  • 关闭SELinux:
 vi /etc/selinux/config ,修改如下: 
    SELINUX=disabled
  • 关闭防火墙:
systemctl stop firewalld
systemctl disable firewalld
Step5: 设置ssh免密登录
  • 生成密钥:
ssh-keygen -t rsa(默认位于 ~/.ssh/)
  • 拷贝公钥到所有机器:
ssh-copy-id root@master
ssh-copy-id root@slave1
ssh-copy-id root@slave2
  • 测试免密登录:
ssh master
ssh slave01
ssh slave02

Step6: 设置yum源为阿里云的源

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

yum clean all

yum makecache

Step7: 设置ntp时间同步服务
  • 安装 ntp
yum –y install ntp 
  • 启动并设置NTP服务开机启动
systemctl start ntpd
systemctl enable ntpd
Step8: 设置ntp时间同步服务
  1. vi /etc/ntp.conf,内容如下:
driftfile /var/lib/ntp/ntp.drift #草稿文件
# 允许内网其他机器同步时间(192.168.137.0 修改为自己的ip掩码)
restrict 192.168.137.0 mask 255.255.255.0 nomodify notrap
 
# Use public servers from the pool.ntp.org project.
# 中国这边最活跃的时间服务器 : [http://www.pool.ntp.org/zone/cn](http://www.pool.ntp.org/zone/cn)
server 210.72.145.44 perfer   # 中国国家受时中心
server 202.112.10.36             # 1.cn.pool.ntp.org
server 59.124.196.83             # 0.asia.pool.ntp.org
 
# allow update time by the upper server 
# 允许上层时间服务器主动修改本机时间
restrict 210.72.145.44 nomodify notrap noquery
restrict 202.112.10.36 nomodify notrap noquery
restrict 59.124.196.83 nomodify notrap noquery
#外部时间服务器不可用时,以本地时间作为时间服务
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10

2.重启服务:

service ntpd restart

3.查看同步状态:

 netstat -tlunp | grep ntp
Step9: 设置ntp时间同步服务

设置slave到master 的同步(在slave节点操作):

  1. vi /etc/ntp.conf,内容如下:
driftfile /var/lib/ntp/ntp.drift # 草稿文件

statsdir /var/log/ntpstats/
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

# 让NTP Server为内网的ntp服务器( 192.168.31.110修改为master节点ip)
server 192.168.31.110
fudge 192.168.31.110 stratum 5

# 不允许来自公网上ipv4和ipv6客户端的访问
restrict -4 default kod notrap nomodify nopeer noquery 
restrict -6 default kod notrap nomodify nopeer noquery

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1
  1. 重启服务:
service ntpd restart
  1. 手动同步:
ntpdate -u 192.168.31.110

重启虚机!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值