35

How do you check which cql version is currently being used in cqlsh?

In sql, you do this:

Select @@version
Aaron
  • 55,518
  • 11
  • 116
  • 132
AturSams
  • 7,568
  • 18
  • 64
  • 98

1 Answers1

71

There are a couple of ways to go about this.

From within cqlsh, you can simply show version.

aploetz@cqlsh> show version
[cqlsh 5.0.1 | Cassandra 2.1.8 | CQL spec 3.2.0 | Native protocol v3]

However, that only works from within cqlsh. Fortunately, you can also query system.local for that information as well.

aploetz@cqlsh> SELECT cql_version FROM system.local;

 cql_version
-------------
       3.2.0

(1 rows)

The system.local table has other useful bits of information about your current node, cluster, and Cassandra tool versions as well. For more info, check it out with either SELECT * FROM system.local; (only has 1 row) or desc table system.local.

Aaron
  • 55,518
  • 11
  • 116
  • 132
  • 1
    It works only if cassandra is started or running. There is an error in my case and cassandra is not running. In this case I can't find the cassandra version – Ikrom Sep 12 '18 at 12:28
  • @Ikrom The question was about the `cql_version`, not the Cassandra version. If you want to find the Cassandra version of a node that is not running, you could always do a head -n 1 on CHANGES.txt: `head -n 1 CHANGES.txt` – Aaron Sep 12 '18 at 15:03
  • 2
    Thanks for answer, but I couldn't find CHANGES.txt file and used this command to find cassandra version `/usr/sbin/cassandra -v` – Ikrom Sep 13 '18 at 04:54