日萌社
人工智能AI:Keras PyTorch MXNet TensorFlow PaddlePaddle 深度学习实战(不定时更新)
防火墙 查看状态 systemctl status firewalld
防火墙 关闭 systemctl stop firewalld
防火墙 开机禁用 systemctl disable firewalld
禁用 SELINUX
查看SELINUX状态 sestatus
禁用 SELINUX
1.临时关闭SELINUX
setenforce 0
2.永久关闭SELINUX
修改配置文件 vim /etc/selinux/config(重启生效)
将 SELINUX=enforcing 改为 SELINUX=disabled
3.查看SELINUX状态 sestatus
reboot 重启机器后 执行 sestatus 显示 SELinux status: disabled
yum install ntpdate
yum install ntp
启动服务 systemctl start ntpd
查看是否启动 ps -ef | grep ntpd
开机启动 systemctl enable ntpd.service
查看当前时间 date
查看当前时间和NTP服务的同步状态 timedatectl
使用命令同步外部授时中心:ntpdate -u ntp6.aliyun.com
安装 cm 6.3.1官方目录下自带的 oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm
1.查看CentOS是否已安装的自带openjdk,如果安装了自带openjdk,那么卸载CentOS自带的该openjdk:
查看CentOS已安装的自带openjdk:rpm -qa | grep java
2.安装 oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm
yum -y install oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm
3.默认安装在 /usr/java/jdk1.8.0_181-cloudera
4.可以查看JDK版本号:
(1)cd /usr/java/jdk1.8.0_181-cloudera/bin/
(2)./java -version
(3)在profile配置文件中配置好新的JDK之后,便可以直接使用“java -version”查看JDK版本号
5.配置/etc目录下的profile配置文件:
1.vim /etc/profile
JAVA_HOME=/usr/java/jdk1.8.0_181-cloudera
CLASSPATH=.:$JAVA_HOME/lib/tools.jar
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME CLASSPATH PATH
2.重新加载profile配置文件,让配置文件生效:source /etc/profile
3.检查是否已配置好新的JDK:java -version
通过node1节点机器克隆出node2、node3节点机器
对克隆后的节点进行以下修改
1.uuidgen ens33 获取新的 UUID
2.vim /etc/sysconfig/network-scripts/ifcfg-ens33 修改 IP 和 UUID
3.service network restart 重启网络
1.设置 hostname,reboot重启之后即能显示(注意:不使用大写字符作为主机名,否则在CDH中无法正常通过Kerberos进行身份验证)
1.hostnamectl set-hostname 主机名,分别为node1、node2、node3
2.vim /etc/hostname 设置主机名,分别为node1、node2、node3
2.设置 hosts 文件 vim /etc/hosts 添加如下
192.168.189.200 node1
192.168.189.201 node2
192.168.189.202 node3
3.rsa算法加密,非对称加密的方式基于私钥登陆的方式:(ssh连接时无需输入用户密码)
1.ssh-keygen -t rsa 然后四下回车
2./root/.ssh目录下:
私钥:id_rsa
公钥:id_rsa.pub
3.ssh-copy-id linux的IP
每个节点都需要拷贝秘钥然后分发给别的linux,执行命令后然后输入yes,然后最终输入密码
ssh-copy-id node1
ssh-copy-id node2
ssh-copy-id node3
4.ssh linux的用户名@别的linux的IP
现在无需输入别的linux的用户密码即能登录到别的linux中
5.ssh root@node1
exit
ssh root@node2
exit
ssh root@node3
exit
4.配置时间同步
1.使用命令同步外部授时中心:ntpdate -u ntp6.aliyun.com
查看当前时间和NTP服务的同步状态 timedatectl
2.node1作为NTP Server,node2和node3作为NTP Client,node2和node3要跟node1同步时间,node1要去外部授时中心同步时间
3.配置 node1:
1.配置前先使用命令同步外部授时中心:ntpdate -u cn.pool.ntp.org 或 ntpdate -u ntp6.aliyun.com
2.vim /etc/ntp.conf
注释以下配置
#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
增加如下配置:
# 允许内网其他机器同步时间,如果不添加该约束默认允许所有IP访问本机同步服务。192.168.88.0为本局域网内的子网IP
restrict 192.168.189.0 mask 255.255.255.0 nomodify notrap
# 配置和上游标准时间同步
server 210.72.145.44 # 中国国家授时中心
server 133.100.11.8 #日本[福冈大学]
server 0.cn.pool.ntp.org
server 1.cn.pool.ntp.org
server 2.cn.pool.ntp.org
server 3.cn.pool.ntp.org
# 配置允许上游时间服务器主动修改本机(内网ntp Server)的时间
restrict 210.72.145.44 nomodify notrap noquery
restrict 133.100.11.8 nomodify notrap noquery
restrict 0.cn.pool.ntp.org nomodify notrap noquery
restrict 1.cn.pool.ntp.org nomodify notrap noquery
restrict 2.cn.pool.ntp.org nomodify notrap noquery
restrict 3.cn.pool.ntp.org nomodify notrap noquery
# 确保localhost有足够权限,使用没有任何限制关键词的语法。
# 外部时间服务器不可用时,以本地时间作为时间服务。
# 注意:这里不能改,必须使用127.127.1.0,否则会导致无法
#在ntp客户端运行ntpdate serverIP,出现no server suitable for synchronization found的错误。
#在ntp客户端用ntpdate –d serverIP查看,发现有“Server dropped: strata too high”的错误,并且显示“stratum 16”。而正常情况下stratum这个值得范围是“0~15”。
#这是因为NTP server还没有和其自身或者它的server同步上。
#以下的定义是让NTP Server和其自身保持同步,如果在ntp.conf中定义的server都不可用时,将使用local时间作为ntp服务提供给ntp客户端。
#下面这个配置,建议NTP Client关闭,建议NTP Server打开。因为Client如果打开,可能导致NTP自动选择合适的最近的NTP Server、也就有可能选择了LOCAL作为Server进行同步,而不与远程Server进行同步。
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
3.systemctl restart ntpd 重启服务端ntpd服务
4.ntpq -p 查看网络中的NTP服务器,同时显示客户端和每个服务器的关系
5.ntpstat 查看时间同步状态
1.正在尝试同步的话,执行ntpstat会显示 synchronised to local net at stratum 11
主节点一般需要1~5分钟才能同步上外部的授时中心。所以,服务器启动后需要稍等下。
2.没有同步成功的话,执行ntpstat会显示unsynchronised
3.同步成功以后,node1会显示 synchronised to NTP server (xx.xx.xx.xx) at stratum x
4.配置 node2、node3:
1.vim /etc/ntp.conf
注释以下配置
#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
增加如下配置:
#配置上游时间服务器为本地的ntpd Server服务器
server 192.168.189.200
# 配置允许上游时间服务器主动修改本机的时间
restrict 192.168.189.200 nomodify notrap noquery
2.systemctl restart ntpd 重启服务端ntpd服务
3.ntpq -p 查看网络中的NTP服务器,同时显示客户端和每个服务器的关系
4.ntpstat 查看时间同步状态
其他子节点同样可能需要1~5分钟才同步上主节点时钟
同步还没有成功时,node2、node3会显示 synchronised to unspecified at stratum 3
同步成功以后,node2、node3会显示 synchronised to NTP server (主节点IP)at stratum 3
5.node2、node3 都可以手动执行 ntpdate -u node1 同步主节点的时间
timedatectl 查看当前时间和NTP服务的同步状态 timedatectl:必须保证所有节点下的时间都是一致,并且NTP服务同步成功,那么才能作为CDH启动成功的保证