Is there an API for nodetool
? Especially nodetool tablestats
I saw there is https://github.com/scylladb/scylla/tree/master/api/api-doc. Is this the right place to look for APIs?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With