Skip to content

General configuration

Cristi Pufu edited this page Nov 6, 2015 · 1 revision

General configuration

In this tutorial I will guide you through the creation of a storage cluster using the OpenStack Swift services. Before starting this guide, you need to have at least one functional machine (vm or whatever) that represents a proxy/storage node or both, with Ubuntu 14.04 installed.


Firstly, we are going to setup some basic stuff on all nodes (proxy and storage nodes). Run commands as root user.

  • Create a user (in this example username=swift, password=swiftpass) which Swift services/daemons will run under:
useradd --create-home --user-group --shell /bin/bash swift
echo swift:swiftpass | chpasswd

  • Install prerequisites:
apt-get install python-software-properties swift python-swiftclient openssh-server

  • Create swift config directory and change the ownership:
mkdir /etc/swift && chown -R swift:swift /etc/swift

  • Create swift config file and copy it to all other nodes. Remember that you must use the same hash prefix/suffix for all current and future nodes. The hash is used as a salt when hashing to determine mappings in the ring.
cat >/etc/swift/swift.conf <<EOF
[swift-hash]
#random unique strings that can never change (DO NOT LOSE)
swift_hash_path_prefix = od -t x8 -N 8 -A n </dev/random
swift_hash_path_suffix = od -t x8 -N 8 -A n </dev/random
EOF
scp <ip_address_node_where_config_resides>:/etc/swift/swift.conf /etc/swift/

  • Create swift runtime directory:
mkdir -p /var/run/swift && chown -R swift:swift /var/run/swift

The /var/run/ directory is tmpfs so it is gone at system shutdown. In order to recreate it at startup you have to edit the /etc/rc.local and add the previous commands:

sed '/^exit 0/i\mkdir -p /var/run/swift && chown -R swift:swift /var/run/swift' /etc/rc.local

After you've finished with the previous steps on all nodes, continue with the following tutorials depending on the node's role starting with the proxy nodes:

Proxy node configuration

Storage node configuration