devstack部署

Posted wangziqiang123

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了devstack部署相关的知识,希望对你有一定的参考价值。

OpenStack(以下简称OPS)是一个很庞大的系统,想要部署一个OPS需要部署很多组件。想必部署之路也是坑坑奇多。所以为了方便使用OPS,需要部署一个“all-in-one”环境的OPS

环境

  • CPU
    2U X86_64
  • Memory
    4G及以上,如果内存过小,会出现各种问题。(整个devstack-Openstack-Ocata + CentOS7.3 1611需要占用3.4G内存)
  • OS
    CentOS 7.3 1611
  • NET
    建议创建两个网络,一个用于连接外网用于做管理性工作;一个供neutron使用
  • OpenStack版本
    Ocata

部署

准备

关闭防火墙

关闭selinux

编辑/etc/selinux/configSELINUX=enforcing改为SELINUX=disabled

关闭iptables

执行命令sudo systemctl disable iptables,关闭iptables服务

上诉两处修改若想生效需要重启系统。

安装依赖软件

1
sudo yum install -y epel-release git net-tools

下载Devstack

从github上下载devstackgit clone https://github.com/openstack-dev/devstack.git,然后切换版本到Ocata git checkout stable/ocata,可使用git branch -av查看devstack所处分支

安装

创建stack用户

  1. 进入devstack目录

    1
    cd devstack
  2. 创建stack用户

    1
    sudo ./tools/create-stack-user.sh

切换用户

  1. 修改目录owner

    1
    sudo chown -R stack:stack ./devstack
  2. 修改/opt/stack目录访问权限

    1
    2
    sudo chmod 777 /opt/stack -R
    sudo mv ./devstack /opt/stack/
  3. 切换用户

    1
    sudo su - stack

撰写local.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
[[local|localrc]]
DEST=/opt/stack/ocata
# use TryStack git mirror
GIT_BASE=http://git.trystack.cn
NOVNC_REPO=http://git.trystack.cn/kanaka/noVNC.git
SPICE_REPO=http://git.trystack.cn/git/spice/spice-html5.git
#OFFLINE=True
RECLONE=False
# Define images to be automatically downloaded during the DevStack built process.
DOWNLOAD_DEFAULT_IMAGES=False
IMAGE_URLS=",https://launchp 大专栏  devstack部署ad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img"
HOST_IP=127.0.0.1
# Credentials
DATABASE_PASSWORD=pass
ADMIN_PASSWORD=pass
SERVICE_PASSWORD=pass
SERVICE_TOKEN=pass
RABBIT_PASSWORD=pass
HORIZON_BRANCH=stable/ocata
KEYSTONE_BRANCH=stable/ocata
NOVA_BRANCH=stable/ocata
NEUTRON_BRANCH=stable/ocata
GLANCE_BRANCH=stable/ocata
CINDER_BRANCH=stable/ocata
#keystone
KEYSTONE_TOKEN_FORMAT=UUID
##Heat
HEAT_BRANCH=stable/ocata
enable_service h-eng h-api h-api-cfn h-api-cw
## Swift
SWIFT_BRANCH=stable/ocata
ENABLED_SERVICES+=,s-proxy,s-object,s-container,s-account
SWIFT_REPLICAS=1
SWIFT_HASH=011688b44136573e209e
# Enabling Neutron (network) Service
disable_service n-net
enable_service q-svc
enable_service q-agt
enable_service q-dhcp
enable_service q-l3
enable_service q-meta
enable_service q-metering
enable_service neutron
## Neutron options
Q_USE_SECGROUP=True
FLOATING_RANGE="192.168.36.0/24"
FIXED_RANGE="10.0.0.0/24"
Q_FLOATING_ALLOCATION_POOL=start=192.168.36.55,end=192.168.36.100
PUBLIC_NETWORK_GATEWAY="192.168.36.1"
Q_L3_ENABLED=True
PUBLIC_INTERFACE=eth1
Q_USE_PROVIDERNET_FOR_PUBLIC=True
OVS_PHYSICAL_BRIDGE=br-ex
PUBLIC_BRIDGE=br-ex
OVS_BRIDGE_MAPPINGS=public:br-ex
# #VLAN configuration.
Q_PLUGIN=ml2
ENABLE_TENANT_VLANS=True
# Logging
LOGFILE=/opt/stack/logs/stack.sh.log
VERBOSE=True
LOG_COLOR=True
SCREEN_LOGDIR=/opt/stack/logs

安装OPS(all-in-one)

安装使用stack.sh脚本,卸载使用unstack.sh脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$ ./stack.sh
...
=========================
DevStack Component Timing
=========================
Total runtime 1254
run_process 83
test_with_retry 4
pip_install 127
restart_apache_server 29
wait_for_service 19
yum_install 50
=========================
This is your host IP address: 127.0.0.1
This is your host IPv6 address: ::1
Horizon is now available at http://127.0.0.1/dashboard
Keystone is serving at http://127.0.0.1/identity/
The default users are: admin and demo
The password: pass

安装时遇到问题可从两个角度考虑,一个网络不通,一个内存不足。这里再次重申,内存一定要>=4G,如果网络不通或延时太大,建议使用国内镜像。

例如/opt/stack/.pip/pip.conf:

1
2
3
4
5
[global]
timeout = 6000
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.com

horizon

安装成功后,访问http://x.x.x.x/dashboard, 用户民密码见local.conf

技术图片

参考&鸣谢

以上是关于devstack部署的主要内容,如果未能解决你的问题,请参考以下文章

devstack部署

sexi部署openstack (devstack) 一

DevStack部署Openstack环境

部署 DevStack - 每天5分钟玩转 OpenStack(17)

Ubuntu下用devstack单节点部署Openstack

ubuntu安装部署devstack