Ask Your Question
0

How do I "push" or "repush" a swift ring?

asked 2014-03-16 23:39:01 -0600

tudor gravatar image

updated 2014-03-17 00:11:30 -0600

When I set up my first swift ring, to add the node it was as simple as calling:

$export ZONE=1
$export STORAGE_LOCAL_NET_IP=192.168.0.4
$swift-ring-builder account.builder add z$ZONE-$STORAGE_LOCAL_NET_IP:6002/$DEVICE $WEIGHT
WARNING: No region specified for z1-192.168.0.4:6002/sdb1. Defaulting to region 1.
Device d1r1z1-192.168.0.4:6002R192.168.0.4:6002/sdb1_"" with 100.0 weight got id 1

However, if I set the weight to zero, and then remove the node the same way:

$swift-ring-builder account.builder set_weight z$ZONE-$STORAGE_LOCAL_NET_IP:6002/$DEVICE 0
d1r1z1-192.168.0.4:6002R192.168.0.4:6002/sdb1_"" weight set to 0.0
$swift-ring-builder account.builder remove z$ZONE-$STORAGE_LOCAL_NET_IP:6002/$DEVICE
d1r1z1-192.168.0.4:6001R192.168.0.4:6001/sdb1_"" marked for removal and will be removed next rebalance.

Then I add the node again - this time with a different zone:

$export ZONE=2
$swift-ring-builder account.builder add z$ZONE-$STORAGE_LOCAL_NET_IP:6002/$DEVICE $WEIGHT
WARNING: No region specified for z2-192.168.0.4:6002/sdb1. Defaulting to region 1.
Device d1r1z2-192.168.0.4:6002R192.168.0.4:6002/sdb1_"" with 100.0 weight got id 1

Then wait the allotted period (1 hour) and rebalance:

$sudo swift-ring-builder account.builder rebalance

I get:

Reassigned 262144 (100.00%) partitions. Balance is now 100.00.
-------------------------------------------------------------------------------
NOTE: Balance of 100.00 indicates you should push this 
      ring, wait at least 1 hours, and rebalance/repush.
-------------------------------------------------------------------------------

"repush" isn't in man swift-ring-builder.

At first, swift-ring-builder told me that the relationship was 200.00 to -100.00. e.g.

$ swift-ring-builder /etc/swift/account.builder 
/etc/swift/account.builder, build version 11
262144 partitions, 3.000000 replicas, 1 regions, 1 zones, 3 devices, 200.00 balance
The minimum number of hours before a partition can be reassigned is 1
Devices:    id  region  zone      ip address  port  replication ip  replication port      name weight partitions balance meta
             0       1     1     192.168.0.3  6002     192.168.0.3              6002      sdb1 100.00     786432  200.00 
             1       1     1     192.168.0.4  6002     192.168.0.4              6002      sdb1 100.00          0 -100.00 
             2       1     1     192.168.0.5  6002     192.168.0.5              6002      sdb1 100.00          0 -100.00

Then, after a few minutes, it rebalanced it to 100 to -50:

$ swift-ring-builder /etc/swift/account.builder 
/etc/swift/account.builder, build version 12
262144 partitions, 3.000000 replicas, 1 regions, 1 zones, 3 devices, 100.00 balance
The minimum number of hours before a partition can be reassigned is 1
Devices:    id  region  zone      ip address  port  replication ip  replication port      name weight partitions balance meta
         0       1     1     192.168.0.3  6002     192.168.0.3              6002      sdb1 100.00     524288  100.00 
         1       1     1     192.168.0.4  6002     192.168.0.4              6002      sdb1 100.00     131072  -50.00 
         2       1     1     192.168.0.5  6002     192.168.0.5              6002      sdb1 100.00     131072  -50.00 ...
(more)
edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2014-03-17 03:43:37 -0600

The push or re-push rings can't be done by Swift command. Administrator need to dispatch the new balanced rings to all nodes within the cluster by some ways.

  1. Manually by scp
  2. Other dispatch solution
edit flag offensive delete link more

Comments

So on node 1: $rsync -avz /srv/node/sdb1/ node2:/srv/node/sdb1/ ?

tudor gravatar imagetudor ( 2014-03-17 17:42:40 -0600 )edit

After a quick chat on IRC, what is meant is the ring metadata in /etc/swift. e.g. on the proxy: scp /etc/swift/account.ring.gz node2:/etc/swift/ Then reload: swift-init all reload This has to be done to *all* the storage nodes, not just the ones modified.

tudor gravatar imagetudor ( 2014-03-17 17:55:59 -0600 )edit

@hugo-kuo Can you edit your answer to make that clearer? Then I'll accept it. Thanks!

tudor gravatar imagetudor ( 2014-03-17 18:03:44 -0600 )edit
0

answered 2014-03-17 03:48:38 -0600

elementak gravatar image

I have the same question, but mine is different. The partition of new disk added is always 0. Balance is -100.00.It won't change any more.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2014-03-16 23:39:01 -0600

Seen: 605 times

Last updated: Mar 17 '14