openstack平台上创建4台Redhat6.5 64bit 虚拟机,其中一个作为puppet-master节点,其他3台作为puppet-client节点使用puppet模块安装部署glusterfs副本模式集群。信息如下
hostname(short) | FQDN | OS version | Network(eth0) | NTP server |
---|---|---|---|---|
puppet-master | puppet-master.example.com | RedHat 6.5 min+DevTools | 10.59.2.201 | 10.59.63.16 |
glusterfs01 | glusterfs01.example.com | RedHat 6.5 min+DevTools | 10.59.2.202 | 10.59.63.16 |
glusterfs02 | glusterfs02.example.com | RedHat 6.5 min+DevTools | 10.59.2.203 | 10.59.63.16 |
glusterfs03 | glusterfs03.example.com | RedHat 6.5 min+DevTools | 10.59.2.204 | 10.59.63.16 |
Puppet 要求所有机器有完整的域名,如果没有 DNS 服务器提供域名可以在两台机器上设置主机名(配置/etc/hosts文件)。需要先设置主机名再安装 Puppet,因为安装 Puppet 时会把主机名写入证书,客户端和服务端通信需要这个证书。本测试使用DNS服务,地址10.59.63.17,域名为example.com,即
[root@all-node ~#] cat /etc/resolv.conf
search example.com
nameserver 10.59.63.17
name | version | comment |
---|---|---|
puppet-server | 3.8.4 | 3系列最新版本 |
puppet | 3.8.4 | 3系列最新版本 |
puppet-dashboard | 1.2.23 | 最新稳定版本 |
glusterfs* | 3.6.6 | 3.6系列最新版本 |
ruby | 1,8.7.352 | yum源封装版本 |
mysql | 5.1.71 | yum源封装版本 |
Redhat6.5 软件源下puppet、glusterfs版本比较低,不符合我们的要求,我们需要额外下载RPM包进行安装或者直接使用源代码编译安装
软件 | 下载地址 |
---|---|
puppet | http://downloads.puppetlabs.com/puppet/ |
puppet-dashboard | http://downloads.puppetlabs.com/dashboard/ |
glusterfs | http://download.gluster.org/pub/gluster/glusterfs/3.6/3.6.6/ |
[root@puppet-master yum.repos.d]# cat epel.repo
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://10.59.63.224/epel/6/$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 6 - $basearch - Debug
baseurl=http://10.59.63.224/epel/6/$basearch/debug
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1
[root@puppet-master yum.repos.d]# cat rhel-source.repo
[rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=http://10.59.63.224/rhel6.5
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@puppet-master ~]# yum search all puppet
puppet-gluster.noarch :A Puppet module for GlusterFS
puppet-gluster-doc.noarch :A Puppet module for GlusterFS
puppet-server.noarch :Server for the puppet system management tool
puppet.noarch :A network tool for managing many disparate systems
facter.x86_64 :Command and ruby library for gathering system information
[root@puppet-master ~]# yum info puppet-server
Name : puppet-server
Arch : noarch
Version : 2.7.26
Release : 2.el6
Repo : epel
Summary : Server for the puppet system management tool
[root@puppet-master ~]# yum info puppet-gluster
Name : puppet-gluster
Arch : noarch
Version : 0.0.3
Release : 1.el6
Repo : epel
Summary : A Puppet module for GlusterFS
[root@puppet-master ~]# yum info glusterfs
Name : glusterfs
Arch : x86_64
Version : 3.4.0.36rhs
Release : 1.el6
Repo : rhel-source
Summary : Cluster File System
可以看到本地源封装的puppet以及gluster模块包版本比较低,本文档采用采用在线下载rpm方式部署比较新的版本。
# 关闭selinux
[root@puppet-master ~]# sed -i '/SELINUX/ s/enforcing/disabled/g' /etc/selinux/config
# 停止iptables服务,并禁止自启动
[root@puppet-master ~]# chkconfig iptables off
[root@puppet-master ~]# service iptables stop
安装配置ntp服务
[root@puppet-master ~]# yum install ntp
[root@puppet-master ~]# chkconfig ntpd on
[root@puppet-master ~]# service ntpd start
[root@puppet-master ~]# cp /etc/ntpd.conf /etc/ntpd.conf.ori
# 配置npt.conf,完成后如下
[root@puppet-master ~]# cat /etc/ntp.conf
server 10.59.63.16
driftfile /var/lib/ntp/drift
keys /etc/ntp/keys
[root@puppet-master ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*10.59.63.16 202.112.31.197 3 u 78 128 377 0.534 -2.059 0.450
本实验采用DNS服务器,所以该步骤不会执行,而是如开头编辑/etc/resolv.cof配置DNS域名解析。
如果没有使用DNS服务,需要puppet-master以及各个puppetclient节点配置hostname解析
[root@XXXXXX ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.59.2.201 puppet-master puppet-master.example.com
10.59.2.202 glusterfs01 glusterfs01.example.com
10.59.2.203 glusterfs02 glusterfs02.example.com
10.59.2.204 glusterfs03 glusterfs03.example.com