Created
April 20, 2016 17:20
-
-
Save clayg/93bcc37ec4f5fc7ab028f07ac4305148 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ swift-ring-builder test.builder add r1z1-127.0.0.1:6000/sdb_555 1.0 | |
$ swift-ring-builder test.builder | |
test.builder, build version 2 | |
16 partitions, 1.000000 replicas, 1 regions, 1 zones, 1 devices, 0.00 balance, 0.00 dispersion | |
The minimum number of hours before a partition can be reassigned is 0 (0:00:00 remaining) | |
The overload factor is 0.00% (0.000000) | |
Ring file test.ring.gz is up-to-date | |
Devices: id region zone ip address port replication ip replication port name weight partitions balance flags meta | |
0 1 1 127.0.0.1 6000 127.0.0.1 6000 sdb 1.00 16 0.00 555 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[object-replicator] | |
rsync_module = {replication_ip}:{meta}:object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
from swift.common.ring import Ring | |
from swift.common.utils import readconf, rsync_module_interpolation | |
from argparse import ArgumentParser | |
parser = ArgumentParser() | |
parser.add_argument('--ring', default='/etc/swift/object.ring.gz', | |
help='the path to the ring') | |
parser.add_argument('--config', default='/etc/swift/object-server/1.conf.d', | |
help='the path to the config') | |
def main(): | |
args = parser.parse_args() | |
r = Ring(args.ring) | |
for dev in r.devs: | |
if dev is None: | |
continue | |
break | |
conf = readconf(args.config, 'object-replicator') | |
template = conf.get('rsync_module', '{replication_ip}::object') | |
print rsync_module_interpolation(template, dev) | |
if __name__ == "__main__": | |
sys.exit(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$./test_rsync_module.py --ring test.ring.gz --config test.conf | |
127.0.0.1:555:object |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment