openstack-packstack一键式在线部署

openstack重点了解的就是服务

前言:

OpenStack覆盖了网络、虚拟化、操作系统、服务器等各个方面。

2017年2月OpenStack发布了最新版本Ocata.一般情况下,每半年左右更新- -次版本。

一:常见的8个核心项目(即OpenStack服务)

序号 服务 项目名称 描述
1 Compute(计算服务) Nova 负责实例生命周期的管理,计算资源的单位。对Hypervisor进行屏蔽,支持多种虚拟化技术(红帽默认为KVM),支持横向扩展。
2 Network(网络服务) Neutron 负责虚拟网络的管理,为实例创建网络的拓扑结构。是面向租户的网络管理,可以自定义网络,并使租户之间互不影响。
3 Identity(身份认证服务) Keystore 类似于LDAP服务,对用户、租户和角色、服务进行认证与授权,并且支持多认证机制。
4 Dashboard(控制面板服务) Horizon 提供一个Web管理界面,与OpenStack底层服务进行交互。
5 Image Service(镜像服务) Glance 提供虚拟机镜像模板的注册与管理,将做好的操作系统复制为镜像模板,在创建虚拟机时直接使用。可支持多格式的镜像。
6 Block Storage(块存储服务) Cinder 负责为运行实例提供持久的块存储设备,可进行方便的扩展,按需付费,支持多种后端存储。
7 0bject Storage(对象存储服务) Swift 为OpenStack提供基于云的弹性存储,支持集群无单点故障。
8 Telemetry(计量服务) Ceilometer 用于度量、监控和控制数据资源的集中来源,为OpenStack用户提供记账途径。

二:OpenStack优势

  • 控制性:完全开源的平台,模块化的设计,提供相应的API接口,方便与第三方技术集成,从而满足自身业务需求。

  • 兼容性: OpenStack 兼容其他公有云,方便用户进行数据迁移
    可扩展性: Openstack 采用模块化的设计,支持主流发行版本的Linux,可以通过横向扩展,增加节点、添加资源。

  • 灵活性:用户可以根据自己的需要建立基础设施,也可以轻松地为自己的群集增加规模。Openstack项目采用Apache2许可,意味着第三方厂家可以重新发布源代码。

    OpenStack在控制性、兼容性、可扩展性、灵活性方面具备有优势,它可能成为云计算领域的行业标准。

三:OpenStack一键部署

3.1 实验环境

本次使用packstack工具实现一键部署OpenStack。

通过该安装工具,只需简单运行一条命令,即可以快速部署OpenStack, 省去繁琐的安装步骤,而直接体验OpenStack的管理及使用。

本次实验需要提前部署一台新安装的操作系统主机,要求能访问互联网,主机的系统采用最小化方式安装即可。

安装部署OpenStack环境的硬件设备的最低配置要求

CPU 4核

内存 8G

磁盘 30G

网络 NAT,还有一张自定义网卡

3.2 实验步骤

3.2.1 创建新服务器节点

最小化安装,记得处理器勾选虚拟模式

openstack-packstack一键式在线部署_第1张图片

openstack-packstack一键式在线部署_第2张图片

配置环境,修改主机名

[root@localhost ~]# hostnamectl set-hostname openstack
[root@localhost ~]# su
[root@openstack ~]# 

修改hosts文件

[root@openstack ~]# vi /etc/hosts
192.168.247.3   openstack

关闭防火墙,核心防护

[root@openstack ~]# systemctl stop firewalld
[root@openstack ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@openstack ~]# setenforce 0
[root@openstack ~]# vi /etc/selinux/config 
SELINUX=disabled

关闭网络管理工具

[root@openstack ~]# systemctl disable NetworkManager 
Removed symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service.
Removed symlink /etc/systemd/system/network-online.target.wants/NetworkManager-wait-online.service.
[root@openstack ~]# systemctl stop NetworkManager

重启

[root@openstack ~]# reboot

3.2.2 获取repo

[root@openstack ~]# vi /etc/resolv.conf
nameserver 8.8.8.8
[root@openstack ~]# ping 192.168.247.2
PING 192.168.247.2 (192.168.247.2) 56(84) bytes of data.
64 bytes from 192.168.247.2: icmp_seq=1 ttl=128 time=0.575 ms
64 bytes from 192.168.247.2: icmp_seq=2 ttl=128 time=0.434 ms
^C
--- 192.168.247.2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.434/0.504/0.575/0.073 ms
[root@openstack ~]# ping www.baidu.com
ping: www.baidu.com: Name or service not known
[root@openstack ~]# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=128 time=113 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=128 time=118 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=128 time=127 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=128 time=126 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=128 time=117 ms
^C
--- 8.8.8.8 ping statistics ---
6 packets transmitted, 5 received, 16% packet loss, time 5007ms
rtt min/avg/max/mdev = 113.755/120.764/127.661/5.399 ms
[root@openstack ~]# ping www.baidu.com
ping: www.baidu.com: Name or service not known


[root@openstack ~]# ping www.baidu.com
PING www.a.shifen.com (183.232.231.172) 56(84) bytes of data.
64 bytes from 183.232.231.172 (183.232.231.172): icmp_seq=1 ttl=128 time=31.5 ms
64 bytes from 183.232.231.172 (183.232.231.172): icmp_seq=2 ttl=128 time=31.5 ms
64 bytes from 183.232.231.172 (183.232.231.172): icmp_seq=3 ttl=128 time=31.5 ms
^C
--- www.a.shifen.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2004ms
rtt min/avg/max/mdev = 31.502/31.523/31.558/0.206 ms
[root@openstack ~]# cd /etc/yum.repos.d/
[root@openstack yum.repos.d]# ls
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo  CentOS-Sources.repo
CentOS-CR.repo    CentOS-fasttrack.repo  CentOS.repo        CentOS-Vault.repo
[root@openstack yum.repos.d]# mkdir bak
[root@openstack yum.repos.d]# mv C* bak/
[root@openstack yum.repos.d]# curl -o /etc/yum.repos.d/CentOS.repo http://mirrors.aliyun.com/repo/Centos-7.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2523  100  2523    0     0  68045      0 --:--:-- --:--:-- --:--:-- 70083
[root@openstack yum.repos.d]# ll
total 4
drwxr-xr-x 2 root root  206 Feb 21 14:25 bak
-rw-r--r-- 1 root root 2523 Feb 21 14:25 CentOS.repo

3.2.3 yum安装openstack-train

[root@openstack yum.repos.d]# yum -y install centos-release-openstack-train
[root@openstack yum.repos.d]# ll
total 24
drwxr-xr-x 2 root root  206 Feb 21 14:25 bak
-rw-r--r-- 1 root root  956 Jun 19  2019 CentOS-Ceph-Nautilus.repo
-rw-r--r-- 1 root root  715 Jun 19  2019 CentOS-NFS-Ganesha-28.repo
-rw-r--r-- 1 root root 1290 Oct 23 01:26 CentOS-OpenStack-train.repo
-rw-r--r-- 1 root root  612 Feb  1  2019 CentOS-QEMU-EV.repo
-rw-r--r-- 1 root root 2523 Feb 21 14:25 CentOS.repo
-rw-r--r-- 1 root root  353 Jul 31  2018 CentOS-Storage-common.repo

更新yum缓存

[root@openstack yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base centos-ceph-nautilus centos-nfs-ganesha28 centos-openstack-train
              : centos-qemu-ev extras updates
Cleaning up list of fastest mirrors
[root@openstack yum.repos.d]# yum makecache

时间同步

[root@openstack yum.repos.d]# yum -y install ntpdate

[root@openstack yum.repos.d]# ntpdate ntp.aliyun.com >> /var/log/ntpdate.log

[root@openstack yum.repos.d]# crontab -e 
no crontab for root - using an empty one
crontab: installing new crontab
[root@openstack yum.repos.d]# systemctl restart crond
[root@openstack yum.repos.d]# systemctl enable crond

[root@localhost ~]# tail -f /var/log/ntpdate.log    ###动态查看更新日志文件,这条命令可以不敲

安装openstack-packstack

[root@openstack yum.repos.d]# yum -y install openstack-packstack 
[root@openstack yum.repos.d]# packstack --allinone		在线部署
Testing if puppet apply is finished: 192.168.247.3_controller.pp  [ / ]	这个是等待的意思

tail -f /var/log/

[root@openstack ~]# tail -f /var/log/messages	在线查看安装日志

显示成功

 **** Installation completed successfully ******

Additional information:

- Parameter CONFIG_NEUTRON_L2_AGENT: You have chosen OVN Neutron backend. Note that this backend does not support the VPNaaS or FWaaS services. Geneve will be used as the encapsulation method for tenant networks
- A new answerfile was created in: /root/packstack-answers-20200221-143136.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.247.3. To use the command line tools you need to source the file.
- To access the OpenStack Dashboard browse to http://192.168.247.3/dashboard .
  Please, find your login credentials stored in the keystonerc_admin in your home directory.
- The installation log file is available at: /var/tmp/packstack/20200221-143136-tbr4ug/openstack-setup.log
- The generated manifests are available at: /var/tmp/packstack/20200221-143136-tbr4ug/manifests
  [root@openstack yum.repos.d]# 

查看账户密码

[root@openstack yum.repos.d]# cd /root

[root@openstack ~]# ls
anaconda-ks.cfg  keystonerc_admin  keystonerc_demo  packstack-answers-20200221-143136.txt
[root@openstack ~]# ll
total 64
-rw-------. 1 root root  1632 Feb 21  2020 anaconda-ks.cfg
-rw-------  1 root root   373 Feb 21 14:35 keystonerc_admin
-rw-------  1 root root   318 Feb 21 14:35 keystonerc_demo
-rw-------  1 root root 51648 Feb 21 14:31 packstack-answers-20200221-143136.txt

[root@openstack ~]# cat /root/keystonerc_admin 
unset OS_SERVICE_TOKEN
    export OS_USERNAME=admin
    export OS_PASSWORD='4dc0395edf0a4fe7'
    export OS_REGION_NAME=RegionOne
    export OS_AUTH_URL=http://192.168.247.3:5000/v3
    export PS1='[\u@\h \W(keystone_admin)]\$ '
    
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_IDENTITY_API_VERSION=3

http://192.168.247.3/dashboard/

export OS_USERNAME=admin
export OS_PASSWORD='4dc0395edf0a4fe7'

openstack-packstack一键式在线部署_第3张图片

这种模式就跟阿里云的一样了

接下来可以上传镜像文件,或者其他源文件,去创建实例

创建实例的数量和质量需要看物理主机的硬件配置

上传镜像文件,

###上传镜像CentOS-7-x86_64-DVD-1810.iso去opt###
[root@localhost ~]# source keystonerc_admin   ###遇到报错Missing value auth-url required for auth plugin password 解决
[root@localhost ~(keystone_admin)]# ll
总用量 116
-rw-------. 1 root root  1308 4月  22 05:00 anaconda-ks.cfg
-rw-------  1 root root   331 4月  28 00:55 keystonerc_admin
-rw-------  1 root root   312 4月  28 00:55 keystonerc_demo
-rw-------  1 root root 49523 4月  28 00:07 packstack-answers-20190428-000742.txt
-rw-------  1 root root 49523 4月  28 01:33 packstack-answers-20190428-013352.txt

[root@localhost ~(keystone_admin)]# openstack image create --container-format bare --disk-format iso --public --file CentOS-7-x86_64-DVD-1810.iso ISO_CentOS7.6
[Errno 2] 没有那个文件或目录: u'CentOS-7-x86_64-DVD-1810.iso'
[root@localhost ~(keystone_admin)]# cd /opt
[root@localhost opt(keystone_admin)]# ll
总用量 4481024
-rw-r--r-- 1 root root 4588568576 4月  28 02:02 CentOS-7-x86_64-DVD-1810.iso
drwxr-xr-x 3 root root         22 4月  28 02:12 stack
[root@localhost opt(keystone_admin)]# openstack image create --container-format bare --disk-format iso --public --file CentOS-7-x86_64-DVD-1810.iso ISO_CentOS7.6
+------------------+------------------------------------------------------+
| Field            | Value                                                |
+------------------+------------------------------------------------------+
| checksum         | 5b61d5b378502e9cba8ba26b6696c92a                     |
| container_format | bare                                                 |
| created_at       | 2019-04-27T18:15:22Z                                 |
| disk_format      | iso                                                  |
| file             | /v2/images/9a3469e6-4bde-4544-8fe3-daa909c6682d/file |
| id               | 9a3469e6-4bde-4544-8fe3-daa909c6682d                 |
| min_disk         | 0                                                    |
| min_ram          | 0                                                    |
| name             | ISO_CentOS7.6                                        |
| owner            | c44490a1222c4a23861b4b87147a744c                     |



| protected        | False                                                |
| schema           | /v2/schemas/image                                    |
| size             | 4588568576                                           |
| status           | active                                               |
| tags             |                                                      |
| updated_at       | 2019-04-27T18:16:01Z                                 |
| virtual_size     | None                                                 |
| visibility       | public                                               |
+------------------+------------------------------------------------------+

上述镜像上传完毕,可以在网页创建实例装系统了

| 2019-04-27T18:16:01Z |
| virtual_size | None |
| visibility | public |
±-----------------±-----------------------------------------------------+




上述镜像上传完毕,可以在网页创建实例装系统了

你可能感兴趣的:(LINUX,openstack)