目录
一、节点规划
主机名 | IP地址 | 硬盘大小 | 运行内存 | 操作系统 |
---|---|---|---|---|
controller | 10.0.0.20/24 | 40G | 4G | CentOS 7 |
computer | 10.0.0.10/24 | 40G | 1G | CentOS 7 |
二、控制节点部署
1、网络部署:
①、修改网卡配置
②、要求能够访问外网
③、配置hosts文件实现主机名之间映射
[root@localhost ~]# nmcli connection modify ens33 connection.autoconnect yes ipv4.addresses 10.0.0.20/24 ipv4.gateway 10.0.0.2 ipv4.dns 8.8.8.8 ipv4.method manual
[root@localhost ~]# nmcli connection down ens33
[root@localhost ~]# nmcli connection up ens33
[root@localhost ~]# ping qq.com
PING qq.com (203.205.254.157) 56(84) bytes of data.
64 bytes from 203.205.254.157 (203.205.254.157): icmp_seq=1 ttl=128 time=409 ms
64 bytes from 203.205.254.157 (203.205.254.157): icmp_seq=2 ttl=128 time=434 ms
64 bytes from 203.205.254.157 (203.205.254.157): icmp_seq=3 ttl=128 time=401 ms
64 bytes from 203.205.254.157 (203.205.254.157): icmp_seq=4 ttl=128 time=412 ms
^C
--- qq.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3027ms
rtt min/avg/max/mdev = 401.681/414.384/434.033/12.033 ms
[root@localhost ~]# cat >>/etc/hosts<<EOF
10.0.0.10 computer
10.0.0.20 controller
EOF
[root@localhost ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.0.0.10 computer
10.0.0.20 controller
2、安装命令、修改主机名:
①、安装wget、net-tools(ifconfig)、bash-completion(命令填充脚本)、vim
[root@localhost ~]# yum install wget net-tools bash-completion vim -y
[root@localhost ~]# source /usr/share/bash-completion/bash_completion
[root@localhost ~]# hostnamectl set-hostname controller && bash
3、关闭SELINUX和防火墙
①、SELINUX重启验证
[root@controller ~]# sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config
[root@controller ~]# systemctl stop firewalld.service
[root@controller ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@controller ~]# getenforce
Permissive
4、NTP(网络时间协议)服务部署
①、修改配置文件
②、要求两台主机之间可以通过NTP实现时钟同步
[root@controller ~]# yum install chrony -y
[root@controller ~]# vim /etc/chrony.conf
1 # Use public servers from the pool.ntp.org project.
2 # Please consider joining the pool (http://www.pool.ntp.org/join.html).
3 server s1c.time.edu.cn iburst ==>添加该项
4
5 # Record the rate at which the system clock gains/losses time.
6 driftfile /var/lib/chrony/drift
7
8 # Allow the system clock to be stepped in the first three updates
9 # if its offset is larger than 1 second.
10 makestep 1.0 3
11
12 # Enable kernel synchronization of the real-time clock (RTC).
13 rtcsync
14
15 # Enable hardware timestamping on all interfaces that support it.
16 #hwtimestamp *
[root@controller ~]# systemctl start chronyd.service
[root@controller ~]# systemctl enable chronyd.service
[root@controller ~]# chronyc sources
210 Number of sources = 1
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^? 202.112.7.150 0 7 0 - +0ns[ +0ns] +/- 0ns
三、计算节点部署
1、网络部署:
①、修改网卡配置
②、要求能够访问外网
③、配置hosts文件实现主机名之间映射
[root@localhost ~]# nmcli connection modify connection.autoconnect yes ens33 ipv4.addresses 10.0.0.10/24 ipv4.gateway 10.0.0.2 ipv4.dns 8.8.8.8 ipv4.method manual
[root@localhost ~]# nmcli connection down ens33
[root@localhost ~]# nmcli connection up ens33
[root@localhost ~]# ping qq.com
PING qq.com (203.205.254.157) 56(84) bytes of data.
64 bytes from 203.205.254.157 (203.205.254.157): icmp_seq=1 ttl=128 time=409 ms
64 bytes from 203.205.254.157 (203.205.254.157): icmp_seq=2 ttl=128 time=434 ms
64 bytes from 203.205.254.157 (203.205.254.157): icmp_seq=3 ttl=128 time=401 ms
64 bytes from 203.205.254.157 (203.205.254.157): icmp_seq=4 ttl=128 time=412 ms
^C
--- qq.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3027ms
rtt min/avg/max/mdev = 401.681/414.384/434.033/12.033 ms
[root@localhost ~]# cat >>/etc/hosts<<EOF
10.0.0.10 computer
10.0.0.20 controller
EOF
2、安装命令、修改主机名:
①、安装wget、net-tools(ifconfig)、bash-completion(命令填充脚本)、vim
[root@localhost ~]# yum install wget net-tools bash-completion vim -y
[root@localhost ~]# source /usr/share/bash-completion/bash_completion
[root@localhost ~]# hostnamectl set-hostname computer && bash
3、关闭SELINUX和防火墙
①、SELINUX重启验证
[root@computer ~]# sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config
[root@computer ~]# systemctl stop firewalld.service
[root@computer ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@computer ~]# getenforce
Permissive
4、NTP(网络时间协议)服务部署
①、修改配置文件
②、要求两台主机之间可以通过NTP实现时钟同步
[root@computer ~]# yum install chrony -y
[root@computer ~]# vim /etc/chrony.conf
1 # Use public servers from the pool.ntp.org project.
2 # Please consider joining the pool (http://www.pool.ntp.org/join.html).
3 server controller iburst ==>添加该项
4
5 # Record the rate at which the system clock gains/losses time.
6 driftfile /var/lib/chrony/drift
7
8 # Allow the system clock to be stepped in the first three updates
9 # if its offset is larger than 1 second.
10 makestep 1.0 3
11
12 # Enable kernel synchronization of the real-time clock (RTC).
13 rtcsync
14
15 # Enable hardware timestamping on all interfaces that support it.
16 #hwtimestamp *
[root@computer ~]# systemctl start chronyd.service
[root@computer ~]# systemctl enable chronyd.service
[root@computer ~]# chronyc sources
210 Number of sources = 1
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^? controller 0 10 0 - +0ns[ +0ns] +/- 0ns