Project: YugabyteDB (App Definition and Development / Database)
File: kairosdb.md

title: KairosDB linkTitle: KairosDB description: Use KairosDB with YCQL API aliases: menu: preview_integrations: identifier: kairosdb parent: integrations-other weight: 571 type: docs 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. Before you start using the KairosDB plugin, ensure that you have: Java version 1.8 or later. The latest version of . The latest version of ; read the README for details about the plugin. A YugabyteDB cluster. Refer to to install and start a local cluster. . (Optional) YugabyteDB , for better performance. To configure KairosDB, do the following: Copy the YugabyteDB plugin for KairosDB jar to the `lib` folder of your downloaded `kairosdb` directory. Optionally, for better performance, replace the `cassandra-driver-core-3.10.2.jar` with the YugabyteDB `cassandra-driver-core-3.10.3-yb-2.jar` in the `kairosdb/lib` directory. Add YugabyteDB datastore as the `service.datastore` entry in your `kairosdb/conf/kairosdb.conf file`. ```sh service.datastore: "com.yugabyte.kairosdb.datastore.yugabytedb.YugabyteDBModule" ``` To start KairosDB in the foreground, do the following: ```sh $ ./bin/kairosdb.sh run ``` ```output 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] - ``` The KairosDB API server should be available at `localhost:8080`. Run to connect to your database using the YCQL API as follows: ```sh $ ./bin/ycqlsh localhost ``` ```output 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> ``` Connect to the `kairosdb` keyspace to verify it is working as follows: ```cql ycqlsh> describe keyspaces; ``` ```output kairosdb systemschema systemauth system ``` ```cql ycqlsh> use kairosdb; ``` ```cql ycqlsh:kairosdb> describe tables; ``` ```output tagindexedrowkeys rowkeyindex serviceindex rowkeytime_index rowkeys datapoints string_index spec ``` Launch Postman via the app or web and create a new workspace from the homepage. Select the workspace and click the `+` button to create an HTTP request. Select the POST API request in the dropdown as follows: Add the following URL in the `Enter request URL` box: ```text http://localhost:8080/api/v1/datapoints ``` In the body of the request, add the following JSON, then click Send. ```json [ { "name": "archivefiletracked", "datapoints": [[1359788400000, 123], [1359788300000, 13.2], [1359788410000, 23.1]], "tags": { "host": "server1", "data_center": "DC1" }, "ttl": 300.0 }, { "name": "archivefilesearch", "timestamp": 1359786400000, "value": 321, "tags": { "host": "server2" } } ] ``` Your request should look like: Your response should return a status code of 204 with no body. To query the data you , enter the following URL in the `Enter request URL` box: ```text http://localhost:8080/api/v1/datapoints/query ``` In the body of the request, add the following JSON, and send it. ```json { "start_absolute":1359788400000, "metrics":[ { "tags":{ "host":"server1", "data_center":"DC1" }, "name":"archivefiletracked" } ] } ``` Your request should look like: Your response should return a status code of 200, with the following output: ```output.json { "queries": [ { "sample_size": 2, "results": [ { "name": "archivefiletracked", "group_by": [ { "name": "type", "type": "number" } ], "tags": { "data_center": [ "DC1" ], "host": [ "server1" ] }, "values": [ [ 1359788400000, 123 ], [ 1359788410000, 23.1 ] ] } ] } ] } ```