Illustration Image

Cassandra.Link

The best knowledge base on Apache Cassandra®

Helping platform leaders, architects, engineers, and operators build scalable real time data platforms.

9/7/2018

Reading time:N/A min

eevans/cdsh

by John Doe

A simple wrapper script around DSHfor Apache Cassandra.Descriptiondsh restricts you to flat groups lists, cdsh wraps dsh to allow you to define yourclusters in a single YAML file (~/.cdsh by default), and then specify the hosts for remotecommands using arguments for cluster name, data-center, and rack.Usageusage: cdsh [-h] [-c CLUSTER] [-d DATA_CENTER] [-r RACK] [--config CONFIG] [-P] [args [args ...]]A dsh wrapper for Cassandrapositional arguments: args arguments to dshoptional 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(s) --config CONFIG yaml configuration file -P, --print-hosts output matching hosts (no command run) -e EXCLUDES, --exclude EXCLUDES hosts to exclude (glob)ExamplesExecuting a command on all nodes of cluster default:$ cdsh -c default -- uname -rExecuting a command on rack1 of cluster test in data-center datacenter1:$ cdsh -c test -d datacenter1 -r rack1 -- nodetool setstreamthroughput 200Using the host list for other commands:$ for i in `cdsh -c default -P`; do rsync cassandra.yaml $i:/etc/cassandra; done

Illustration Image

A simple wrapper script around DSH for Apache Cassandra.

Description

dsh restricts you to flat groups lists, cdsh wraps dsh to allow you to define your clusters in a single YAML file (~/.cdsh by default), and then specify the hosts for remote commands using arguments for cluster name, data-center, and rack.

Usage

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(s)
  --config CONFIG       yaml configuration file
  -P, --print-hosts     output matching hosts (no command run)
  -e EXCLUDES, --exclude EXCLUDES
                        hosts to exclude (glob)

Examples

Executing a command on all nodes of cluster default:

$ cdsh -c default -- uname -r

Executing a command on rack1 of cluster test in data-center datacenter1:

$ cdsh -c test -d datacenter1 -r rack1 -- nodetool setstreamthroughput 200

Using the host list for other commands:

$ for i in `cdsh -c default -P`; do rsync cassandra.yaml $i:/etc/cassandra; done

Related Articles

cassandra
shell
spark

The Correct Way to Connect Spark Shell to Cassandra

John Doe

8/28/2018

Checkout Planet Cassandra

Claim Your Free Planet Cassandra Contributor T-shirt!

Make your contribution and score a FREE Planet Cassandra Contributor T-Shirt! 
We value our incredible Cassandra community, and we want to express our gratitude by sending an exclusive Planet Cassandra Contributor T-Shirt you can wear with pride.

Join Our Newsletter!

Sign up below to receive email updates and see what's going on with our company

Explore Related Topics

AllKafkaSparkScyllaSStableKubernetesApiGithubGraphQl

Explore Further

cassandra