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

Cassandra/Tools

From Wikitech-static
< Cassandra
Revision as of 10:15, 18 July 2018 by imported>Eevans (Fix section hierarchy when transcluded from /Cassandra)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

cassandra-tools-wmf

c-cqlsh

Synopsis

c-cqlsh <id>

Description

Given an instance ID, executes cqlsh on that instance. Uses the the cqlshrc file located in the instance's configuration directory.

Example
$ c-cqlsh a
Connected to services-test at 10.64.0.202:9042.
[cqlsh 5.0.1 | Cassandra 2.2.6 | CQL spec 3.3.1 | Native protocol v4]
Use HELP for help.
cassandra@cqlsh>

c-any-nt

Synopsis

c-any-nt <arg> [arg ...]

Description

In a WMF multi-instance environment, executes nodetool on a randomly chosen instance (any instance).

Example
$ c-any-nt status -r
...

c-foreach-nt

Synopsis

c-foreach-nt <arg> [arg ...]

Description

In a WMF multi-instance environment, iteratively execute nodetool on all local Cassandra instances.

Example
$ c-foreach-nt version
a: ReleaseVersion: 2.2.6
b: ReleaseVersion: 2.2.6

c-foreach-restart

Synopsis
usage: c-foreach-restart [-h] [-a ATTEMPTS] [-r RETRY]
                          [--execute-post-shutdown CMD] [-d DELAY]
                          [--logmsgbot LOGMSGBOT] [--tcpircbot-host HOST]
                          [--tcpircbot-port PORT] [--phabricator-issue ISSUE]
 
 Cassandra instance restarter
 
 optional arguments:
   -h, --help            show this help message and exit
   -a ATTEMPTS, --attempts ATTEMPTS
                         Maximum number of times to check if service is up
                         after restarting.
   -r RETRY, --retry RETRY
                         Number seconds between connection attempts, in
                         seconds.
   --execute-post-shutdown CMD
                         Command to execute after Cassandra has been shutdown,
                         and before it is started back up.
   -d DELAY, --delay DELAY
                         Delay between instance restarts (defaults to no
                         delay).
   --logmsgbot
                         Log restarts to SAL (via logmsgbot and #wikimedia-
                         operations).
   --tcpircbot-host HOST
                         tcpircbot hostname. Only valid when --logmsgbot is
                         used. Default: einsteinium.wikimedia.org
   --tcpircbot-port PORT
                         tcpircbot port number. Only valid when --logmsgbot is
                         used. Default: 9200
   --phabricator-issue ISSUE
                         Phabricator issue to associate these restarts with.
                         This currently only makes sense in combination with
                         --logmsgbot where it is included in the formatted log
                         message.

Description

In a WMF multi-instance environment, iteratively restart instances.

Each instance is drained prior to being restarted. After each restart, the process blocks until the CQL port is listening.

Commands specified by --execute-post-shutdown can include the {id} template which will be substituted with the ID of the instance being restarted.

Example
$ sudo c-foreach-restart --execute-post-shutdown="echo '{id} is a teapot, short and stout'"
...

c-ls

Synopsis

c-ls

Description

List the IDs of the locally configured instance IDs.

Example
$ c-ls
a
b
c

streams

Synopsis
streams [-h] [-nt CMD]
 
 Cassandra streams monitor
 
 optional arguments:
   -h, --help            show this help message and exit
   -nt CMD, --nodetool CMD
                         Nodetool command to use
Description

Realtime console monitoring of streaming operations.

Preview-cassandra-streams.gif

Example
$ streams -nt nodetool-b

uyaml

Synopsis
uyaml [-h] yaml path
 
 YAML parser
 
 positional arguments:
   yaml        YAML file to parse
   path        Path to parse from file
 
 optional arguments:
   -h, --help  show this help message and exit
Description

Query attributes from a YAML file.

Example
$ uyaml /etc/cassandra-instances.d/restbase1007-a.yaml /jmx_port
7189
$ for i in `c-ls`; do uyaml /etc/cassandra-instances.d/restbase1007-$i.yaml /jmx_port; done
7189
7190
7191

cassandra-ca-manager

cassandra-ca-manager: manage Java keystores with a self-signed certificate authority

cassandra-metrics-collector

cassandra-metrics-collector: JMX metrics collector

cdsh

cdsh: a Cassandra cluster wrapper for dsh