分享

在Ubuntu 12.10 上安装部署Openstack 第5页

 LZS2851 2016-04-05

设置租户,用户,角色,以及服务描述

Keystone项目,在https://github.com/openstack/keystone/blob/master/tools/sample_data.sh里有个脚本,这个脚本使用127.0.0.1做为所有的终端IP地址。这个脚本也为你定义了服务。 

发现并修改Identity Service(Keystone)

在发现并修改之前,在/var/log/keystone.log文件里查看(日志文件在/etc/keystone/logging.conf文件里有配置)。它显示了的进入WSGI请求的所有的组件,以及预料在log文件里将有一个错误,这个错误解译了为什么一个授权失败。如果你没有查看那些LOG文件中的请求,然后用带有"-debug"运行keystone。  

验证身份服务的安装(Verifying the Identity Service Installation)

通过使用你创建用户名称和密码产生一个身份认证的符号,来检验授权是你所期望的。

$ keystone --os-username=admin --os-password=secretword --os-auth-url=

http://192.168.206.130:35357/v2.0 token-get

+----------+----------------------------------+

| Property | Value |

+----------+----------------------------------+

| expires | 2012-10-04T16:08:03Z |

| id | 960ad732a0eb4b2a88516f18384c1fba |

| user_id | a4c2d43f80a549a19864c89d759bb3fe |

+----------+----------------------------------+

在响应里,你会收到一个与你的用户ID配对的符号。  

  1. 安装OpenStack计算(Compute)和镜象服务(Image)

OpenStack Compute和镜象服务共同工作,通过REST APS对虚拟机以及镜象提供访问。

安装和配置镜象服务

以root身份,安装镜象服务

# sudo apt-get install glance glance-api glance-common python-glanceclient glance-registry python-glance

注:当用Ubuntu云文档的时候,在按照上面的列表安装完glance 包之后,你需要重新安装python-keystoneclien,否则你会看到一个错误。

在安装完以后,你需要删除安装过程中产生的sqlite数据库,然后改变配置,指向MySQL数据库。

# rm /var/lib/glance/glance.sqlite

 

配置镜象服务数据库后端(Configuring the Image Service database backend)

为了MySQL,配置后端数据存储,创建一个glance的MySQL数据库和一个glance的MySQL用户。把访问glance所有数据库的权限都分配给glance用户,运行下面的命令启动MySQL数据库:

$ mysql –u root –p

当出现提示符后输入root用户密码。

创建glance数据库,然后配置MySQL数据库。

Mysql> CREATE DATABASE glance;

为新创建的glance数据库创建一个MySQL用户,然后把数据库所有的控制权赋于它。

Mysql > GRANT ALL ON glance.* TO 'glance'@'%' IDENTIFIED BY '[YOUR_GLANCEDB_PASSWORD]';

在mysql > 提示符上输入quit退出MySQL;

Mysql > quit

 

编辑Glance配置文件以及paste.ini中间件文件。

镜象服务有大量的操作,你可能用来配置Glance API服务,Glance注册服务,以及Glance能够用来存储镜象的各种存储终端。缺省地,存储终端是在文件里,在glance-api.conf配置文件里的[DEFAULT]部份里有规定。

大多数据配置是通过配置文件一配置的,对于Glance API服务以及Glance Registry服务都是用独立的配置文件。当通过一个操作系统包管理系统安装的时候,一个样例配置文件也被安装在/etc/glance目录里。在以组件名-paste.ini的文件里,例如glance-api-paste.ini文件,你配置该PasteDeploy配置,它控制了WSGI应用的部署对于每个组件。

这个完整的指导安装镜象服务使用了一个文件后端以及用于授权的身份识别服务。

更改/etc/glance/glance-api-paste.ini文件以及配置admin_*的值在[filter:authtoken]的下面。

[filter:authtoken]

admin_tenant_name = service

admin_user = glance

admin_password = glance

admin、服务识别以及flavor=keystone添加到/etc/glance/glance-api.conf文件的尾部。

[keystone_authtoken]

auth_host = 127.0.0.1

auth_port = 35357

auth_protocol = http

admin_tenant_name = service

admin_user = admin

admin_password = secretword

[paste_deploy]

# Name of the paste configuration file that defines the available pipelines

config_file = /etc/glance/glance-api-paste.ini

# Partial name of a pipeline in your paste configuration file with the

# service name removed. For example, if your paste section name is

# [pipeline:glance-api-keystone], you would configure the flavor below

# as 'keystone'.

flavor=keystone

 

重启glance-api 以便得到这些改变了的设置。

Service glance-api restart

更新/etc/glance/glance-registry.conf的最后一节,来映射到你较早时看到的对于admin用户和service租户的数据。加上flavor=keystone配置使得身份服务可用。

[keystone_authtoken]

auth_host = 127.0.0.1

auth_port = 35357

auth_protocol = http

admin_tenant_name = service

admin_user = admin

admin_password = secretword

[paste_deploy]

# Name of the paste configuration file that defines the available pipelines

config_file = /etc/glance/glance-api-paste.ini

# Partial name of a pipeline in your paste configuration file with the

# service name removed. For example, if your paste section name is

# [pipeline:glance-api-keystone], you would configure the flavor below

# as 'keystone'.

flavor=keystone

 

更新/etc/glance/glance-registry-paste.ini通过使得身份服务可用。

Keystone:

# Use this pipeline for keystone auth

[pipeline:glance-registry-keystone]

pipeline = authtoken context registryapp

确信/etc/glance/glance-registry.conf指向MySQL数据库而不是(rather than)sqlite

sql_connection = mysql://glance:[YOUR_GLANCEDB_PASSWORD]@192.168.206.130/glance

 

重启glance-registry来获取这些改变了的设置。

service glance-registry restart

注:在任何时候,当你改变了.conf文件,就要重启对应的服务。

ubuntu12.04上面,为数据表都是在版本控制之下,在新的安装时,你必须做以下这些步骤以便防止镜象服务可能中断升级,以root用户操作如下:

# glance-manage version_control 0

现在你可以生成或迁移数据库中的数据

#glance-manage db_sync

重启glance-registryglance-api服务,以root用户操作如下:

#service glance-registry restart

#service glance-api restart

注:这本指导手册没有配置image caching,配置参考http://docs./developer/glance/以获取更多的知识。

 

发现并处理故障镜象服务(Troubleshooting the Image Service(Glance))

开始发现并处理问题,要在/var/log/glance/registry.log文件中查找或者在/var/log/glance/api.log中查找。

 

验证镜象服务安装(Verifying the Image Service Installation)

linux

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多