Configure Swift on OpenStack Ocata standalone with Kolla
words - read.

Configure Swift on OpenStack Ocata standalone with Kolla

Swift is an OpenStack project which provides object storage to your cloud infrastructure. It is a high available and distributed service, which allows you to store configuration files, images, ISO, etc. safely and also allows you to access them easily. Swift is to OpenStack what S3 is to AWS.

OpenStack Swift Logo

Prerequisites

If you haven't done so yet, you need to Install and configure OpenStack Ocata with Kolla as a standalone.

You also need to add three new 50 GB disks to the Ubuntu 16.04 virtual machine built in the previous article. In this lab, the new 50 GB disks will be /dev/sdc, /dev/sdd, and /dev/sde as /dev/sdb was already used in the Configure Cinder on OpenStack Ocata standalone with Kolla article.

Prepare Ubuntu for Swift

1- Create a partition on each disk.

$ sudo parted /dev/sdc -s -- mklabel gpt mkpart KOLLA_SWIFT_DATA 1 -1

$ sudo parted /dev/sdd -s -- mklabel gpt mkpart KOLLA_SWIFT_DATA 1 -1

$ sudo parted /dev/sde -s -- mklabel gpt mkpart KOLLA_SWIFT_DATA 1 -1

2- Create a file system on each partition.

$ sudo mkfs.xfs -f -L d0 /dev/sdc1

$ sudo mkfs.xfs -f -L d1 /dev/sdd1

$ sudo mkfs.xfs -f -L d2 /dev/sde1

3- Create the script to initialize the Swift ring.

$ sudo vim init-swift-ring

4- Add the following content into the file.

#!/bin/bash
export KOLLA_INTERNAL_ADDRESS=10.10.20.33
export KOLLA_SWIFT_BASE_IMAGE="kolla/centos-source-swift-base:4.0.0"
mkdir -p /etc/kolla/config/swift
# Object ring
docker run \
  --rm \
  -v /etc/kolla/config/swift/:/etc/kolla/config/swift/ \
  $KOLLA_SWIFT_BASE_IMAGE \
  swift-ring-builder \
    /etc/kolla/config/swift/object.builder create 10 3 1
for i in {0..2}; do
  docker run \
    --rm \
    -v /etc/kolla/config/swift/:/etc/kolla/config/swift/ \
    $KOLLA_SWIFT_BASE_IMAGE \
    swift-ring-builder \
      /etc/kolla/config/swift/object.builder add r1z1-${KOLLA_INTERNAL_ADDRESS}:6000/d${i} 1;
done
# Account ring
docker run \
  --rm \
  -v /etc/kolla/config/swift/:/etc/kolla/config/swift/ \
  $KOLLA_SWIFT_BASE_IMAGE \
  swift-ring-builder \
    /etc/kolla/config/swift/account.builder create 10 3 1
for i in {0..2}; do
  docker run \
    --rm \
    -v /etc/kolla/config/swift/:/etc/kolla/config/swift/ \
    $KOLLA_SWIFT_BASE_IMAGE \
    swift-ring-builder \
      /etc/kolla/config/swift/account.builder add r1z1-${KOLLA_INTERNAL_ADDRESS}:6001/d${i} 1;
done
# Container ring
docker run \
  --rm \
  -v /etc/kolla/config/swift/:/etc/kolla/config/swift/ \
  $KOLLA_SWIFT_BASE_IMAGE \
  swift-ring-builder \
    /etc/kolla/config/swift/container.builder create 10 3 1
for i in {0..2}; do
  docker run \
    --rm \
    -v /etc/kolla/config/swift/:/etc/kolla/config/swift/ \
    $KOLLA_SWIFT_BASE_IMAGE \
    swift-ring-builder \
      etc/kolla/config/swift/container.builder add r1z1-${KOLLA_INTERNAL_ADDRESS}:6002/d${i} 1;
done
for ring in object account container; do
  docker run \
    --rm \
    -v /etc/kolla/config/swift/:/etc/kolla/config/swift/ \
    $KOLLA_SWIFT_BASE_IMAGE \
    swift-ring-builder \
      /etc/kolla/config/swift/${ring}.builder rebalance;
done

5- Add the execution permission on the script.

$ sudo chmod 755 init-swift-ring

6- Initialize the Swift ring.

$ sudo ./init-swift-ring

Install Swift

1- Edit the /etc/kolla/globals.yml configuration file.

$ sudo vim /etc/kolla/globals.yml

2- Enable Swift.

enable_swift: "yes"

3- Pull the Swift container images.

$ sudo kolla-ansible pull

4- Deploy Swift.

$ sudo kolla-ansible deploy

Comments

comments powered by Disqus