前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >OpenStack 系列之Manila install and using the Virtualenv

OpenStack 系列之Manila install and using the Virtualenv

作者头像
DevinGeng
发布2019-04-09 17:26:50
5430
发布2019-04-09 17:26:50
举报
文章被收录于专栏:云+技术云+技术

今天继续分享下Manila系列文章知识,之前两篇博文一个是Manila详解,一个是Manila for Centos的安装部署,今天呢我们采用Python Virtualenv的模式来安装Manila服务:) 。

什么是Virtualenv?

Virtualenv是Python的虚拟环境可以使一个Python程序拥有独立的库library和解释器interpreter,而不用与其他Python程序共享统一个library和interpreter。虚拟环境的好处是避免了不同Python程序间的互相影响(共同使用global library 和 interpreter),例如程序A需要某个库的1.0版本,而程序B需要同样这个库的2.0版本,如果程序B执行则A就不能执行了。

为什么使用Virtualenv?

很多人会问为什么会采用Manila for Virtualenv,因为避免不了有时候OpenStack组件版本不一致的情况,之所以这样是因为Manila L版本功能开始逐渐健全并完善的,而云平台OpenStack组件版本相较于L版来说老一些,毕竟生产环境还是不能跟随社区版本发布而更新的,求稳为主,所以这时候就出现了现在的需求,由于版本不一致有些Python依赖以及OpenStack组件依赖版本不同,如果不采用分离的话会导致组件失效等问题。

代码语言:javascript
复制
安装部署:
1.创建Manila数据库.
 
mysql -u root -p
CREATE DATABASE manila;
GRANT ALL PRIVILEGES ON manila.* TO 'manila'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON manila.* TO 'manila'@'%' IDENTIFIED BY 'password';
 
2.创建Manila用户、服务等.
openstack user create --password-prompt manila
openstack role add --project service --user manila admin
openstack service create --name manila --description "OpenStack Shared Filesystems" share
openstack endpoint create \
  --publicurl http://X.X.X.X:8786/v1/%\(tenant_id\)s\
  --internalurl http://X.X.X.X:8786/v1/%\(tenant_id\)s\
  --adminurl http://X.X.X.X:8786/v1/%\(tenant_id\)s\
  --region RegionOne \
  share
 
3.安装依赖.
yum -y install libxslt-devel libxml2-devel libxml2-python postgresql-devel \
python-greenlet-develpython-devel python-greenlet libffi-devel
 
4.下载Manila源码.
git clone https://github.com/openstack/manila.git
cd manila
 
5.创建Virtualenv环境.
由于Manila 源码里面自带tools所以这里直接就采用了tools
python tools/install_venv.py
 
6.进入env环境安装Manila.
source .venv/bin/activate
python setup.py build
python setup.py install
 
7.安装Manila client.
pip install python-manilaclient>=1.4.0
 
8.创建Manila目录从Manila源码目录拷贝配置文件等.
mkdir /etc/manila
cp -r /root/manila/etc/manila/* /etc/manila/
 
9.编辑配置manila.conf文件
[之前的Manila for Centos部署文档里面详细说明了,这里就不在详细赘述。]
 
10.同步数据库
manila-managedb sync
 
11.启动Manila服务.
nohup su-s /bin/sh -c "/opt/manila/.venv/bin/python /opt/manila/.venv/bin/manila-api--config-file /etc/manila/manila.conf" > /var/log/manila/manila-api.log&
 
nohup su-s /bin/sh -c "/opt/manila/.venv/bin/python /opt/manila/.venv/bin/manila-scheduler--config-file /etc/manila/manila.conf" > /var/log/manila/manila-scheduler.log&
 
nohup su-s /bin/sh -c "/opt/manila/.venv/bin/python/opt/manila/.venv/bin/manila-share --config-file /etc/manila/manila.conf"> /var/log/manila/manila-share.log &
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016-03-17 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档