KairosDB
KairosDB is a Java-based time-series metrics API that leverages Cassandra as its underlying distributed database. This page shows how it can be integrated with YugabyteDB's Cassandra-compatible YCQL API.
1. Start local cluster
Follow Quick start to run a local YugabyteDB cluster and test YugabyteDB's YCQL API to confirm that you have a YCQL service running on localhost:9042
.
2. Download KairosDB
Download KairosDB as stated below. Latest releases are available in releases of the KairosDB repository.
$ wget https://github.com/kairosdb/kairosdb/releases/download/v1.3.0/kairosdb-1.3.0-1.tar.gz
$ tar xvfz tar xvfz kairosdb-1.3.0-1.tar.gz
$ cd kairosdb/
You can follow the Getting started to see how to configure KairosDB in general. For the purpose of integrating with the local YugabyteDB cluster running at localhost:9042
, open conf/kairosdb.properties
and comment out the default in-memory datastore, as follows:
#service.datastore: "org.kairosdb.datastore.h2.H2Module"
Uncomment the following line to make Cassandra the datastore:
service.datastore: "org.kairosdb.datastore.cassandra.CassandraModule"
3. Start KairosDB
$ ./bin/kairosdb.sh run
You should see the following lines if KairosDB starts up successfully.
18:34:01.094 [main] INFO [AbstractConnector.java:338] - Started SelectChannelConnector@0.0.0.0:8080
18:34:01.098 [main] INFO [Main.java:522] - Starting service class org.kairosdb.core.telnet.TelnetServer
18:34:01.144 [main] INFO [Main.java:378] - ------------------------------------------
18:34:01.144 [main] INFO [Main.java:379] - KairosDB service started
18:34:01.145 [main] INFO [Main.java:380] - ------------------------------------------
4. Verify Cassandra integration with ycqlsh
Run ycqlsh
to connect and use YugabyteDB's YCQL API.
Assuming you are using the macOS or Linux binary, execute the following:
$ ./bin/ycqlsh localhost
Connected to local cluster at 127.0.0.1:9042.
[ycqlsh 5.0.1 | Cassandra 3.9-SNAPSHOT | CQL spec 3.4.2 | Native protocol v4]
Use HELP for help.
ycqlsh>
- Run the following YCQL commands to verify it is working:
ycqlsh> describe keyspaces;
kairosdb system_schema system_auth system
ycqlsh> use kairosdb;
ycqlsh:kairosdb> describe tables;
row_keys data_points string_index
row_key_index service_index row_key_time_index
5. Test KairosDB
Push data
Push metric data into KairosDB as per the instructions here.
Query data
Query metric data into KairosDB as per the instructions here.