首页 » Swift » OpenStack-M版(Mitaka)搭建基于(Centos7.2)+++十、Openstack对象存储

OpenStack-M版(Mitaka)搭建基于(Centos7.2)+++十、Openstack对象存储

原文 http://blog.csdn.net/controllerha/article/details/78681353

2017-12-02 02:01:20阅读(293)

十、Openstack对象存储服务(swift)上


配置:我在计算节点添加了两块硬盘(sdb,sdc)用来当存储用,在我这搭建中计算节点也就是存储节点了,原因电脑无法拉动更多虚拟几所以咯。。。

简单介绍:

swift主要有四个组件:swift-proxy-server、swift-account-server、swift-container-server、swift-object-server

swift-proxy-server(代理服务):对外提供对象服务 API

swift-account-server(账户服务):提供账户元数据和统计信息,并维护所含容器列表的服务,管理由对象存储定义的账户

swift-container-server(容器服务):提供容器元数据和统计信息,并维护所含对象列表的服务

swift-object-server(对象服务):提供对象元数据和内容服务,每个对象的内容会以文件的形式存储在文件系统中,元数据会作为文件属性来存储,建议采用支持扩展属性的 XFS 文件系统



控制节点上

swift不需要数据库我们直接创建服务


1.创建swift用户

需要管理员权限

. admin-openrc

openstack user create --domain default --password-prompt swift

[root@controller ~]# . admin-openrc 
[root@controller ~]# openstack user create --domain default --password-prompt swift
User Password:
Repeat User Password:
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | b24b3093654b4ba4be706fe675a03b2d |
| enabled   | True                             |
| id        | 90f27d7d1fb644babb1f35f6a7919866 |
| name      | swift                            |
+-----------+----------------------------------+

2.添加 admin 角色到swift 用户和 service 项目上

openstack role add --project service --user swift admin

[root@controller ~]# openstack role add --project service --user swift admin
此操作无返回


3.创建swift服务实体

openstack service create --name swift --description "OpenStack Object Storage" object-store

[root@controller ~]# openstack service create --name swift \
>   --description "OpenStack Object Storage" object-store
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Object Storage         |
| enabled     | True                             |
| id          | 1fbb8b2624694fc780291896d2f210a7 |
| name        | swift                            |
| type        | object-store                     |
+-------------+----------------------------------+

4.创建镜像服务的 API 端点

openstack endpoint create --region RegionOne object-store public http://controller:8080/v1/AUTH_% \  (括号前面是有\ 的)(tenant_id \ )s

openstack endpoint create --region RegionOne object-store internal http://controller:8080/v1/AUTH_% \ (tenant_id \ )s

openstack endpoint create --region RegionOne object-store admin http://controller:8080/v1

[root@controller ~]# openstack endpoint create --region RegionOne \
>   object-store public http://controller:8080/v1/AUTH_%(tenant_id)s
+--------------+----------------------------------------------+
| Field        | Value                                        |
+--------------+----------------------------------------------+
| enabled      | True                                         |
| id           | bc95965d7d084ca68e07e7259bb78385             |
| interface    | public                                       |
| region       | RegionOne                                    |
| region_id    | RegionOne                                    |
| service_id   | 1fbb8b2624694fc780291896d2f210a7             |
| service_name | swift                                        |
| service_type | object-store                                 |
| url          | http://controller:8080/v1/AUTH_%(tenant_id)s |
+--------------+----------------------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne \
>   object-store internal http://controller:8080/v1/AUTH_%(tenant_id)s
+--------------+----------------------------------------------+
| Field        | Value                                        |
+--------------+----------------------------------------------+
| enabled      | True                                         |
| id           | 83e47740125d42bea679097908bff9fa             |
| interface    | internal                                     |
| region       | RegionOne                                    |
| region_id    | RegionOne                                    |
| service_id   | 1fbb8b2624694fc780291896d2f210a7             |
| service_name | swift                                        |
| service_type | object-store                                 |
| url          | http://controller:8080/v1/AUTH_%(tenant_id)s |
+--------------+----------------------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne \
>   object-store admin http://controller:8080/v1
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | b75d6e318ae5481fbb602551a2e2278f |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 1fbb8b2624694fc780291896d2f210a7 |
| service_name | swift                            |
| service_type | object-store                     |
| url          | http://controller:8080/v1        |
+--------------+----------------------------------+

5.安装软件包

yum install openstack-swift-proxy python-swiftclient python-keystoneclient python-keystonemiddleware memcached


从对象存储的仓库源中获取代理服务的配置文件(需要联网,否则自己浏览器打开自己粘贴创建文件)

curl -o /etc/swift/proxy-server.conf https://git.openstack.org/cgit/openstack/swift/plain/etc/proxy-server.conf-sample

[root@controller ~]# curl -o /etc/swift/proxy-server.conf https://git.openstack.org/cgit/openstack/swift/plain/etc/proxy-server.conf-sample
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 41023  100 41023    0     0  27880      0  0:00:01  0:00:01 --:--:-- 27887

6.修改配置文件/etc/swift/proxy-server.conf

vi /etc/swift/proxy-server.conf
[DEFAULT]
bind_port = 8080绑定端口
user = swift用户
swift_dir = /etc/swift目录
将原句注释直接复制粘贴(很长这是一句不要回车,不要改顺序,不然会报错8080)
[pipeline:main]
pipeline = catch_errors gatekeeper healthcheck proxy-logging cache container_sync bulk ratelimit authtoken keystoneauth container-quotas account-quotas slo dlo versioned_writes proxy-logging proxy-server
启动自动账户创建
[app:proxy-server]
use = egg:swift#proxy
account_autocreate = True
配置操作员角色
这个配置是注释了的可以直接包括头[filter:keystoneauth]添加在配置最下面(不放心的去自己搜索看看)
[filter:keystoneauth]
use = egg:swift#keystoneauth
operator_roles = admin,user
配置认证服务访问
这个配置也是注释了的可以直接包括头[filter:authtoken]添加在配置最下面(不放心的去自己搜索看看)
[filter:authtoken]
paste.filter_factory = keystonemiddleware.auth_token:filter_factory
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = swift
password = 123456(创建用户时你为swift设置的密码)
delay_auth_decision = True
配置 memcached 的位置
[filter:cache]
use = egg:swift#memcache
memcache_servers = controller:11211

最新发布

CentOS专题

关于本站

5ibc.net旗下博客站精品博文小部分原创、大部分从互联网收集整理。尊重作者版权、传播精品博文,让更多编程爱好者知晓!

小提示

按 Ctrl+D 键,
把本文加入收藏夹