Cassandra

Cassandra is an eventually consistent key value store similar to HBase and Google`s Bigtable. It implements a distributed hash map with column families originally it supported a Thrift based API very close to HBase`s. Lately Cassandra has moved towards a SQL like query language with much more flexibility around data types, joints and filters. Thankfully the Thrift interface is still there so it`s easy to convert the OpenTSDB HBase schema and calls to Cassandra at a low level through the AsyncHBase HBaseClient API. AsyncCassandra is a shim between OpenTSDB and Cassandra for trying out TSDB with an alternate backend.

Setup

  1. Setup a Cassandra cluster using the ByteOrderedPartitioner. This is critical as we require the row keys to be sorted. Because this setting affects the entire node, you may need to setup a cluster dedicated to OpenTSDB.

  2. Create the proper keyspsaces and column families by using the cassandra-cli script:

create keyspace tsdb;
use tsdb;
create column family t with comparator = BytesType;

create keyspace tsdbuid;
use tsdbuid;
create column family id with comparator = BytesType;
create column family name with comparator = BytesType;
  1. Build TSDB by executing sh build-cassandra.sh (or if you prefer Maven, sh build-cassandra.sh pom.xml)

  2. Modify your opentsdb.conf file with the asynccassandra.seeds parameter, e.g. asynccassandra.seeds=127.0.0.1:9160.

  3. In the config file, set tsd.storage.hbase.uid_table=tsdbuid

  4. Run the tsd via build/tsdb tsd –config=<path>/opentsdb.conf

If you intend to use meta data or tree features, repeat the keyspace creation with the proper table name.

Configuration

The following is a table with required and optional parameters to run OpenTSDB with Cassandra. These are in addition to the standard TSD configuration parameters from TSDB Configuration

Property

Type

Required

Description

Default

asynccassandra.seeds

String

Required

The list of nodes in your Cassandra cluster. These can be formatted <hostname>:<port>

asynccassandra.port

Integer

Optional

An optional port to use for all nodes if not configured in the seeds setting.

9160