ttthh 发表于 2014-6-19 08:46:27

通过devstack自动部署Openstack icehouse 版本

本帖最后由 ttthh 于 2014-6-19 08:47 编辑

本篇主要阐述通过DeveStack 去部署Openstack(icehouse),对大多数来说安装部署Openstack来说是个痛苦的过程,尤其是 OpenStack和它依赖的一些组件在快速发展中,经常出现这个版本组件对不上那个版本 dashboard 等情况。如果只是看看或者初期玩玩OpenStack的话,使用 DevStack也是个不错的办法。DevStack采用了自动化源码部署的方式,适用于开发环境的部署和Openstack 开发者, 单节点,小环境;这里采用的操作系统为Ubuntu14.04
1. 自动化部署原理:1.1自动执行安装脚本将安装命令脚本化1.2自动生成配置文件生成正确的配置参数1.3自动解决依赖关系安装依赖的软件包服务的安装顺序




2.Openstack 部署详解
2.1更新系统及安装git软件包

1
2
3
4
$sudo apt-get update
$sudo apt-get upgrade
$sudo apt-get dist#upgrade
$sudo apt-get install git






2.2 devstack 下载

1
2
3
4
$git branch -a   #显示本地分支
$git checkout -b icehouse origin/stable/icehouse#切换到指定icehouse分支或标签
$git clone https://github.com/openstack-dev/devstack.git#克隆devstack的Git代码仓库
$cd ./devstack






2.3 devstack 下的一些文件描述

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
stack.sh #自动化部署的入口;判断是否存在localrc文件; 否,进入交互模式; 是,进入配置模式(如果需要输入输入stack.sh需要的参数,如:数据库的密码、Rabbit MQ的密码、Service TOKEN 等)
localrc#配置文件;传入stack.sh的参数;nova部署在哪个节点,用户名密码是什么
openrc   #环境变量脚本;在执行openstack命令时要导入一些环境变量 如:export OS_USERNAME = admin
unstack.sh #卸载脚本
lib      #每个服务的自动化安装脚本;通常存放nova,swift等自动化安装脚本,手动安装时执行的所有命令;每一个openstack服务对应一个文件(以下对相关文件作了简要说明)
   
    apache (Web 服务)
    Swift(对象存储的组件)
    Glance(镜像管理)
    Horizon (提供了一个模块化的webbased用户界面)
    heat(应用的自动化部署AWS cloudformation)
    ceilometer(监控和计费)
    sahara(BigData-as-a-Service #BDaaS,将hadoop部署在openstack的虚拟机上)
    ironic(PXE+IPMI,物理节点的自动化部署)
    trove(Database-as-a-service,将数据库部署在openstack的虚拟机上)
    tempest(openstack单元测试框架)
    opendaylight(开源的sdn控制器)
    ldap(轻量型目录访问协议,与keystone整合,实现多级用户的鉴权)
    database、databases(postgresql/mysql,默认将选择mysql)
    nova、nova_plugins(可以说是一套虚拟化管理程序,还可以管理网络和存储;下面是支持的一些虚拟化管理程序)
    functions-libvirthypervisor-baremetalhypervisor-fakehypervisor-ironichypervisor-libvirthypervisor-openvzhypervisor-vspherehypervisor-xenserver
    neutron、neutron_plugins、neutron_thirdparty(网络管理的组件,neutron未来将取代Nova相关网络相关内容)
    cinder、cinder_plugins (存储管理的组件。Cinder存储管理主要是指虚拟机的存储管理)






2.4 localrc配置文件详解

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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
##########################Gloable configuration########################
DATABASE_PASSWORD=redhat   #数据库的密码
ADMIN_PASSWORD=redhat      #admin用户的密码
SERVICE_PASSWORD=redhat    #每个service对应用户的密码
SERVICE_TOKEN=redhat       #每个service的TOKEN
RABBIT_PASSWORD=redhat   #Message MQ的密码

# Reclone each time
#RECLONE=true
   
# Python enviroments
#OFFLINE=true
   
## For Keystone
KEYSTONE_TOKEN_FORMAT=PKI
   
## For Swift
#SWIFT_REPLICAS=1
#SWIFT_HASH=011688b44136573e209e
   
##################openstack和devstack的日志文件的存放位置######################
DEST=/home/stack
LOGFILE=$DEST/logs/stack.sh.log
VERBOSE=True
LOG_COLOR=True
SCREEN_LOGDIR=$DEST/logs
   
# ################################服务配置##################################
# Pre#requisite
ENABLED_SERVICES=rabbit,mysql,key
   
#############################消息队列配置###################################
## If you want ZeroMQ instead of RabbitMQ (don't forget to un-declare 'rabbit' from the pre#requesite)
#ENABLED_SERVICES+=,-rabbit,-qpid,zeromq
   
## If you want Qpid instead of RabbitMQ (don't forget to un-declare 'rabbit' from the pre#requesite)
#ENABLED_SERVICES+=,-rabbit,-zeromq,qpid

######################每个服务单独配置代码下载地址#########################
# Horizon (Dashboard UI) - (always use the trunk)
ENABLED_SERVICES+=,horizon
#HORIZON_REPO=https://github.com/openstack/horizon
#HORIZON_BRANCH=master

######################NOVA服务配置#######################################   
# Nova - Compute Service
ENABLED_SERVICES+=,n-api,n-crt,n-obj,n-cpu,n-cond,n-sch,n-novnc,n-cauth
IMAGE_URLS+=",https://launchpad.net/cirros/tru ... 3.0#x86_64#disk.img"
   
## Nova Cells
ENABLED_SERVICES+=,n-cell

###########################Glance服务配置###############################
# Glance - Image Service
ENABLED_SERVICES+=,g-api,g-reg
   
#####################swift服务配置##############################
# Swift - Object Storage
#ENABLED_SERVICES+=,s-proxy,s-object,s-container,s-account
   
#####################网络服务配置:负载均衡、VPN和防火墙服务#################

# Neutron - Networking Service
# If Neutron is not declared the old good nova-network will be used
ENABLED_SERVICES+=,q-svc,q-agt,q-dhcp,q-l3,q-meta,neutron
#VIF_PLUGGING_IS_FATAL=False
#VIF_PLUGGING_TIMEOUT=10


## Neutron - Load Balancing
#ENABLED_SERVICES+=,q-lbaas
   
## Neutron - VPN as a Service
#ENABLED_SERVICES+=,q-vpn
   
## Neutron - Firewall as a Service
#ENABLED_SERVICES+=,q-fwaas
   
# VXLAN tunnel configuration
Q_PLUGIN=ml2
Q_ML2_TENANT_NETWORK_TYPE=vxlan

####################cinder服务配置##############################
# Cinder - Block Device Service
ENABLED_SERVICES+=,cinder,c-api,c-vol,c-sch
   
####################heat服务配置################################
# Heat - Orchestration Service
#ENABLED_SERVICES+=,heat,h-api,h-api-cfn,h-api-cw,h-eng
#IMAGE_URLS+=",http://fedorapeople.org/groups/h ... 6_64-cfntools.qcow2"

##################Ceilometer服务配置############################
# Ceilometer - Metering Service (metering + alarming)
#CEILOMETER_BACKEND=mysql
#ENABLED_SERVICES+=,ceilometer-acompute,ceilometer-acentral,ceilometer-collector,ceilometer-api
#ENABLED_SERVICES+=,ceilometer-alarm-notify,ceilometer-alarm-eval

##############keystone和swift采用apache作为web前端配置###########
# Apache fronted for WSGI
APACHE_ENABLED_SERVICES+=keystone
#,swift

#GIT_BASE=http://review.thstack.com





2.5 进行部署(采用非交互模式)
$ cplocalrc /home/junbj/devstack/
$./stack.sh   等待安装部署即可;


2.6 图形界面登录
访问:Http:// IP Address 即可






2.7 创建虚拟机通过镜像cirros






3.部署过程遇到的问题与解决方法
3.1 重新登录提示认证失败

重启虚拟机后,登录Dashboard时出现“An error occurred authenticating. Please try again later”的错误, 如上图.

1
$cd /devstack ; sh rejoin-stack.sh(执行devstack目录下的rejoin-stack.sh脚本即可可以解决)




3.2 pip源连接失败,导致pip安装软件包失败

1
2
3
4
5
$mkdir ~/.pip
$vim ~/.pip/pip.conf
-----------------pip.conf-------------------------------------

    index-url = http://pypi.douban.com/simple/




3.3 /opt/stack目录权限问题

1
$sudo chmod 777 /opt/stack -R




3.4 devstack下载失败
fatal: unable to access 'https://github.com/openstack-dev/devstack/': Could not resolve host: github.com
检查物理机的/etc/resov.conf文件中是否有正确的nameserver.


3.5 stack.sh执行失败1:pip-1.4.1安装失败
pkg_resources.DistributionNotFound: pip==1.4.1
通过git log查看devstack代码更新记录,恢复到之前的某个版本


3.6 stack.sh执行失败2:pip-1.4.1安装失败


1
$git reset --hard d4fe50feb18133e39351af7becb5ff84c8d4f479



shenhai 发表于 2014-12-11 15:07:52

你好,遇到这个错误

shenhai 发表于 2014-12-11 15:08:38

sorry,图片配错了,这个是的

2097282604 发表于 2015-8-8 20:02:52

openstack只能在stack用户下建立吗,还有你的LOGFILE=$DEST/logs/stack.sh.log中的dest中的是/home/stack/,, 这个日志文件的目录和/home/junbj/devstack/这个目录没有冲突吗,就是junbj这个目录啊。

2097282604 发表于 2015-9-16 20:38:36

2015-09-16 12:36:35.676 | mkdir: cannot create directory '/opt/stack/status': Permission denied
大哥这个怎么的解决,不懂,求救a ,拜托了

2097282604 发表于 2015-9-19 08:55:23

stack.sh执行失败 之mkdir: cannot create directory '/opt/stack/status': Permission denied

zw2002 发表于 2015-9-21 16:51:12

这个要新一个stack的用户,然后切换到stack这个用户去执行./stack.sh脚本。用户是通过脚本创建出来的,用户sudo的权限。
页: [1]
查看完整版本: 通过devstack自动部署Openstack icehouse 版本