这里写一下红帽的一键部署openstack的方式,这里说一下用packstack根据应答文件(answer-file)方式自动部署,后续再针对每个服务单独讲解。
一、Preinstallation
1、在安装之前,说一下官方给出的硬件要求最小配置:
Controller Node: 1 processor, 2 GB memory, and 5 GB storage
Network Node: 1 processor, 512 MB memory, and 5 GB storage
Compute Node: 1 processor, 2 GB memory, and 10 GB storage
2、装系统时,建议最小化安装、LVM、block storage
3、配置好yum源(openstack+rhel)
4、Red Hat Enterprise Linux Openstack与NetworkManager有冲突!!!
开始安装Openstack之前先关闭NetworkManager并启动network服务。
5、我们自己搭建的实验环境,可以把计算节点和存储、控制节点分开装,也可以都安装在一台服务器上;推荐的最小化配置是两台,其中一台用作计算,控制、存储等节点,另一台当做计算节点。
6、如果是用虚拟机搭建的环境,不要忘记开机机器的虚拟化功能,我的两台机器就是搭在vmware虚拟主机上的。
二、测试环境拓扑:
我的测试环境用172.25.4.10(servera)和172.25.4.11(serverb)
三、安装
1.在servera上安装openstack-packstack软件包
#yum -y install openstack-packstack
2.生成应答文件answer.txt
#packstack --gen-answer-file /root/answer.txt
3.修改自定义应答文件answer.txt,可根据自己的要求,更改相关配置;E.g.:
CONFIG_DEFAULT_PASSWORD=mypassword //设置默认密码 CONFIG_HEAT_INSTALL=y //安装heat组件 CONFIG_NTP_SERVERS=172.25.254.254 //设置时间服务器 CONFIG_COMPUTE_HOSTS=172.25.4.10,172.25.4.11 //安装计算节点的主机 CONFIG_KEYSTONE_ADMIN_PW=redhat //keystone管理员密码 CONFIG_CINDER_VOLUMES_CREATE=n //默认有一个cinder-volume卷组,不创建测试卷组 CONFIG_LBAAS_INSTALL=y //安装负载均衡即服务组件 CONFIG_NEUTRON_METERING_AGENT_INSTALL=y //使得ceilometer可以检测到网络数据 CONFIG_NEUTRON_FWAAS=y //配置防火墙即服务 CONFIG_NEUTRON_ML2_TYPE_DRIVERS=vlan //网络驱动模型,使用vlan划分网络 CONFIG_NEUTRON_ML2_TENANT_NETWORK_TYPES=vlan CONFIG_NEUTRON_ML2_VLAN_RANGES=physnet1:1:1000 //设置网络名称(任意字符即可)及vlan编号范围 CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS=physnet1:br-ex //设置网桥名称(物理网络绑定网桥) CONFIG_NEUTRON_OVS_BRIDGE_IFACES=br-ex:eth0 //设置网桥接口(网桥绑定网卡接口) CONFIG_HORIZON_SSL=y //安装Web管理端界面 CONFIG_HEAT_CFN_INSTALL=y //支持兼容亚马逊的HEAT API接口 CONFIG_PROVISION_DEMO=n //部署环境是否为演示环境
4.用应答文件部署openstack,用的puppet自动部署工具
#packstack --answer-file /root/answer.txt
部署过程大概需要30min左右。
5.部署完成之后,查看openstack的服务状态
#cat keystonerc_admin unset OS_SERVICE_TOKEN export OS_USERNAME=admin export OS_PASSWORD=mypassword export OS_AUTH_URL=http://172.25.4.10:5000/v2.0 export PS1=‘[\u@\h \W(keystone_admin)]\$ ‘ export OS_TENANT_NAME=admin export OS_REGION_NAME=RegionOne #source keystonerc_admin //加载环境变量 #openstack-status //查看状态 == Nova services == openstack-nova-api: active openstack-nova-cert: active openstack-nova-compute: active openstack-nova-network: inactive (disabled on boot) openstack-nova-scheduler: active openstack-nova-conductor: active == Glance services == openstack-glance-api: active openstack-glance-registry: active == Keystone service == openstack-keystone: inactive (disabled on boot) == Horizon service == openstack-dashboard: 301 == neutron services == neutron-server: active neutron-dhcp-agent: active neutron-l3-agent: active neutron-metadata-agent: active neutron-lbaas-agent: active neutron-openvswitch-agent: active neutron-metering-agent: active == Swift services == openstack-swift-proxy: active openstack-swift-account: active openstack-swift-container: active openstack-swift-object: active == Cinder services == openstack-cinder-api: active openstack-cinder-scheduler: active openstack-cinder-volume: active openstack-cinder-backup: active == Ceilometer services == openstack-ceilometer-api: active openstack-ceilometer-central: active openstack-ceilometer-compute: active openstack-ceilometer-collector: active openstack-ceilometer-alarm-notifier: active openstack-ceilometer-alarm-evaluator: active openstack-ceilometer-notification: active == Heat services == openstack-heat-api: active openstack-heat-api-cfn: active openstack-heat-api-cloudwatch: inactive (disabled on boot) openstack-heat-engine: active == Support services == mysqld: active (disabled on boot) openvswitch: active dbus: active target: active rabbitmq-server: active memcached: active == Keystone users == Warning keystonerc not sourced
6、安装完成功之后,网卡的配置已经自动更改:
[root@servera ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 DEVICETYPE=ovs TYPE=OVSPort OVS_BRIDGE=br-ex ONBOOT=yes BOOTPROTO=none [root@servera ~]# cat /etc/sysconfig/network-scripts/ifcfg-br-ex DEFROUTE=yes NAME=eth0 ONBOOT=yes IPADDR=172.25.4.10 PREFIX=24 GATEWAY=172.25.4.254 DEVICE=br-ex DEVICETYPE=ovs OVSBOOTPROTO=none TYPE=OVSBridge
四、安装完成
安装完成之后浏览器访问:https://172.25.4.10/用预先定义好的admin用户登录,之后可以进行相关操作,比如用户管理和实例的创建。
安装过程中可能遇到的报错:
1、MissingRequirements: The cinder server should contain a cinder-volumes volume group
解决办法:新建一个cinder-volumes的vg
#pvcreate /dev/sdb1 #vgcreate cinder-volumes /dev/sdb1
2、NTP报错:
Error: /usr/sbin/ntpdate 10.13.25.14 returned 1 instead of one of [0]
25 Feb 09:31:47 ntpdate[4771]: the NTP socket is in use, exiting
解决办法:
#systemctl stop ntp.service
傻白甜犯错:ntpserver 配置的是本身!!!
3、NTP的另一种报错:mNotice: /Stage[main]/Main/Exec[ntpdate]/returns: 25 Feb 09:40:42 ntpdate[7217]: no server suitable for synchronization found
解决办法:
1)在server上debug一下:
[root@serverb ~]# ntpdate -d 10.13.25.14 25 Feb 09:52:40 ntpdate[7260]: ntpdate 4.2.6p5@1.2349-o Fri Oct 16 08:51:51 UTC 2015 (1) Looking for host 10.13.25.14 and service ntp host found : servera.pod4.example.com transmit(10.13.25.14) transmit(10.13.25.14) transmit(10.13.25.14) transmit(10.13.25.14) transmit(10.13.25.14) 10.13.25.14: Server dropped: no data server 10.13.25.14, port 123 stratum 0, precision 0, leap 00, trust 000 refid [10.13.25.14], delay 0.00000, dispersion 64.00000 transmitted 4, in filter 4 reference time: 00000000.00000000 Sun, Dec 31 1899 19:00:00.000 originate timestamp: 00000000.00000000 Sun, Dec 31 1899 19:00:00.000 transmit timestamp: da7993be.d66affb9 Thu, Feb 25 2016 9:52:46.837 filter delay: 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 filter offset: 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 delay 0.00000, dispersion 64.00000 offset 0.000000 25 Feb 09:52:48 ntpdate[7260]: no server suitable for synchronization found
2) 检查服务是否启动成功,如果没启动,则start:
#systemctl status ntpd.service
3)检查ntp的版本,如果你使用的是ntp4.2(包括4.2)之后的版本,在restrict的定义中使用了notrust的话,会导致以上错误
# ntpq -c version
4)检查防火墙是否屏蔽了udp的123端口
本文出自 “Jason'blog” 博客,请务必保留此出处http://xujunxian.blog.51cto.com/8614409/1745682
原文地址:http://xujunxian.blog.51cto.com/8614409/1745682