2012年11月22日木曜日

Openstack swift rebalance太郎

SwiftでのRebalance手順まとめたお(*´ω`*)(*´ω`*)


レプリカの一台が復旧できない状態に鳴った場合を想定して、
nodeの切り離し、別のnodeの追加まとめた。


#zone確認
root@swift-proxy01:/etc/swift# swift-ring-builder object.builder
object.builder, build version 3
262144 partitions, 3 replicas, 3 zones, 3 devices, 0.00 balance
The minimum number of hours before a partition can be reassigned is 1
Devices:    id  zone      ip address  port      name weight partitions balance meta
0     1    xx.xxx.xx.41  6000      sdb1   1.00     262144    0.00
1     2    xx.xxx.xx.43  6000      sdb1   1.00     262144    0.00
2     3    xx.xxx.xx.44  6000      sdb1   1.00     262144    0.00

#ringからのremoce
root@swift-proxy01:/etc/swift# swift-ring-builder object.builder remove z1-xx.xxx.xx.41/sdb1
d0z1-xx.xxx.xx.41:6000/sdb1_"" marked for removal and will be removed next rebalance.

#ringへの追加
root@swift-proxy01:/etc/swift# swift-ring-builder object.builder add z1-xx.xxx.xx.45:6000/sdb1 1
Device z1-xx.xxx.xx:6000/sdb1_"" with 1.0 weight got id 3

#rebalance
root@swift-proxy01:/etc/swift# swift-ring-builder object.builder rebalance
Reassigned 262144 (100.00%) partitions. Balance is now 0.00.

#zone確認
#xx.xxx.xx.41がはずれ、45が追加されていることがわかる。
root@swift-proxy01:/etc/swift# swift-ring-builder object.builder
object.builder, build version 6
262144 partitions, 3 replicas, 3 zones, 3 devices, 0.00 balance
The minimum number of hours before a partition can be reassigned is 1
Devices:    id  zone      ip address  port      name weight partitions balance meta
1     2    xx.xxx.xx.43  6000      sdb1   1.00     262144    0.00
2     3    xx.xxx.xx.44  6000      sdb1   1.00     262144    0.00
3     1    xx.xxx.xx.45  6000      sdb1   1.00     262144    0.00
root@swift-proxy01:/etc/swift#

#この時点ではrebalanceは動かないため、proxyサーバに、builderファイル、ringファイルを展開。container object accountにはringファイルを展開
#その後、swift-init all reload"で再読み込みすればrebalanceが開始される。

0 件のコメント: