分享

Openstack?Keystone?dashboard?swift?AllInOne

 亚典波罗的收藏 2012-01-31

本文目的在于swift+Keystone+dashboard 安装

swift的安装本文就先行忽略,keystone安装在swiftproxy节点处,为实验简单性,所使用的环境的 ESXi上的一台 ubuntu 11.04 32bit 虚拟机

 

一) 源码安装

Git clone https://github.com/openstack/keystone.git  ~/keystone

 

主要安装步骤可以参考keystone源码包中的README.md

依赖项

 

# Show dependencies

$ cat tools/pip-requires

 

# You may need to install development files before using 'pip install'

# For example:

  sudo apt-get install python-dev libxml2-dev libxslt1-dev libsasl2-dev libldap2-dev libsqlite3-dev libssl-dev

因此先要安装

apt-get install python-dev libxml2-dev libxslt1-dev libsasl2-dev libldap2-dev libsqlite3-dev libssl-dev

 

# Install dependencies (for production, testing, and development)

$ pip install -r tools/pip-requires

pip install passlib

这个过程需要花一定的时间

 

# Optional: Install Memcache (if enabled as a backend)

Refer #(http:///)

安装Memcache(可选)

 

运行 Keystone

配置文件在 etc/keystone.conf 包括各服务的绑定端口和ip修改,可将该文件拷贝到 /etc目录下

swift集成,在proxy节点处

$ swift-init all stop

$ cd ~/keystone/bin && ./keystone

Starting the RAX-KEY extension

Starting the Legacy Authentication component

Service API listening on 0.0.0.0:5000

Admin API listening on 0.0.0.0:35357

 

开启另一个控制台终端

edit the ~/keystone/keystone/test/sampledata.py file,这个脚本是keystone-manage向keystone添加user,token及服务等,根据实际情况作相应修改

 In another window, edit the ~/keystone/keystone/test/sampledata.py file, find the swift.publicinternets.com text and replace it with the URL to your Swift cluster using the following format (note that we're going to change Swift to run on port 8888 later):http://127.0.0.1:8888/v1/AUTH_%tenant_id%

Create the sample data entries:

$ cd ~/keystone/bin && ./sampledata

 这一步是调用执行上面的sampledata.py文件,在keystone中进行注册。

$ 多次运行sampledata会报错,那是因为数据库已经有先运行保留的数据原因,你应该删除数据库的记录,默认是sqlite3的话,你可以直接删除keystone.db这个文件

如果是mysql,可以

mysql -uroot -p123456 -e 'DROP DATABASE IF EXISTS keystone;'

mysql -uroot -p123456 -e 'CREATE DATABASE keystone;'

Reconfigure Swift's proxy server to use Keystone instead of TempAuth. Here's an example /etc/swift/proxy-server.conf:

[DEFAULT]

bind_port = 8888

user = root

 

[pipeline:main]

pipeline = catch_errors cache keystone proxy-server

 

[app:proxy-server]

use = egg:swift#proxy

account_autocreate = true

 

[filter:keystone]

use = egg:keystone#tokenauth

auth_protocol = http

auth_host = 127.0.0.1

auth_port = 35357

admin_token = 999888777666

delay_auth_decision = 0

service_protocol = http

service_host = 127.0.0.1

service_port = 5000

service_pass = dTpw

 

[filter:cache]

use = egg:swift#memcache

set log_name = cache

 

[filter:catch_errors]

use = egg:swift#catch_errors

 

$ swift-init main start

 

Joeuser用户已经在运行./sampledata 时生成

$ swift -A http://127.0.0.1:5000/v1.0 -U joeuser -K secrete post container

$ swift -A http://127.0.0.1:5000/v1.0 -U joeuser -K secrete stat -v

StorageURL: http://127.0.0.1:8888/v1/AUTH_1234

Auth Token: 74ce1b05-e839-43b7-bd76-85ef178726c3

   Account: AUTH_1234

Containers: 1

   Objects: 0

     Bytes: 0

Accept-Ranges: bytes

X-Trans-Id: tx25c1a6969d8f4372b63912f411de3c3b

 

 想手动添加用户,可以使用keystone-manage命令,具体参考

http://keystone./man/keystone-manage.html

OpenStack Dashboard 安装

git clone  https://github.com/openstack/horizon

 

cd openstack-dashboard/openstack-dashboard

cp local/local_settings.py.example local/local_settings.py

 

vim local/local_settings.py

# FIXME: This needs to be changed to allow for multi-node setup.

OPENSTACK_KEYSTONE_URL = "http://localhost:5000/v2.0/"

OPENSTACK_KEYSTONE_ADMIN_URL = "http://localhost:35357/v2.0"

OPENSTACK_KEYSTONE_DEFAULT_ROLE = "Member"


# NOTE(tres): Available services should come from the service

#             catalog in Keystone.

SWIFT_ENABLED = True

 

Install Horizon

 

$ apt-get install -y python-setuptools 
$ sudo easy_install virtualenv
$ python tools/install_venv.py

Installing the virtual environment will take some time depending on download speeds.

 

Run Horizon

启动dashboardweb服务

tools/with_venv.sh dashboard/manage.py runserver 0.0.0.0:8000

 

成功后可以在浏览器输入:http://dashboardhost:8000/ 进入登入界面


可选如果出现dashboard登入不了的情况,则可以选择数据同步

tools/with_venv.sh dashboard/manage.py syncdb


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

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多