Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon

Installing OpenStack Swift

Save for later
  • 10 min read
  • 04 Jun 2015

article-image

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.)

Hardware planning

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:

installing-openstack-swift-img-0

The storage servers have container, object, and account services running in them.

Server setup and network configuration

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:

  • Public network: The proxy server connects to this network. This network provides public access to the API endpoints within the proxy server.
  • Storage network: This is a private network and it is not accessible to the outside world. All the storage servers and the proxy server will connect to this network. Communication between the proxy server and the storage servers and communication between the storage servers take place within this network. In our configuration, the IP addresses assigned in this network are 172.168.10.0 and 172.168.10.99.
  • Replication network: This is also a private network that is not accessible to the outside world. It is dedicated to replication traffic, and only storage servers connect to it. All replication-related communication between storage servers takes place within this network. In our configuration, the IP addresses assigned in this network are 172.168.9.0 and 172.168.9.99. This network is optional, and if it is set up, the traffic on it needs to be monitored closely.

Pre-installation steps

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:

installing-openstack-swift-img-1

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:

  1. Run the following command to install the NTP service:
    # 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.

    Unlock access to the largest independent learning library in Tech for FREE!
    Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
    Renews at €18.99/month. Cancel anytime
  2. Make sure that the following line is present in /etc/ntp.conf for NTP configuration in the proxy server node:
    server ntp.ubuntu.com
  3. For NTP configuration in the storage server nodes, add the following line to /etc/ntp.conf. Comment out the remaining lines with server addresses such as 0.ubuntu.pool.ntp.org, 1.ubuntu.pool.ntp.org, 2.ubuntu.pool.ntp.org, and 3.ubuntu.pool.ntp.org:
    # 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
  4. Restart the NTP service on each server with the following command:
    # service ntp restart

Downloading and installing Swift

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:

  1. Enable the capability to install new releases of OpenStack, and install the latest version of Swift on each node using the following commands. The second command shown here creates a file named cloudarchive-juno.list in /etc/apt/sources.list.d, whose content is "deb http://ubuntu-cloud.archieve.canonical.com/ubuntu":
    installing-openstack-swift-img-2
  2. Now, update the OS using the following command:
    # apt-get update && apt-get dist-upgrade
  3. On all the Swift nodes, we will install the prerequisite software and services using this command:
    # apt-get install swift rsync memcached python-netifaces python-xattr python-memcache
  4. Next, we create a Swift folder under /etc and give users the permission to access this folder, using the following commands:
    # mkdir –p /etc/swift/
    # chown –R swift:swift /etc/swift
  5. Download the /etc/swift/swift.conf file from GitHub using this command:
    # curl –o /etc/swift/swift.conf 
    https://raw.githubusercontent.com/openstack/swift/stable/juno/
    etc/swift.conf-sample
  6. Modify the /etc/swift/swift.conf file and add a variable called swift_hash_path_suffix in the swift-hash section. We then create a unique hash string using # python –c "from uuid import uuid4; print uuid4()" or # openssl rand –hex 10, and assign it to this variable, as shown in the following configuration option:
    installing-openstack-swift-img-3
  7. We then add another variable called swift_hash_path_prefix to the swift-hash section, and assign to it another hash string created using the method described in the preceding step. These strings will be used in the hashing process to determine the mappings in the ring. The swift.conf file should be identical on all the nodes in the cluster.

Setting up storage server nodes

This section explains additional steps to set up the storage server nodes, which will contain the object, container, and account services.

Installing services

The first step required to set up the storage server node is installing services. Let's look at the steps involved:

  1. On each storage server node, install the packages for swift-account services, swift-container services, swift-object services, and xfsprogs (XFS Filesystem) using this command:
    # apt-get install swift-account swift-container swift-object xfsprogs
  2. Download the account-server.conf, container-server.conf, and object-server.conf samples from GitHub, using the following commands:
    # 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
  3. Edit the /etc/swift/account-server.conf file with the following section:
    installing-openstack-swift-img-4
  4. Edit the /etc/swift/container-server.conf file with this section:
    installing-openstack-swift-img-5
  5. Edit the /etc/swift/object-server.conf file with the following section:
    installing-openstack-swift-img-6

Formatting and mounting hard disks

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:

  1. Carry out the partitioning for sdb and create the filesystem using this command:
    # fdisk /dev/sdb
    # mkfs.xfs /dev/sdb1
  2. Then let's create a directory in /srv/node/sdb1 that will be used to mount the filesystem. Give the permission to the swift user to access this directory. These operations can be performed using the following commands:
    # mkdir –p /srv/node/sdb1
    # chown –R swift:swift /srv/node/sdb1
  3. We set up an entry in fstab for the sdb1 partition in the sdb hard disk, as follows. This will automatically mount sdb1 on /srv/node/sdb1 upon every boot. Add the following command line to the /etc/fstab file:
    /dev/sdb1 /srv/node/sdb1 xfs
    noatime,nodiratime,nobarrier,logbufs=8 0 2
  4. Mount sdb1 on /srv/node/sdb1 using the following command:
    # mount /srv/node/sdb1

RSYNC and RSYNCD

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:

  1. Create the rsyncd.conf file in the /etc folder with the following content:
    # vi /etc/rsyncd.conf

    We are setting up synchronization within the network by including the following lines in the configuration file:
    installing-openstack-swift-img-7

    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.

  2. We then have to edit the /etc/default/rsync file and set RSYNC_ENABLE to true using the following configuration option:
    RSYNC_ENABLE=true
  3. Next, we restart the rsync service using this command:
    # service rsync restart
  4. Then we create the swift, recon, and cache directories using the following commands, and then set its permissions:
    # mkdir -p /var/cache/swift
    # mkdir -p /var/swift/recon
  5. Setting permissions is done using these commands:
    # chown -R swift:swift /var/cache/swift
    # chown -R swift:swift /var/swift/recon

Repeat these steps on every storage server.

Setting up the proxy server node

This section explains the steps required to set up the proxy server node, which are as follows:

  1. Install the following services only on the proxy server node:
    # apt-get install python-swiftclient python-keystoneclient
    python-keystonemiddleware swift-proxy
  2. Swift doesn't support HTTPS. OpenSSL has already been installed as part of the operating system installation to support HTTPS. We are going to use the OpenStack Keystone service for authentication. In order to set up the proxy-server.conf file for this, we download the configuration file from the following link and edit it:
    https://raw.githubusercontent.com/openstack/swift/stable/juno/
    etc/proxy-server.conf-sample
    # vi /etc/swift/proxy-server.conf
  3. The proxy-server.conf file should be edited to get the correct auth_host, admin_token, admin_tenant_name, admin_user, and admin_password values:
    admin_token = 01d8b673-9ebb-41d2-968a-d2a85daa1324
    admin_tenant_name = admin
    admin_user = admin
    admin_password = changeme
  4. Next, we create a keystone-signing directory and give permissions to the swift user using the following commands:
    # mkdir -p /home/swift/keystone-signing
    # mkdir -R swift:swift /home/swift/keystone-signing

Summary

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.

Resources for Article:


Further resources on this subject: