Swift/起動用スクリプトの作成

Swiftのインストールと、設定ファイルの作成後、各種サーバの起動等を行うスクリプトを作成します。
このページもSwift All In Oneを参考にしています。

$devとなっている部分は、使用する環境に合わせて変更してください。$user、$groupも同様です。
またこれらも、スクリプトを生成するスクリプトを作成してあります。

~/bin/resetswift

#!/bin/bash

swift-init all stop
sleep 5
sudo umount /mnt/$dev
sudo mkfs.xfs -f -i size=1024 /dev/$dev
sudo mount /mnt/$dev
sudo mkdir /mnt/$dev/1 /mnt/$dev/2 /mnt/$dev/3 /mnt/$dev/4 /mnt/$dev/test
sudo chown $user:$group /mnt/$dev/*
mkdir -p /srv/1/node/sdb1 /srv/2/node/sdb2 /srv/3/node/sdb3 /srv/4/node/sdb4
sudo rm -f /var/log/debug /var/log/messages /var/log/rsyncd.log /var/log/syslog
sudo service rsyslog restart
sudo service memcached restart

~/bin/remakerings

#!/bin/bash

cd /etc/swift

rm *.builder *.ring.gz backups/*.builder backups/*.ring.gz

swift-ring-builder object.builder create 18 3 1
swift-ring-builder object.builder add z1-127.0.0.1:6010/sdb1 1
swift-ring-builder object.builder add z2-127.0.0.1:6020/sdb2 1
swift-ring-builder object.builder add z3-127.0.0.1:6030/sdb3 1
swift-ring-builder object.builder add z4-127.0.0.1:6040/sdb4 1
swift-ring-builder object.builder rebalance
swift-ring-builder container.builder create 18 3 1
swift-ring-builder container.builder add z1-127.0.0.1:6011/sdb1 1
swift-ring-builder container.builder add z2-127.0.0.1:6021/sdb2 1
swift-ring-builder container.builder add z3-127.0.0.1:6031/sdb3 1
swift-ring-builder container.builder add z4-127.0.0.1:6041/sdb4 1
swift-ring-builder container.builder rebalance
swift-ring-builder account.builder create 18 3 1
swift-ring-builder account.builder add z1-127.0.0.1:6012/sdb1 1
swift-ring-builder account.builder add z2-127.0.0.1:6022/sdb2 1
swift-ring-builder account.builder add z3-127.0.0.1:6032/sdb3 1
swift-ring-builder account.builder add z4-127.0.0.1:6042/sdb4 1
swift-ring-builder account.builder rebalance

~/bin/startmain

#!/bin/bash

swift-init auth-server start
swift-init proxy-server start
swift-init account-server start
swift-init container-server start
swift-init object-server start

~/bin/startrest

#!/bin/bash

swift-auth-recreate-accounts
swift-init object-updater start
swift-init container-updater start
swift-init object-replicator start
swift-init container-replicator start
swift-init account-replicator start
swift-init object-auditor start
swift-init container-auditor start
swift-init account-auditor start
swift-init account-reaper start

chmod +x ~/bin/*

リンク

Swift All In One


トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS