Sep 072015
 

OpenStack Logo

The Swift AKA OpenStack Object Storage is a multi-tenant object storage system, provides a distributed scale-out object store across storage nodes that are in the cluster. This guide helps you to configure swift on Ubuntu 14.04.2.

There are two main components in Swift:

Swift proxy:

It accepts API and raw http requests to upload files, modify metadata, and create containers. Since the requests are done through REST API, it uses HTTP verbs with simple commands such as PUT and GET. When the user sends a data to be written, request will be go to proxy server and it will choose perfect storage node to store the data. You can have a multiple proxy servers for performance and redundancy. In our case, we will use controller node as a swift proxy server.

Storage node:

This is where the user data gets stored, you can have multiple storage nodes in your environment. Swift is a replicated based system, all the data stored inside of it will be stored at multiple times (replicas) to ensure high availability of data.

Prerequisites:

The following is the network configuration of Proxy and Storage node, Storage Node will have one network interface on the management network.

ROLE NW CARD 1
PROXY SERVER (CONTROLLER NODE) 192.168.12.21 / 24, GW=192.168.12.2
(MANAGEMENT NETWORK)
OBJECT STORAGE NODE 1 192.168.12.25 / 24, GW=192.168.12.2
(MANAGEMENT NETWORK)
OBJECT STORAGE NODE 1 192.168.12.26 / 24, GW=192.168.12.2
(MANAGEMENT NETWORK)
OBJECT STORAGE NODE 1 192.168.12.27 / 24, GW=192.168.12.2
(MANAGEMENT NETWORK)

Install and configure swift proxy on the controller node:

Load your admin credential from the environment script.

# source admin-openrc.sh

Create the swift user for creating service credentials.

# openstack user create --password-prompt swift
User Password:
Repeat User Password:
+----------+----------------------------------+
| Field    | Value                            |
+----------+----------------------------------+
| email    | None                             |
| enabled  | True                             |
| id       | 023c019a62f3476d986627e8615b034f |
| name     | swift                            |
| username | swift                            |
+----------+----------------------------------+

Add the admin role to the swift user.

# openstack role add --project service --user swift admin
+-------+----------------------------------+
| Field | Value                            |
+-------+----------------------------------+
| id    | 33af4f957aa34cc79451c23bf014af6f |
| name  | admin                            |
+-------+----------------------------------+

Create the swift service entity.

# openstack service create --name swift --description "OpenStack Object Storage" object-store
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Object Storage         |
| enabled     | True                             |
| id          | b835a5fbfe3d4a9592f6dbd69ddb148d |
| name        | swift                            |
| type        | object-store                     |
+-------------+----------------------------------+

Create the Object Storage service API endpoint.

# openstack endpoint create --publicurl 'http://controller:8080/v1/AUTH_%(tenant_id)s' --internalurl 'http://controller:8080/v1/AUTH_%(tenant_id)s' --adminurl http://controller:8080 --region RegionOne  object-store

+--------------+----------------------------------------------+
| Field        | Value                                        |
+--------------+----------------------------------------------+
| adminurl     | http://controller:8080                       |
| id           | d250217af148491abc611e2b72a227b8             |
| internalurl  | http://controller:8080/v1/AUTH_%(tenant_id)s |
| publicurl    | http://controller:8080/v1/AUTH_%(tenant_id)s |
| region       | RegionOne                                    |
| service_id   | b835a5fbfe3d4a9592f6dbd69ddb148d             |
| service_name | swift                                        |
| service_type | object-store                                 |
+--------------+----------------------------------------------+

Install the packages on the Controller node.

# apt-get install swift swift-proxy python-swiftclient python-keystoneclient python-keystonemiddleware memcached

Create the /etc/swift directory.

# mkdir /etc/swift

Get the proxy configuration file from the source repository.

# curl -o /etc/swift/proxy-server.conf https://git.openstack.org/cgit/openstack/swift/plain/etc/proxy-server.conf-sample?h=stable/kilo

Edit the /etc/swift/proxy-server.conf file.

# nano /etc/swift/proxy-server.conf

Modify the below settings and make sure to place an entries in the proper sections. Some time you may need to add sections if it does not exists and also you require to add some entries which are missing in the file, not all.

[DEFAULT]
...
bind_port = 8080
user = swift
swift_dir = /etc/swift

[pipeline:main]
pipeline = catch_errors gatekeeper healthcheck proxy-logging cache container_sync bulk ratelimit authtoken keystoneauth container-quotas account-quotas slo dlo proxy-logging proxy-server

[app:proxy-server]
...
account_autocreate = true

[filter:keystoneauth]
use = egg:swift#keystoneauth
...
operator_roles = admin,user

[filter:authtoken]
paste.filter_factory = keystonemiddleware.auth_token:filter_factory
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = swift
password = password
## Replace "password" with the password you chose for swift user in the identity service
delay_auth_decision = true
## Comment out or remove any other options in the [filter:authtoken] section

[filter:cache]
...
memcache_servers = 127.0.0.1:11211

That’s All!!!, in our next tutorial we will configure storage nodes.