In this article by Amar Kapadia, Sreedhar Varma, and Kris Rajana, authors of the book OpenStack Object Storage (Swift) Essentials, we will see how IT administrators can install OpenStack Swift. The version discussed here is the Juno release of OpenStack. Installation of Swift has several steps and requires careful planning before beginning the process.
A simple installation consists of installing all Swift components on a single node, and a complex installation consists of installing Swift on several proxy server nodes and storage server nodes. The number of storage nodes can be in the order of thousands across multiple zones and regions. Depending on your installation, you need to decide on the number of proxy server nodes and storage server nodes that you will configure. This article demonstrates a manual installation process; advanced users may want to use utilities such as Puppet or Chef to simplify the process.
This article walks you through an OpenStack Swift cluster installation that contains one proxy server and five storage servers.
(For more resources related to this topic, see here.)
This section describes the various hardware components involved in the setup. Since Swift deals with object storage, disks are going to be a major part of hardware planning. The size and number of disks required should be calculated based on your requirements.
Networking is also an important component, where factors such as a public or private network and a separate network for communication between storage servers need to be planned. Network throughput of at least 1 GB per second is suggested, while 10 GB per second is recommended.
The servers we set up as proxy and storage servers are dual quad-core servers with 12 GB of RAM.
In our setup, we have a total of 15 x 2 TB disks for Swift storage; this gives us a total size of 30 TB. However, with in-built replication (with a default replica count of 3), Swift maintains three copies of the same data. Therefore, the effective capacity for storing files and objects is approximately 10 TB, taking filesystem overhead into consideration. This is further reduced due to less than 100 percent utilization. The following figure depicts the nodes of our Swift cluster configuration:
The storage servers have container, object, and account services running in them.
All the servers are installed with the Ubuntu server operating system (64-bit LTS version 14.04). You'll need to configure three networks, which are as follows:
In order for various servers to communicate easily, edit the /etc/hosts file and add the host names of each server in it. This has to be done on all the nodes. The following screenshot shows an example of the contents of the /etc/hosts file of the proxy server node:
Install the Network Time Protocol (NTP) service on the proxy server node and storage server nodes. This helps all the nodes to synchronize their services effectively without any clock delays.
The pre-installation steps to be performed are as follows:
# apt-get install ntp
Configure the proxy server node to be the reference server for the storage server nodes to set their time from the proxy server node.
server ntp.ubuntu.com
# server 0.ubuntu.pool.ntp.org
# server 1.ubuntu.pool.ntp.org
# server 2.ubuntu.pool.ntp.org
# server 3.ubuntu.pool.ntp.org
server s-swift-proxy
# service ntp restart
The Ubuntu Cloud Archive is a special repository that provides users with the ability to install new releases of OpenStack.
The steps required to download and install Swift are as follows:
# apt-get update && apt-get dist-upgrade
# apt-get install swift rsync memcached python-netifaces python-xattr python-memcache
# mkdir –p /etc/swift/
# chown –R swift:swift /etc/swift
# curl –o /etc/swift/swift.conf
https://raw.githubusercontent.com/openstack/swift/stable/juno/
etc/swift.conf-sample
This section explains additional steps to set up the storage server nodes, which will contain the object, container, and account services.
The first step required to set up the storage server node is installing services. Let's look at the steps involved:
# apt-get install swift-account swift-container swift-object xfsprogs
# curl –o /etc/swift/account-server.conf
https://raw.githubusercontent.com/openstack/swift/stable/juno/
etc/account-server.conf-sample
# curl –o /etc/swift/container-server.conf
https://raw.githubusercontent.com/openstack/swift/stable/juno/
etc/container-server.conf-sample
# curl –o /etc/swift/object-server.conf
https://raw.githubusercontent.com/openstack/swift/stable/juno/
etc/object-server.conf-sample
On each storage server node, we need to identify the hard disks that will be used to store the data. We will then format the hard disks and mount them on a directory, which Swift will then use to store data. We will not create any RAID levels or subpartitions on these hard disks because they are not necessary for Swift. They will be used as entire disks. The operating system will be installed on separate disks, which will be RAID configured.
First, identify the hard disks that are going to be used for storage and format them. In our storage server, we have identified sdb, sdc, and sdd to be used for storage.
We will perform the following operations on sdb. These four steps should be repeated for sdc and sdd as well:
# fdisk /dev/sdb
# mkfs.xfs /dev/sdb1
# mkdir –p /srv/node/sdb1
# chown –R swift:swift /srv/node/sdb1
/dev/sdb1 /srv/node/sdb1 xfs
noatime,nodiratime,nobarrier,logbufs=8 0 2
# mount /srv/node/sdb1
In order for Swift to perform the replication of data, we need to configure rsync by configuring rsyncd.conf. This is done by performing the following steps:
# vi /etc/rsyncd.conf
We are setting up synchronization within the network by including the following lines in the configuration file:
172.168.9.52 is the IP address that is on the replication network for this storage server. Use the appropriate replication network IP addresses for the corresponding storage servers.
RSYNC_ENABLE=true
# service rsync restart
# mkdir -p /var/cache/swift
# mkdir -p /var/swift/recon
# chown -R swift:swift /var/cache/swift
# chown -R swift:swift /var/swift/recon
Repeat these steps on every storage server.
This section explains the steps required to set up the proxy server node, which are as follows:
# apt-get install python-swiftclient python-keystoneclient
python-keystonemiddleware swift-proxy
https://raw.githubusercontent.com/openstack/swift/stable/juno/
etc/proxy-server.conf-sample
# vi /etc/swift/proxy-server.conf
admin_token = 01d8b673-9ebb-41d2-968a-d2a85daa1324
admin_tenant_name = admin
admin_user = admin
admin_password = changeme
# mkdir -p /home/swift/keystone-signing
# mkdir -R swift:swift /home/swift/keystone-signing
In this article, you learned how to install and set up the OpenStack Swift service to provide object storage, and install and set up the Keystone service to provide authentication for users to access the Swift object storage.
Further resources on this subject: