Configuring storage in Openstack

  • (4.0)

Configuring storage in Openstack:

An OpenStack object storage is a multi-tenant object storage system. As OpenStack Object Storage is designed to be highly extensible (manages large amounts of unstructured data very economically) and redundant and is usually installed across multiple nodes. Our test environment will have only one node, but OpenStack Object Storage still expects multiple destinations on our storage to replicate its data so we need to configure this appropriately for our test setup.

We will end up with four directories on our OpenStack Object Storage server specified as /srv/1-4, which points to directories on our new disk. The result is an OpenStack Object Storage setup that looks like it has four other Open Stack Object Storage nodes to replicate data to.

To gain in-depth knowledge and be on par with practical experience, then explore  OpenStack Training course.

Getting started

Assure that you are logged in to your swift virtual machine. To accomplish this, run:

How to achieve it…
To configure our OpenStack Object Storage host, carry out the following steps:

If you are using VMware Fusion, you will need to power the virtual machine down and add a second disk by hand.
1.We first create a new partition on our extra disk. This extra disk is seen as /dev/sdb, under Linux installation.
sudo fdisk /dev/sdb
2. Once in fdisk, use the following key presses to create a new partition:
  n p 1
  enter enter w
Once it is finished with the above key processes , it must look like this :

3. To get Linux to see this new partition without rebooting, run partprobe to reread the disk layout.
  sudo partprobe
4. Once completed, we can create our filesystem. For this, we shall use the XFS filesystem, as follows:
    sudo mkfs.xfs -i size=1024 /dev/sdb1
5. We can now create the required mount point and set up fstab to allow us to mount this new area, as shown:
      sudo mkdir /mnt/sdb1
6. Then, edit /etc/fstab to add in the following contents:
       /dev/sdb1 /mnt/sdb1 xfs   noatime,nodiratime,nobarrier,logbufs=8 0 0
7. We can now mount this area, as follows:
        sudo mount /dev/sdb1
8. Once done, we can create the required file structure, as follows:

9. To ensure OpenStack Storage to always start on boot, add the following commands to /etc/rc.local, before the line exit 0:
      mkdir -p /var/run/swiftchown swift:swift /var/run/swift

Explore OpenStack Sample Resumes! Download & Edit, Get Noticed by Top Employers!  Download Now!

How it works…

We first created a new partition on our extra disk and formatted this with the XFS filesystem. XFS is very good at handling large objects and has the necessary extended attributes (xattr) required for the objects in this filesystem.
Once created, we mount this area, and then begin to create the directory structure. The commands to create the directories and required symbolic links includes a lot of bash shorthand, such as {1..4}. This shorthand essentially prints out 1 2 3 4 when expanded, but repeats the preceding attached text when it does so. Take for example the following piece of code:
mkdir /mnt/sdb1/{1..4}

It is the equivalent of:
mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4
The effect of that short piece of code is the following directory structure:
/etc/swift /object-server /container-server /account-server

What we have done is set up a filesystem that will configure to replicate data into different device directories to mimic the actions and features an OpenStack Object Storage requires. In production, these device directories would actually be physical servers and physical devices on the servers and won’t necessarily have this directory structure, rather what we have built simulates this to demonstrate a working swift environment.
Related Pages:
Interview Questions:

Popular Courses in 2018

Get Updates on Tech posts, Interview & Certification questions and training schedules