Is there an API for scylla nodetool?

The Scylla server indeed has a REST API and it's documentation is at the URL you point to. You can find a Swagger UI when you start the Scylla server as well: https://docs.scylladb.com/operating-scylla/rest/.

But, please note that nodetool, for example, does not use the API directly. Instead, it talks to the Scylla JMX proxy, which is a Java process that implements Cassandra-compatible JMX API. You can still use the REST API directly, but you have to figure out the mapping between the JMX operations and the REST API yourself.

For something like nodetool tablestats, the first step is to check what JMX APIs nodetool uses:

https://github.com/scylladb/scylla-tools-java/blob/master/src/java/org/apache/cassandra/tools/nodetool/TableStats.java

The command delegates to TableStatsHolder class:

https://github.com/scylladb/scylla-tools-java/blob/master/src/java/org/apache/cassandra/tools/nodetool/stats/TableStatsHolder.java#L117

which uses the ColumnFamilyStoreMBean JMX API for querying table statistics.

You can find the implementation of the JMX API in the scylla-jmx project by finding the ColumnFamilyStore class (without the MBean suffix):

https://github.com/scylladb/scylla-jmx/blob/master/src/main/java/org/apache/cassandra/db/ColumnFamilyStore.java

From that class, you can see that, for example, the ColumnFamilyStore.getSSTableCountPerLevel() method delegates to the column_family/sstables/per_level/<table name> REST API URL.


hmm, fwiw I have a reimplementation of nodetool by using direct access to API here: https://github.com/scylladb/scylla-tools-java/pull/121

it works, but code wise I will do some refactorings to avoid duplication, otherwise it's completely usable nodetool over REST API (which skips JMX for "tablestats")

hth L

Tags:

Scylla