next up previous contents
Next: Swift 除錯 Up: 物件儲存 Swift Previous: 設定 Swift Service Ring   Contents


Swift Ring 配置錯誤修正

  1. 查看 container.builder,其中前二項 ip address 錯誤為 192.168.122。
    [root@kvm4 ~(keystone_admin)]# swift-ring-builder /etc/swift/container.builder
    /etc/swift/container.builder, build version 4
    512 partitions, 2.000000 replicas, 1 regions, 2 zones, 4 devices, 100.00 balance
    The minimum number of hours before a partition can be reassigned is 1
    Devices:    id  region  zone      ip address  port      name weight partitions balance meta
                 0     1     1     192.168.122  6001      z1d1 100.00        512 100.00 
                 1     1     2     192.168.122  6001      z2d1 100.00        512 100.00 
                 2     1     1   192.168.122.4  6001      z1d1 100.00          0-100.00 
                 3     1     2   192.168.122.4  6001      z2d1 100.00          0-100.00
    
  2. 刪除錯誤的兩項,移除時系統提醒要做 rebalance 才生效。
    [root@kvm4 ~(keystone_admin)]# swift-ring-builder /etc/swift/container.builder remove 192.168.122/z1d1
    d0r1z1-192.168.122:6001/z1d1_"" marked for removal and will be removed next rebalance.
    [root@kvm4 ~(keystone_admin)]# swift-ring-builder /etc/swift/container.builder remove 192.168.122/z2d1
    d1r1z2-192.168.122:6001/z2d1_"" marked for removal and will be removed next rebalance.
    
  3. 進行 container.builde 的 rebalance。
    [root@kvm4 ~(keystone_admin)]# swift-ring-builder /etc/swift/container.builder rebalance
    Reassigned 512 (100.00%) partitions. Balance is now 0.00.
    
  4. 再次查看 container.builde,已剩下正確的兩項,且 partitions 也修正。
    [root@kvm4 ~(keystone_admin)]# swift-ring-builder /etc/swift/container.builder
    /etc/swift/container.builder, build version 7
    512 partitions, 2.000000 replicas, 1 regions, 2 zones, 2 devices, 0.00 balance
    The minimum number of hours before a partition can be reassigned is 1
    Devices:    id  region  zone      ip address  port      name weight partitions balance meta
                 2     1     1   192.168.122.4  6001      z1d1 100.00        512   0.00 
                 3     1     2   192.168.122.4  6001      z2d1 100.00        512   0.00
    
  5. 使用以下方式直接刪除 account 的相關檔案,就可以重新再做。
    [root@kvm4 ~(keystone_admin)]# rm /etc/swift/account.builder
    [root@kvm4 ~(keystone_admin)]# rm /etc/swift/account.ring.gz
    [root@kvm4 ~(keystone_admin)]# rm /etc/swift/backups/*account.builder
    [root@kvm4 ~(keystone_admin)]# rm /etc/swift/backups/*account.ring.gz
    



2015-12-29