Created
February 12, 2016 06:08
-
-
Save sougou/a6826dd38e5c5bce5d48 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
#!/usr/bin/python | |
"""This tool prints a list of all vttablets from vtctld. | |
This is meant to be used in conjucntion with vtexec.py. | |
Run vtlist.py and pipe it through grep filters to narrow down | |
the list of vttablets you want to identify. Once you're satisfied with the | |
list, pipe the final output to vtexec.py, which will execute the given | |
command on all vttablets of the list. | |
Example commands: | |
Run a command on all prod masters: | |
vtlist.py cell | grep master | grep -v test | vtexec.py '...' | |
Run a command on all replicas of a keyspace: | |
vtlist.py cell | grep keyspace| grep replica | vtexec.py '...' | |
""" | |
import argparse | |
import subprocess | |
if __name__ == "__main__": | |
parser = argparse.ArgumentParser() | |
parser.add_argument("cell") | |
args = parser.parse_args() | |
subprocess.check_call(["vtctl", "ListAllTablets", args.cell]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment