ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
在创建集群工作之前,需要对centos mini系统进行相关准备工作,分别是关闭防火墙和selinux、设置机器IP及hostname、配置内部yum安装源、安装基本的操作工具和设置ntp时间同步。 (1)开机设置关闭防火墙和关闭selinux ``` systemctl stop firewalld.service systemctl disable firewalld.service sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config setenforce 0 ``` (2)配置yum源 为了使实验环境下centos安装源都不走外网,所以安装主机的内部yum源。其中包括mariadb、openstack、centos7、epel 、pcs的yum源包。 yum.repos.d配置文件 ``` [mariadb] name=mariadb baseurl= http://192.168.0.14/mariadb10.1/ enabled=1 gpgcheck=0 [openstack] name=openstack-newton baseurl=http://192.168.0.14/openstack-newton/ enabled=1 gpgcheck=0 [centos] name=centos7.2 baseurl=http://192.168.0.14/centos7.2/7.2/os/x86_64/ enabled=1 gpgcheck=0 [epel] name=epel baseurl=http://192.168.0.14/epel/7/x86_64/ enabled=1 gpgcheck=0 ``` ``` yum clean all #清空yum缓存 yum repolist all #查看可用的yum仓库 ``` (3)配置yum源之后,因为系统是最小化安装的,需要安装基础工具环境,开始安装基本工具和软件: ``` yum install net-tools wget vim ntpdate bash-completion gcc gcc-c++ ``` (4)更改hostname 让ip地址与host映射,便于在集群环境的文件传输,另外相关配置文件通过hostname来设置配置参数。 vim /etc/hosts 内容如下: ``` 10.1.1.150 controller1 controller1.yjscloud.com 10.1.1.151 controller2 controller2.yjscloud.com 10.1.1.152 controller3 controller3.yjscloud.com 10.1.1.153 computer1 computer1.yjscloud.com 10.1.1.154 computer2 computer2.yjscloud.com 10.1.1.155 nfs1 nfs1.yjscloud.com 10.1.1.156 cidner1 cinder1.yjscloud.com 192.168.0.168 yjscloud.com ``` nfs1 ##根据对应的主机设置主机名 hostnamectl set-hostname nfs1 (5)ntp时间同步 在安装完Centos系统,时间可能会跟当前时区不一致,云集群需要保证整个集群时间同步。在每个节点系统中安装时间同步,使得各个节点联网同步标准时间,保证时间准确性。 在所有节点上执行以下操作: yum install ntp ntpdate ntp-doc #安装ntp服务 vim /etc/ntp.conf #编辑配置文件 Server ntp1.aliyun.com iburst #联网阿里云ntp获得标准时间 重启ntp服务: ``` systemctl enable ntpd.service systemctl restart ntpd.service ```