1.1 配置hosts文件(集群所有电脑配置)
[root@controller1:/root]# vim /etc/hosts 192.168.110.121 controller1 192.168.110.122 controller2 192.168.110.123 controller3 192.168.110.120 VirtualIP 192.168.110.124 ceph 192.168.110.119 compute1 192.168.110.118 compute2 192.168.110.117 compute3 [root@controller1:/root]# scp /etc/hosts controller2:/etc/ [root@controller1:/root]# scp /etc/hosts controller3:/etc/ [root@controller1:/root]# scp /etc/hosts ceph:/etc/ [root@controller1:/root]# scp /etc/hosts compute1:/etc/ [root@controller1:/root]# scp /etc/hosts compute2:/etc/ [root@controller1:/root]# scp /etc/hosts compute3:/etc/
1.2 节点间设置免密互相登陆
[root@controller1:/root]# ssh-keygen ssh-copy-id controller2 ssh-copy-id controller3 ssh-copy-id ceph ssh-copy-id compute1 ssh-copy-id compute2 ssh-copy-id compute3 [root@controller2:/root]# ssh-keygen ssh-copy-id controller1 ssh-copy-id controller3 ssh-copy-id ceph ssh-copy-id compute1 ssh-copy-id compute2 ssh-copy-id compute3 [root@controller3:/root]# ssh-keygen ssh-copy-id controller1 ssh-copy-id controller2 ssh-copy-id ceph ssh-copy-id compute1 ssh-copy-id compute2 ssh-copy-id compute3
1.3 配置NTP服务
1.3.1 在控制节点进行配置(controller1、controller2、controller3)
[root@controller1:/root]# yum install system-config-date -y [root@controller1:/root]# vim /etc/chrony.conf 3 server 0.centos.pool.ntp.org iburst 4 server 192.168.110.121 iburst 5 server 192.168.110.122 iburst 6 server 192.168.110.123 iburst 25 # Allow NTP client access from local network. 26 allow 192.168.0.0/16 [root@controller1:/root]# scp /etc/chrony.conf controller2:/etc/chrony.conf [root@controller1:/root]# scp /etc/chrony.conf controller3:/etc/chrony.conf [root@controller1:/root]# systemctl enable chronyd && systemctl restart chronyd [root@controller1:/root]# systemctl status chronyd [root@controller2:/root]# systemctl enable chronyd && systemctl restart chronyd [root@controller2:/root]# systemctl status chronyd [root@controller3:/root]# systemctl enable chronyd && systemctl restart chronyd [root@controller3:/root]# systemctl status chronyd [root@controller1:/root]# chronyc sources 210 Number of sources = 3 MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^? controller2 0 7 0 - +0ns[ +0ns] +/- 0ns ^? controller3 0 7 0 - +0ns[ +0ns] +/- 0ns ^* 119.28.206.193 2 6 37 21 +197us[+1847us] +/- 55ms [root@controller2:/root]# chronyc sources 210 Number of sources = 3 MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^? controller1 0 7 0 - +0ns[ +0ns] +/- 0ns ^? controller3 0 7 0 - +0ns[ +0ns] +/- 0ns ^* 162.159.200.123 3 6 37 51 +2273us[ +143us] +/- 121ms [root@controller3:/root]# chronyc sources 210 Number of sources = 3 MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^? controller1 0 8 0 - +0ns[ +0ns] +/- 0ns ^? controller2 0 8 0 - +0ns[ +0ns] +/- 0ns ^? tick.ntp.infomaniak.ch 0 8 0 - +0ns[ +0ns] +/- 0ns [root@controller1:/root]# ssh controller2 'date'; ssh controller3 'date' ; date Thu Jul 30 14:35:47 CST 2020 Thu Jul 30 14:35:47 CST 2020 Thu Jul 30 14:35:47 CST 2020
1.3.2 在其他节点上安装NTP软件(ceph、compute1、compute2、compute3)
[root@ceph:/root]# yum install chrony -y [root@compute1:/root]# yum install chrony -y [root@compute2:/root]# yum install chrony -y [root@compute3:/root]# yum install chrony -y [root@ceph:/root]# vim /etc/chrony.conf 3 server 192.168.110.122 iburst 4 server 192.168.110.121 iburst 5 server 192.168.110.123 iburst 6 #server 3.centos.pool.ntp.org iburst [root@compute1:/root]# vim /etc/chrony.conf 3 server 192.168.110.122 iburst 4 server 192.168.110.121 iburst 5 server 192.168.110.123 iburst 6 #server 3.centos.pool.ntp.org iburst [root@compute2:/root]# vim /etc/chrony.conf 3 server 192.168.110.122 iburst 4 server 192.168.110.121 iburst 5 server 192.168.110.123 iburst 6 #server 3.centos.pool.ntp.org iburst [root@compute3:/root]# vim /etc/chrony.conf 3 server 192.168.110.122 iburst 4 server 192.168.110.121 iburst 5 server 192.168.110.123 iburst 6 #server 3.centos.pool.ntp.org iburst [root@ceph:/root]# systemctl enable chronyd && systemctl restart chronyd [root@ceph:/root]# systemctl status chronyd [root@compute1:/root]# systemctl enable chronyd && systemctl restart chronyd [root@compute1:/root]# systemctl status chronyd [root@compute2:/root]# systemctl enable chronyd && systemctl restart chronyd [root@compute2:/root]# systemctl status chronyd [root@compute3:/root]# systemctl enable chronyd && systemctl restart chronyd [root@compute3:/root]# systemctl status chronyd [root@ceph:/root]# chronyc sources 210 Number of sources = 3 MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^? controller2 0 7 0 - +0ns[ +0ns] +/- 0ns ^? controller1 0 7 0 - +0ns[ +0ns] +/- 0ns ^? controller3 0 7 0 - +0ns[ +0ns] +/- 0ns [root@ceph:/root]# timedatectl Local time: Fri 2020-07-03 15:45:12 CST Universal time: Fri 2020-07-03 07:45:12 UTC RTC time: Fri 2020-07-03 07:45:12 Time zone: Asia/Shanghai (CST, +0800) NTP enabled: yes NTP synchronized: no RTC in local TZ: no DST active: n/a [root@compute1:/root]# chronyc sources 210 Number of sources = 3 MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^? controller2 0 7 0 - +0ns[ +0ns] +/- 0ns ^? controller1 0 7 0 - +0ns[ +0ns] +/- 0ns ^? controller3 0 7 0 - +0ns[ +0ns] +/- 0ns [root@compute1:/root]# timedatectl Local time: Fri 2020-07-03 15:45:12 CST Universal time: Fri 2020-07-03 07:45:12 UTC RTC time: Fri 2020-07-03 07:45:12 Time zone: Asia/Shanghai (CST, +0800) NTP enabled: yes NTP synchronized: no RTC in local TZ: no DST active: n/a [root@compute2:/root]# chronyc sources 210 Number of sources = 3 MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^? controller2 0 7 0 - +0ns[ +0ns] +/- 0ns ^? controller1 0 7 0 - +0ns[ +0ns] +/- 0ns ^? controller3 0 7 0 - +0ns[ +0ns] +/- 0ns [root@compute2:/root]# timedatectl Local time: Fri 2020-07-03 15:45:12 CST Universal time: Fri 2020-07-03 07:45:12 UTC RTC time: Fri 2020-07-03 07:45:12 Time zone: Asia/Shanghai (CST, +0800) NTP enabled: yes NTP synchronized: no RTC in local TZ: no DST active: n/a
1.4 系统初始设置
1.4.1 所有节点关闭防火墙和selinux
systemctl stop firewalld && systemctl disable firewalld setenforce 0 sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config
1.4.2 所有节点编辑limits.conf和sysctl.conf文件
cat >>/etc/security/limits.conf<<eof * soft nofile 65536 * hard nofile 65536 eof cat >>/etc/sysctl.conf<<eof fs.file-max=655350 net.ipv4.ip_local_port_range = 1025 65000 net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_nonlocal_bind = 1 eof sysctl -p