openstack【Kilo】入门 【keystone篇】五:keystone安装与配置
问题导读
1.如何让keystone数据库,任何客户端都能访问,包括本地?
2.如何配置keystone?
http://www.aboutyun.com/static/image/hrline/4.gif
我们安装部署keystone,那么我们就需要了解keystone的作用,简单来讲,keystone是openstack中验证组件。更多内容:
Keystone, Openstack之魂
零基础学习openstack【完整中级篇】及openstack资源汇总
下面我们开始安装和部署:
创建数据库,并授权mysql -u root -p
创建keystone数据库
CREATE DATABASE keystone;
对keystone授权
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' \
IDENTIFIED BY 'KEYSTONE_DBPASS';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' \
IDENTIFIED BY 'KEYSTONE_DBPASS';
KEYSTONE_DBPASS可以自定义。
上面的含义:
实现了,对keystone用户实现了,本地和远程都可以访问
更多了解:openstack外篇之认识mysql授权及一些操作
退出mysql
exit
生成token
openssl rand -hex 10
安装keystone包:
1.默认keystone服务监听端口5000 和 35357,尽管如此向导配置 Apache HTTP server 监听这些端口,为了避免端口冲突,安装后禁止开机启动keystone 服务
echo "manual" > /etc/init/keystone.override
2.下载并安装keystone
apt-get install keystone python-openstackclient apache2 libapache2-mod-wsgi memcached python-memcache
编辑 /etc/keystone/keystone.conf
...
admin_token = ADMIN_TOKEN
这里修改如下比如:570f150cb897e793e58f
admin_token =570f150cb897e793e58f
修改 部分
...
connection = mysql://keystone:KEYSTONE_DBPASS@controller/keystone
补充:
记得一定注释掉:
connection=sqlite:////var/lib/keystone/keystone.db
修改,配置Memcache 服务:
...
servers = localhost:11211
修改 部分
...
provider = keystone.token.providers.uuid.Provider
driver = keystone.token.persistence.backends.memcache.Token
修改 部分, 配置SQL revocation driver:
driver = keystone.contrib.revoke.backends.sql.Revoke
修改部分
...
verbose = True
填充keystone
su -s /bin/sh -c "keystone-manage db_sync" keystone
这里最好切换至root用户,否则会同步不成功。
配置 Apache HTTP server
1.修改配置文件 /etc/apache2/apache2.conf,配置ServerName选项为控制节点hostname
ServerName controller
2.创建/etc/apache2/sites-available/wsgi-keystone.conf 文件,添加如下内容
Listen 5000
Listen 35357
<VirtualHost *:5000>
WSGIDaemonProcess keystone-public processes=5 threads=1 user=keystone display-name=%{GROUP}
WSGIProcessGroup keystone-public
WSGIScriptAlias / /var/www/cgi-bin/keystone/main
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
<IfVersion >= 2.4>
ErrorLogFormat "%{cu}t %M"
</IfVersion>
LogLevel info
ErrorLog /var/log/apache2/keystone-error.log
CustomLog /var/log/apache2/keystone-access.log combined
</VirtualHost>
<VirtualHost *:35357>
WSGIDaemonProcess keystone-admin processes=5 threads=1 user=keystone display-name=%{GROUP}
WSGIProcessGroup keystone-admin
WSGIScriptAlias / /var/www/cgi-bin/keystone/admin
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
<IfVersion >= 2.4>
ErrorLogFormat "%{cu}t %M"
</IfVersion>
LogLevel info
ErrorLog /var/log/apache2/keystone-error.log
CustomLog /var/log/apache2/keystone-access.log combined
</VirtualHost>
3.启用身份服务虚拟主机:
ln -s /etc/apache2/sites-available/wsgi-keystone.conf /etc/apache2/sites-enabled
4.创建WSGI组件的目录结构:
mkdir -p /var/www/cgi-bin/keystone
5.下载复制WSGI 组件到目录 /var/www/cgi-bin/keystone
curl http://git.openstack.org/cgit/openstack/keystone/plain/httpd/keystone.py?h=stable/kilo \
| tee /var/www/cgi-bin/keystone/main /var/www/cgi-bin/keystone/admin
上述文件官网给修改了,可以修改成:
curl http://git.openstack.org/cgit/openstack/keystone/plain/httpd/keystone.py \
| tee /var/www/cgi-bin/keystone/main /var/www/cgi-bin/keystone/admin
当然可以下载内容:注意红字部分注释掉,来自网友实践,非常感谢
# Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
from oslo_log import log
from oslo_log import versionutils
from keystone.i18n import _LW
from keystone.server import wsgi as wsgi_server
name = os.path.basename(__file__)
#LOG = log.getLogger(__name__)
#def deprecation_warning():
# versionutils.report_deprecated_feature(
# LOG,
# _LW('httpd/keystone.py is deprecated as of Mitaka'
# ' in favor of keystone-wsgi-admin and keystone-wsgi-public'
# ' and may be removed in O.')
#)
# NOTE(ldbragst): 'application' is required in this context by WSGI spec.
# The following is a reference to Python Paste Deploy documentation
# http://pythonpaste.org/deploy/
application = wsgi_server.initialize_application(
name,
post_log_configured_function=deprecation_warning)
创建文件main和admin,放入上述内容,并且复制到相应的路径。
以上方法,大家可以尝试
6.修改权限
chown -R keystone:keystone /var/www/cgi-bin/keystone
chmod 755 /var/www/cgi-bin/keystone/*
完成安装
1.重启 Apache HTTP server:
service apache2 restart
2.如果存在 SQLite 数据库,则删除
rm -f /var/lib/keystone/keystone.db
相关内容
openstack【Kilo】入门 【准备篇】零:整体介绍
openstack【Kilo】入门 【准备篇】一: Ubuntu14.04远程连接(ssh安装)
openstack【Kilo】入门 【准备篇】二:NTP安装
openstack【Kilo】入门 【准备篇】三:mysql(MariaDB)安装【控制节点】
openstack【Kilo】入门 【准备篇】四:RabbitMQ 安装
openstack【Kilo】入门 【keystone篇】五:keystone安装与配置
openstack【Kilo】入门 【keystone篇】六:创建服务实例和 API endpoint
openstack【Kilo】入门 【keystone篇】七:创建租户、用户、角色
openstack【Kilo】入门 【keystone篇】八:验证keystone安装部署
openstack【Kilo】入门 【keystone篇】九: 创建openstack客户端环境变量脚本
openstack【Kilo】入门 【glance篇】十:glance安装配置【控制节点】
openstack【Kilo】入门 【glance篇】十一:glance安装验证
openstack【Kilo】入门 【nova篇】十二:安装配置nova
openstack【Kilo】入门 【网络篇】十三:安装配置【控制节点】
openstack【Kilo】入门 【网络篇】十四:安装配置【网络节点】
openstack【Kilo】入门 【网络篇】十五:安装配置【计算节点】
openstack【Kilo】入门 【网络篇】十六:实例化网络
openstack【Kilo】入门 【网络篇】十七:创建实例
{:soso_e179:} keystone 和 后面配置的HTTPD wsgi文件里的5000 冲突吧 KEYSTONE_DBPASS这是mysql 数据库 root的密码? 本帖最后由 seryou 于 2015-9-23 15:18 编辑
请教一下:
既然keystone服务不用起来,为何要配置keystone.conf.
我理解是,不用安装keystone,直接
5.下载复制WSGI 组件到目录 /var/www/cgi-bin/keystone
就可以了?
不过这样也不对,数据库没有设置。
合理的解释是,WSGI组件去读取/etc/keystone/下的配置文件,还是依赖keystone里的库或模块?
不知如何理解,谢谢!
我在安装和配置keystone,当执行到填充keystone的命令
# su -s /bin/sh -c "keystone-manage db_sync" keystone
时出错:
No handlers could be found for logger "oslo_config.cfg"
argument --verbose: Invalid Boolean value: True#Optional#
请问楼主这怎么解决呢?谢谢
seryou 发表于 2015-9-23 15:11
请教一下:
既然keystone服务不用起来,为何要配置keystone.conf.
我理解是,不用安装keystone,直接
先安装,这里面有很多默认的配置,改成适合我们自己的组件。
提问 ServerName 这个是文件里本来就含有的还是 自己设置的
如果是自己设置的 那么 ServerName 需要添加到那个位置 weishanzhou 发表于 2015-10-28 11:52
我在安装和配置keystone,当执行到填充keystone的命令
# su -s /bin/sh -c "keystone-manage db_sync" key ...
我也遇到这种问题,请问怎么解决的?
slosh 发表于 2015-7-24 14:36
keystone 和 后面配置的HTTPD wsgi文件里的5000 冲突吧
请问如何解决呢?我的是用ubuntu14.04安装的,也出现这个问题,在运行keystone时,/var/log里说地址已被占用?请问你是如何解决的
页:
[1]
2