【Linux】时间同步设置+防火墙设置+SELinux设置

时间同步设置

在大数据集群环境中,要求每台集群的时间必须是同步的,这样我们就会要求每台集群的时间必须和一台服务的时间是同步的。接下来介绍一下步骤:
1,设置ntp客户端

  1. yum -y install ntp 安装ntp时间同步软件
  2. systemctl enable ntpd 使软件可用
  3. systemctl start ntpd 启动ntp软件

2,编辑/etc/ntp.conf文件

  • Vi /etc/ntp.conf
  • 重点修改以下内容

    # Use public servers from the pool.ntp.org project.
    # Please consider joining the pool (http://www.pool.ntp.org/join.html).
    #server 0.centos.pool.ntp.org iburst
    
    server 192.168.243.133   ------->(此处需要修改,以哪台为准就写那台的IP)
    
    restrict 192.168.243.133 nomodify notrap noquery------->(此处需要修改,以哪台为准就写那台的IP)
    
    server 192.168.243.***     ------->(本机IP是多少就写多少)
    fudge 192.168.243.*** ------->(本机IP是多少就写多少) stratum 10

    3,重启ntpd服务:

    systemctl restart ntpd

    4,启动后,查看同步情况:

     ntpq -p
     ntpstat 
    防火墙设置
      临时关闭防火墙: systemctl start firewalld 或systemctl stop firewalld
      永久关闭防火墙: systemctl disable firewalld.service

    关闭iptables:

    关闭命令: service iptables stop 
    永久关闭防火墙:chkconfig iptables off 
    检查防火墙状态:service iptables status 

    查看防火墙状态:

    检查firewall的状态:systemctl status firewalld.service
    检查iptables状态:service iptables status 
    SELinux设置

    1,临时关闭SELinux:

    setenforce 0

    2,永久关闭SELinux:

    vi /etc/selinux/config
    将配置文件中SELINUX=enforcing改为SELINUX=disabled
    注:修改配置文件需要重启机器,但我们已临时关闭SELinux,等下次机器重启后,配置文件自动生效

    修改前:
    这里写图片描述
    修改后:
    这里写图片描述

    猜你喜欢

    转载自blog.csdn.net/zll_0405/article/details/80874193
    今日推荐