You are browsing a read-only backup copy of Wikitech. The primary site can be found at wikitech.wikimedia.org

Difference between revisions of "Cassandra/Tools/cdsh"

From Wikitech-static
Jump to navigation Jump to search
imported>Eevans
(Undo revision 919013 by Eevans (talk))
imported>EpicPupper
m (fix typo)
 
Line 2: Line 2:


== Project ==
== Project ==
* [https://github.com/eevans/cdsh Github project page]
* [https://github.com/eevans/cdsh GitHub project page]
* [https://github.com/eevans/cdsh/releases/latest Debian package download]
* [https://github.com/eevans/cdsh/releases/latest Debian package download]



Latest revision as of 21:00, 31 July 2021

cdsh is a simple wrapper for dsh. It allows you to define a single hierarchical configuration for remote command execution, by cluster, data-center, and rack.

Project

Configuration

# Save as ~/.cdsh

# The restbase cluster (-c restbase)
restbase:
  # Data-center 'eqiad' (-d eqiad)
  eqiad:
    # Rack a (-r a)
    a:
      - restbase1007.eqiad.wmnet
      - restbase1010.eqiad.wmnet
      - restbase1011.eqiad.wmnet
    # Rack b (-r b)
    b:
      - restbase1003.eqiad.wmnet
      - restbase1004.eqiad.wmnet
      - restbase1008.eqiad.wmnet
    # Rack d (-r d)
    d:
      - restbase1005.eqiad.wmnet
      - restbase1006.eqiad.wmnet
      - restbase1009.eqiad.wmnet
  # Data-center 'codfw' (-d codfw)
  codfw:
    # Rack b (-r b)
    b:
      - restbase2001.codfw.wmnet
      - restbase2002.codfw.wmnet
      - restbase2007.codfw.wmnet
    # Rack c (-r c)
    c:
      - restbase2003.codfw.wmnet
      - restbase2004.codfw.wmnet
      - restbase2008.codfw.wmnet
    # Rack d (-r d)
    d:
      - restbase2005.codfw.wmnet
      - restbase2006.codfw.wmnet
      - restbase2009.codfw.wmnet

aqs:
  datacenter1:
    rack1:
      - aqs1001.eqiad.wmnet
      - aqs1002.eqiad.wmnet
      - aqs1003.eqiad.wmnet

Usage

$ cdsh -h
usage: cdsh [-h] [-c CLUSTER] [-d DATA_CENTER] [-r RACK] [--config CONFIG]
            [-P]
            [args [args ...]]

A dsh wrapper for Cassandra

positional arguments:
  args                  arguments to dsh

optional arguments:
  -h, --help            show this help message and exit
  -c CLUSTER, --cluster CLUSTER
                        cluster name
  -d DATA_CENTER, --data-center DATA_CENTER
                        data-center name
  -r RACK, --rack RACK  rack name
  --config CONFIG       yaml configuration file

Examples

Output kernel version for all machines in the restbase cluster, eqiad data-center, rack a:

$ cdsh -c restbase -d eqiad -r a -- uname -r
restbase1007.eqiad.wmnet: 4.4.0-1-amd64
restbase1010.eqiad.wmnet: 4.4.0-1-amd64
restbase1011.eqiad.wmnet: 4.4.0-1-amd64

To print all of the hosts in the aqs cluster:

$ cdsh -c aqs -P
aqs1001.eqiad.wmnet
aqs1002.eqiad.wmnet
aqs1003.eqiad.wmnet