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

Cassandra/Tools/cdsh

From Wikitech-static
< Cassandra‎ | Tools
Revision as of 01:04, 17 August 2016 by imported>Eevans (improved descr.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

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