码迷,mamicode.com
首页 > 其他好文 > 详细

devstack环境搭建

时间:2018-09-05 14:57:16      阅读:241      评论:0      收藏:0      [点我收藏+]

标签:star   str   add   chown   vol   配置nfs   img   重启   openstac   

1. devstack部署

参考Quick Start,推荐使用ubuntu16.04进行安装

1.1 配置ubuntu国内源

修改/etc/apt/sources.list内容为
技术分享图片
deb http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
##测试版源
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-proposed main restricted universe multiverse
# 源码
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
##测试版源
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-proposed main restricted universe multiverse
View Code

执行命令更新源

$ sudo apt-get update

1.2 添加stack用户

$ sudo useradd -s /bin/bash -d /opt/stack -m stack
$ echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack
$ sudo su - stack

1.3 配置pip国内源

同样需要在~/root下进行修改

$ mkdir .pip
$ cat >.pip/pip.conf <<EOF
[global]
index-url = http://pypi.douban.com/simple/
trusted-host = pypi.douban.com
EOF

1.4 下载DevStack

$ git clone https://git.openstack.org/openstack-dev/devstack
$ cd devstack
$ git checkout -b stable/pike origin/stable/pike

1.5 创建local.conf文件

[[local|localrc]]
 
GIT_BASE=http://git.trystack.cn
  
HORIZON_BRANCH=stable/pike
KEYSTONE_BRANCH=stable/pike
NOVA_BRANCH=stable/pike
NEUTRON_BRANCH=stable/pike
GLANCE_BRANCH=stable/pike
CINDER_BRANCH=stable/pike
 
ADMIN_PASSWORD=123
DATABASE_PASSWORD=123
RABBIT_PASSWORD=123
SERVICE_PASSWORD=123

使用公司的git源

[[local|localrc]]
 
GIT_BASE=http://git.trystack.cn
 
NOVA_REPO=X.X.X.X
pike/nova
NOVA_BRANCH=master
HORIZON_BRANCH=stable/pike
KEYSTONE_BRANCH=stable/pike
NEUTRON_BRANCH=stable/pike
GLANCE_BRANCH=stable/pike
CINDER_BRANCH=stable/pike
 
ADMIN_PASSWORD=123
DATABASE_PASSWORD=123
RABBIT_PASSWORD=123
SERVICE_PASSWORD=123

1.6 创建lvm

$ sudo pvcreate /dev/vdb
$ sudo vgcreate stack-volumes-lvmdriver-1 /dev/vdb

1.7 安装

$ ./stack.sh

1.8 配置nfs

不使用lvm后端,配置nfs

挂载目录
sudo mkdir /storage
sudo mount /dev/sdb1 /storage
sudo chown stack:stack /storage

修改/etc/fstab,添加
/dev/sdb1   /storage    ext4    defaults    0   0

安装nfs-kernel-server: sudo apt install nfs-kernel-server
配置nfs,修改/etc/exports添加
/storage *(rw,sync,no_root_squash)

添加/etc/cinder/nfsshares,内容为
192.168.21.142:/storage

修改/etc/cinder/cinder.conf,添加nfs
enabled_backends = nfs
 
[nfs]
nfs_shares_config = /etc/cinder/nfsshares
volume_driver = cinder.volume.drivers.nfs.NfsDriver

2.  devstack管理

devstack使用systemd管理服务,服务名称为: devstack@$servicename.service

2.1 查看服务状态

$ sudo systemctl status "devstack@*"

2.2 控制服务

重启nova-api服务

sudo systemctl restart devstack@n-api.service

2.3 查看日志

查看nova-api日志
$ sudo journalctl -f --unit devstack@n-api.service
查看nova相关服务的日志
$ sudo journalctl -f -u devstack@n-*

 

devstack环境搭建

标签:star   str   add   chown   vol   配置nfs   img   重启   openstac   

原文地址:https://www.cnblogs.com/gushiren/p/9591752.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!