Skip to content

Storage node configuration

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

Swift should work on any modern file system that supports Extended Attributes, because xattrs are used to store meta-data about swift entities. The recommended file system is xfs because of what happens when the drives corrupt the data. xfs leaves empty files in directories where the corrupt data is, while ext4 moves them to lost+found without a trace, making swift auditors unaware of the missing files, thus not triggering the replication process.


If you just added the hard drives, before you start configuring the storage nodes, you have to partition and format the disks.

###Quick partition/format guide:

  • View disk info (get disk logical name):
lshw -C disk 
  • Partition whole disk (new, primary, (1-4), start bit, end bit, write & exit):
(echo n; echo p; echo 1; echo 1; echo; echo w) | fdisk /dev/sdb
  • Install prerequisites
apt-get install xfsprogs
  • Format partition
mkfs.xfs /dev/sdb
  • Display info about disks
lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL

Storage node configuration

  • Install prerequisites
apt-get -y install swift-account swift-container swift-object rsync

  • Create node device directory structure and mount devices
mkdir /srv/node/
mkdir /srv/node/sdb && chown swift:swift /srv/node/sdb
mkdir /srv/node/sdc && chown swift:swift /srv/node/sdc
echo "/dev/sdb /srv/node/sdb      xfs   auto,users,noatime,nodiratime,nobarrier 0 2" >> /etc/fstab
echo "/dev/sdc /srv/node/sdc      xfs   auto,users,noatime,nodiratime,nobarrier 0 2" >> /etc/fstab

If you're using ext4, make sure you add user_xattr in the /etc/fstab options column, as it's not enabled by default.


  • Setup RSYNC for replication:
cat >/etc/rsyncd.conf <<EOF
uid = swift
gid = swift
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
address = $STORAGE_NODE_IP

[account]
max connections = 2
path = /srv/node/
read only = false
lock file = /var/lock/account.lock
[container]
max connections = 2
path = /srv/node/
read only = false
lock file = /var/lock/container.lock
[object]
max connections = 2
path = /srv/node/
read only = false
lock file = /var/lock/object.lock
EOF
  • Enable RSYNC
sed -i -e 's/RSYNC_ENABLE=false/RSYNC_ENABLE=true/g' /etc/default/rsync
service rsync start

cat >/etc/swift/account-server.conf <<EOF
[DEFAULT]
bind_ip = $STORAGE_NODE_IP
workers = 2
[pipeline:main]
pipeline = account-server
[app:account-server]
use = egg:swift#account
[account-replicator]
[account-auditor]
[account-reaper]
EOF
cat >/etc/swift/container-server.conf <<EOF
[DEFAULT]
bind_ip = $STORAGE_NODE_IP
workers = 2
[pipeline:main]
pipeline = container-server
[app:container-server]
use = egg:swift#container
[container-replicator]
[container-updater]
[container-auditor]
[container-sync]
EOF
cat >/etc/swift/object-server.conf <<EOF
[DEFAULT]
bind_ip = $STORAGE_NODE_IP
workers = 2
[pipeline:main]
pipeline = object-server
[app:object-server]
use = egg:swift#object
[object-replicator]
[object-updater]
[object-auditor]
EOF

  • Start swift services:
swift-init all start

If you finished configuring all the nodes, you're probably ready to test your configuration.