Skip to content
Aleks Volochnev edited this page Jun 14, 2022 · 12 revisions

This document explains how to use the datasource to work with the data stored in DataStax Astra, a managed Cassandra as a Service DB.

Prerequisites

At first, you need to have an account at astra.datastax.com and a database instance.

Setting up the Connection

1. SecureConnectBundle

Download SecureConnectBundle using the Connect page of your Astra instance, it's available to download on any Connect using a driver subpage. Unpack it and save the files in the folder accessible to Grafana. Notice the path, you will need them later. If you run Grafana in a docker container, you will need to mount the folder or copy files there with docker cp command.

2. Create a new API Token

Create a new application token at the https://astra.datastax.com/settings/tokens. We recommend using RO User role, in this case, Grafana will have solely read-only access. Store token details as you will need them later.

3. Create a new datasource in your Grafana, using the following details:

  • Host specify the host and cql_port values of the config.json file from the SecureConnectBundle (see p.1). It should look like 1234567890qwerty-eu-central-1.db.astra.datastax.com:29402 IMPORTANT Notice, it has to be the cql_port value, not just port (common mistake)
  • User client ID of the API Token
  • Password client secret of the API Token
  • Certificate Path /path/to/cert (use cert file from SecureConnectBundle)
  • Root Certificate Path /path/to/key (use key file from SecureConnectBundle)
  • RootCA Certificate Path /path/to/ca.crt (use ca.crt file from SecureConnectBundle)

4. Save and Test

Hit save and test button, if you did everything right, you will have a green info notice "Database Connection OK"

If you aren't lucky enough, check grafana logs for more details. At this moment, you are good to go, the datasource is operational and you can use Astra as it would be your local installation.

Known issues:

Misconfigured Port (Using port instead of cql-port)

Sometimes users specify the wrong port and a connection cannot be established. If you can't connect to your Astra instance, please check if the correct port specified in the datasource config (See step 3 above)

Unavailable TLS files

if you have an error message like [ERROR] cassandra-backend-datasource: Unable create tls config, open /cert: permission denied, it means that Grafana cannot open TLS certificate files. Set the proper permission f.e. using chown command. If you copied the files using docker cp command, they'll be copied by a root user and grafana will have no access to them.