From Fedora Project Wiki

Description

Testing the swift auditor and replicator. The swift auditor is responsible for checking files for bit rot, when it finds a file whose hash does not match what it should it moves it into the quarantine for a replicator to replace

Setup

We first need to configure and enable rsync

$> sudo yum install -y xinetd rsync
$> sudo sed -i -e 's/disable.*/disable = no/g' /etc/xinetd.d/rsync

Create the file /etc/rsyncd.conf with the following contents

$> sudo tee /etc/rsyncd.conf <<EOF
uid = swift
gid = swift
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
address = 127.0.0.1
[account]
max connections = 2
path = /srv/node/
read only = false
lock file = /var/run/account.lock
[container]
max connections = 2
path = /srv/node/
read only = false
lock file = /var/run/container.lock
[object]
max connections = 2
path = /srv/node/
read only = false
lock file = /var/run/object.lock
EOF

Start xinetd

$> sudo service xinetd restart
$> sudo chkconfig xinetd on 

How to test

Select one of the data files on the a storage device and currupt its contents

$> DATA_FILE=$(find /srv/node/device1/objects/ -name "*.data" | head -1)
$> ls / | sudo tee $DATA_FILE

Expected Results

After a short time ( < 1 minute), the corrupted file should have been moved by the auditor. And a fresh version should have been replaced by the replicater

$> sudo find /srv/node/ -type f -name $(basename $DATA_FILE) -exec md5sum {} \;
3482e30580475b04a1b552d41c559582  /srv/node/device1/quarantined/objects/b9a470cf10b569cf56acb7e71dab3d81/1347830459.42610.data
ba1610dfb5b7fac8d6dd4a348761b5ee  /srv/node/device1/objects/2970/d81/b9a470cf10b569cf56acb7e71dab3d81/1347830459.42610.data
ba1610dfb5b7fac8d6dd4a348761b5ee  /srv/node/device2/objects/2970/d81/b9a470cf10b569cf56acb7e71dab3d81/1347830459.42610.data
ba1610dfb5b7fac8d6dd4a348761b5ee  /srv/node/device3/objects/2970/d81/b9a470cf10b569cf56acb7e71dab3d81/1347830459.42610.data