Cluster management tools for Apache Cassandra.
c-cqlsh <id>
Given an instance ID, executes cqlsh
on that instance. Uses the the cqlshrc
file located in the instance's configuration directory.
$ 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 <arg> [arg ...]
In a WMF multi-instance environment, executes nodetool on a randomly chosen instance (any instance).
$ c-any-nt status -r
...
c-foreach-nt <arg> [arg ...]
In a WMF multi-instance environment, iteratively execute nodetool on all local Cassandra instances.
$ c-foreach-nt version
a: ReleaseVersion: 2.2.6
b: ReleaseVersion: 2.2.6
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 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.
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.
$ sudo c-foreach-restart --execute-post-shutdown="echo '{id} is a teapot, short and stout'"
...
c-ls
List the IDs of the locally configured instance IDs.
$ c-ls
a
b
c
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
Realtime console monitoring of streaming operations.
$ streams -nt nodetool-b
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
Query attributes from a YAML file.
$ 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
$ git checkout master
$ make orig.tar.gz
$ git checkout debian
$ git merge master
$ # Update debian/changelog accordingly
$ dpkg-buildpackage -rfakeroot # or alternately...
$ gbp buildpackage -rfakeroot -us -uc