Add script to create ring and start server

This commit is contained in:
Chmouel Boudjnah 2011-11-01 15:36:00 +01:00
parent a03f005673
commit a2118984c0
3 changed files with 38 additions and 0 deletions

26
files/swift-remakerings Normal file
View file

@ -0,0 +1,26 @@
#!/bin/bash
cd /etc/swift
rm -f *.builder *.ring.gz backups/*.builder backups/*.ring.gz
swift-ring-builder object.builder create %SWIFT_PARTITION_POWER_SIZE% 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 %SWIFT_PARTITION_POWER_SIZE% 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 %SWIFT_PARTITION_POWER_SIZE% 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

3
files/swift-startmain Normal file
View file

@ -0,0 +1,3 @@
#!/bin/bash
swift-init all start

View file

@ -280,6 +280,9 @@ SWIFT_LOCATION=${SWIFT_LOCATION:-/srv}
# Size of the loopback disks # Size of the loopback disks
SWIFT_LOOPBACK_DISK_SIZE=${SWIFT_LOOPBACK_DISK_SIZE:-1000000} SWIFT_LOOPBACK_DISK_SIZE=${SWIFT_LOOPBACK_DISK_SIZE:-1000000}
# Default partition power size (bigger is slower)
SWIFT_PARTITION_POWER_SIZE=${SWIFT_PARTITION_POWER_SIZE:-9}
# Keystone # Keystone
# -------- # --------
@ -664,6 +667,12 @@ EOF
generate_swift_configuration container 6011 2 generate_swift_configuration container 6011 2
generate_swift_configuration account 6012 2 generate_swift_configuration account 6012 2
# Install swift helper scripts to remake the rings and start all services.
sed -e "s/%SWIFT_PARTITION_POWER_SIZE%/$SWIFT_PARTITION_POWER_SIZE/" $FILES/swift-remakerings | \
sudo tee /usr/local/bin/swift-remakerings
sudo install -m755 $FILES/swift-startmain /usr/local/bin/
sudo chmod +x /usr/local/bin/swift-*
unset s swift_hasH unset s swift_hasH
fi fi