作者:独笔孤行@TaoCloud
OpenStack自动安装比手动搭建消耗的硬件资源较大,因此虚拟机或服务器最低配置为4核CPU+8G内存+20G磁盘,并开启CPU虚拟化。建议配置为8核CPU+16G内存或更高配置,并保证服务器能访问外网。
本次主要测试的成功案例有N、P、Q三个版本,其它版本同样可以借助packstack一键安装OpenStack,安装方式相同。只是Yum源的配置不同而已,主要区别也在于yum源的配置。
成功案例1:Q版OpenStack自动安装
操作系统:CentOS7.5minimal(其它系统同样支持)
硬件配置:4vCPU+8G Memory+20G磁盘
1.关闭并禁用防火墙:
# systemctl stop firewalld
# systemctl disable firewalld
# systemctl stop NetworkManager
# systemctl disable NetworkManager
2.关闭selinux:
# setenforce 0
3.编辑/etc/selinux/config文件内容,将SELINUX值enforcing改为disabled:
SELINUX=disabled
4.配置yum源:
# yum install -y http://rdo.fedorapeople.org/rdo-release.rpm
5.安装packstack工具
# yum install -y openstack-packstack
6.Packstack一键安装:
# packstack --allinone
注解
无网络异常时,安装时间最多不过30分钟,如果有任务长时间执行无返回结果,需要查看相关日志查找问题。
成功案例2:N版OpenStack自动安装
操作系统:CentOS7.4minimal(其它系统同样支持)
硬件配置:4vCPU+8G Memory+20G磁盘
1.关闭并禁用防火墙:
# systemctl stop firewalld
# systemctl disable firewalld
# systemctl stop NetworkManager
# systemctl disable NetworkManager
2.关闭selinux:
# setenforce 0
3.编辑/etc/selinux/config文件内容,将SELINUX值enforcing改为disabled:
SELINUX=disabled
4.制作OpenStack-Newton网络源
cat /etc/yum.repos.d/CentOS-OpenStack-Newton.repo
[OpenStack-Newton]
name=OpenStack-Newton
baseurl=http://vault.centos.org/7.4.1708/cloud/x86_64/openstack-newton/
gpgcheck=0
enabled=1
5.安装kvm源
yum install http://mirrors.163.com/centos/7.5.1804/virt/x86_64/kvm-common/centos-release-qemu-ev-1.0-1.el7.noarch.rpm
6.安装packstack工具
# yum install openstack-packstack
7.Packstack一键安装:
# packstack --allinone
注解
无网络异常时,安装时间最多不过30分钟,如果有任务长时间执行无返回结果,需要查看相关日志查找问题。
成功案例3:M版OpenStack自动安装
操作系统:CentOS7.5minimal(其它系统同样支持)
硬件配置:4vCPU+8G Memory+20G磁盘
1.关闭并禁用防火墙及NetworkManager:
systemctl stop firewalld
systemctl disable firewalld
systemctl stop NetworkManager
systemctl disable NetworkManager
2.关闭selinux:
setenforce 0
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
3.配置OpenStack-Mitaka网络源
cat /etc/yum.repos.d/CentOS-OpenStack.repo
[OpenStack-Mitaka]
name=OpenStack-Mitaka
baseurl=http://vault.centos.org/7.2.1511/cloud/x86_64/openstack-mitaka/
enabled=1
gpgcheck=0
4.添加域名解析
echo "192.168.3.87 mitaka" >> /etc/hosts
域名解析非常重要,一定要添加。其中192.168.3.87是服务器ip地址,mitaka是主机名hostname,可根据实际内容进行替换。
5.安装packstack工具
# yum install openstack-packstack libvirt
7.Packstack一键安装:
# packstack --allinone
注解
若出现与mariadb相关报错,可能是新装mariadb包与原有包版本冲突,卸载原有包即可。
成功案例4:P版OpenStack自动安装。
操作系统:CentOS7.2(其它系统同样支持)
硬件配置:4vCPU+8G Memory+20G磁盘
1.关闭并禁用防火墙:
# systemctl stop firewalld
# systemctl disable firewalld
# systemctl stop NetworkManager
# systemctl disable NetworkManager
2.关闭selinux:
# setenforce 0
编辑/etc/selinux/config文件内容,将SELINUX值enforcing改为disabled:
SELINUX=disabled
3.配置p版yum源
# yum install centos-release-openstack-pike.x86_64
4.禁用掉无法使用的CentOS-QEMU-EV.repo源,可直接删除该源文件。
# rm -rf /etc/yum.repos.d/CentOS-QEMU-EV.repo
5.手动配置可用的KVM源
[root@OpenStackPike ~]# cat /etc/yum.repos.d/CentOS-KVM.repo
[CentOS-KVM]
name=CentOS-KVM
baseurl=http://mirror.centos.org/centos/7/virt/x86_64/kvm-common/
gpgcheck=0
enabled=1
6.配置kvm源或执行以下命令安装:
# rpm -ivh http://mirror.centos.org/centos/7/virt/x86_64/kvm-common/centos-release-qemu-ev-1.0-1.el7.noarch.rpm
7.配置好yum源后安装applydeltarpm包,防止自动安装时报错。
# yum install deltarpm -y
8.安装packstack工具
# yum install openstack-packstack
9.Packstack一键安装:
# packstack --allinone
常见故障处理排查及使用方法
如下提到的处理方法,适用于以上三个版本的PackStack方式安装。
1.常见错误:
Testing if puppet apply is finished :192.168.20.200_controller.pp
安装过程卡在此步骤没有任何反应。
分析:网络正常情况下此过程不超过30分钟。时间过长时,需要确认关闭NetworkManger、selinux、firewalld。还可检查硬件配置,建议4核CPU+8GB内存或更高配置。还无法解决后可添加至2个网卡、2个磁盘。
2.PackStack日志信息:
PackStack安装过程中的日志在 /var/tmp/packstack/ 目录中。无法解决问题时可查看该目录下相关日志信息。
3.常见认证文件:
执行packstack --allinone安装命令后,会在执行目录下生成
keystonerc_admin 、keystonerc_demo、packstack-answers-20181025-111102.txt三个文件。可查看keystonerc_admin文件内容获取登录Dashboard的用户名和密码。安装过程的相关配置信息记录在packstack-answers-20181025-111102.txt文件中。执行OpenStack操作命令前需要执行source keystonerc_admin命令h获取管理员认证。
4.安装成功过程记录:
[root@newton ~]# packstack --allinone
Welcome to the Packstack setup utility
The installation log file is available at: /var/tmp/packstack/20181025-111101-o7nt5l/openstack-setup.log
Packstack changed given value to required value /root/.ssh/id_rsa.pub
Installing:
Clean Up [ DONE ]
Discovering ip protocol version [ DONE ]
Setting up ssh keys [ DONE ]
Preparing servers [ DONE ]
Pre installing Puppet and discovering hosts' details [ DONE ]
Preparing pre-install entries [ DONE ]
Setting up CACERT [ DONE ]
Preparing AMQP entries [ DONE ]
Preparing MariaDB entries [ DONE ]
Fixing Keystone LDAP config parameters to be undef if empty[ DONE ]
Preparing Keystone entries [ DONE ]
Preparing Glance entries [ DONE ]
Checking if the Cinder server has a cinder-volumes vg[ DONE ]
Preparing Cinder entries [ DONE ]
Preparing Nova API entries [ DONE ]
Creating ssh keys for Nova migration [ DONE ]
Gathering ssh host keys for Nova migration [ DONE ]
Preparing Nova Compute entries [ DONE ]
Preparing Nova Scheduler entries [ DONE ]
Preparing Nova VNC Proxy entries [ DONE ]
Preparing OpenStack Network-related Nova entries [ DONE ]
Preparing Nova Common entries [ DONE ]
Preparing Neutron LBaaS Agent entries [ DONE ]
Preparing Neutron API entries [ DONE ]
Preparing Neutron L3 entries [ DONE ]
Preparing Neutron L2 Agent entries [ DONE ]
Preparing Neutron DHCP Agent entries [ DONE ]
Preparing Neutron Metering Agent entries [ DONE ]
Checking if NetworkManager is enabled and running [ DONE ]
Preparing OpenStack Client entries [ DONE ]
Preparing Horizon entries [ DONE ]
Preparing Swift builder entries [ DONE ]
Preparing Swift proxy entries [ DONE ]
Preparing Swift storage entries [ DONE ]
Preparing Gnocchi entries [ DONE ]
Preparing MongoDB entries [ DONE ]
Preparing Redis entries [ DONE ]
Preparing Ceilometer entries [ DONE ]
Preparing Aodh entries [ DONE ]
Preparing Nagios server entries [ DONE ]
Preparing Nagios host entries [ DONE ]
Preparing Puppet manifests [ DONE ]
Copying Puppet modules and manifests [ DONE ]
Applying 192.168.20.200_controller.pp
192.168.20.200_controller.pp: [ DONE ]
Applying 192.168.20.200_network.pp
192.168.20.200_network.pp: [ DONE ]
Applying 192.168.20.200_compute.pp
192.168.20.200_compute.pp: [ DONE ]
Applying Puppet manifests [ DONE ]
Finalizing [ DONE ]
**** Installation completed successfully ******
Additional information:
* A new answerfile was created in: /root/packstack-answers-20181025-111102.txt
* Time synchronization installation was skipped. Please note that unsynchronized time on server instances might be problem for some OpenStack components.
* Warning: NetworkManager is active on 192.168.20.200. OpenStack networking currently does not work on systems that have the Network Manager service enabled.
* File /root/keystonerc_admin has been created on OpenStack client host 192.168.20.200. To use the command line tools you need to source the file.
* To access the OpenStack Dashboard browse to http://192.168.20.200/dashboard .
Please, find your login credentials stored in the keystonerc_admin in your home directory.
* To use Nagios, browse to http://192.168.20.200/nagios username: nagiosadmin, password: 97167e4c4377483d
* The installation log file is available at: /var/tmp/packstack/20181025-111101-o7nt5l/openstack-setup.log
* The generated manifests are available at: /var/tmp/packstack/20181025-111101-o7nt5l/manifests
以上过程为安装成功时的全部信息,由于没有关闭NetworkManager导致出现警告信息,需要手动执行如下命令关闭NetworkManager:
systemctl disable NetworkManger
systemctl stop NetworkManager
5.未添加域名解析报错
安装过程出现以下报错内容时,则说明域名解析存在问题,需要检查/etc/hosts文件中的域名解析是否正确。一般在Mitaka版一键安装中较常见。
Welcome to the Packstack setup utility
The installation log file is available at: /var/tmp/packstack/20190307-112130-xbH_fv/openstack-setup.log
Installing:
......
Applying 192.168.3.87_prescript.pp
192.168.3.87_prescript.pp: [ DONE ]
Applying 192.168.3.87_amqp.pp
Applying 192.168.3.87_mariadb.pp
192.168.3.87_amqp.pp: [ ERROR ]
Applying Puppet manifests [ ERROR ]
ERROR : Error appeared during Puppet run: 192.168.3.87_amqp.pp
Error: Could not start Service[rabbitmq-server]: Execution of '/usr/bin/systemctl start rabbitmq-server' returned 1: Job for rabbitmq-server.service failed because the control process exited with error code. See "systemctl status rabbitmq-server.service" and "journalctl -xe" for details.
You will find full trace in log /var/tmp/packstack/20190307-112130-xbH_fv/manifests/192.168.3.87_amqp.pp.log
Please check log file /var/tmp/packstack/20190307-112130-xbH_fv/openstack-setup.log for more information
Additional information:
* A new answerfile was created in: /root/packstack-answers-20190307-112131.txt
* Time synchronization installation was skipped. Please note that unsynchronized time on server instances might be problem for some OpenStack components.
* File /root/keystonerc_admin has been created on OpenStack client host 192.168.3.87. To use the command line tools you need to source the file.
* To access the OpenStack Dashboard browse to http://192.168.3.87/dashboard .
Please, find your login credentials stored in the keystonerc_admin in your home directory.
* To use Nagios, browse to http://192.168.3.87/nagios username: nagiosadmin, password: 15f559006ea94478
由于国内yum网络源经常更新,以上yum源如有无法访问情况,可在评论去留言,以便我及时更新。