As noted in the Introduction to Apache Cassandra API for Azure Cosmos DB, you can connect to the Cosmos DB Cassandra API using cqlsh
. The instructions included in the Quick Start are setup for Windows (not MacOS) and there may be a versioning issue as the default cassandra-driver (installed via pip install cassandra-driver
is for 3.3.1 instead of 3.4 (which is what is needed for Cosmos DB Cassandra API).
This will ensure that you have the latest Cassandra-driver for CQL 3.4:
brew install cassandra
Cassandra will be installed in the /usr/local/Cellar/cassandra/$version
folder
From the bash terminal, run the commands below from the /usr/local/Cellar/cassandra/$version
folder:
export SSL_VERSION=TLSv1_2
export SSL_VALIDATE=false
./cqlsh.py $server.cassandra.cosmosdb.azure.com 10350 -u $servername -p $masterkey --ssl
The output should look like:
$ export SSL_VERSION=TLSv1_2
$ export SSL_VALIDATE=false
$ ./cqlsh.py $servername.cassandra.cosmosdb.azure.com 10350 -u $username -p $masterkey --ssl
Connected to Prod at $server.cassandra.cosmosdb.azure.com:10350.
[cqlsh 5.0.1 | Cassandra 3.11.0 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
$servername@cqlsh>
Don't forget that you can get the Cassandra API connection string information from the Azure Portal > Cosmos DB Cassandra API account > Quick Start.
Enjoy!
Currently running into issues on MacOS where we get the error message below:
TLSv1_2 is not a valid SSL protocol, please use one of SSLv23, TLSv1, TLSv1.1, or TLSv1.2
This is because the openssl package version needs to be 1.0.2 or greater; lower versions dont support TLSv1.2.
Sopme potential soutions include:
- Ensure you are on Python 2.7.9 or higher as the Python libraries were updated to support TLS V1.2 after that.
- It appears if you're on MacOS High Sierra, the openssl version is
Libre 2.2.7
and this works fine. - MacOS Sierra by default has openssl version 0.9.8 which appears to not work
- Using Homebrew to install openssl may work, but need to follow the instructions per How to upgrade OpenSSL (macos).