Skip to content

Using influxDB

Gwendal Daniel edited this page Feb 7, 2022 · 9 revisions

Xatkit can make use of an influx 2.x database instead of the internal mapDB one. This page details how to use it.

Requirements

If you want to use the docker image for influxDB 2.0+ go to: setup influx for the Xatkit environment (Docker version)

Setup the influxdb for the Xatkit environment

Run influx setup to create a primary organization and bucket.

If you already have an influxdb instance, consider creating a different bucket/organization for your bots with

influx org create

and

influx bucket create

run influx with influxd --http-bind-address=:XXXX

More info: https://v2.docs.influxdata.com/v2.0/reference/cli/influx/bucket/ and https://v2.docs.influxdata.com/v2.0/reference/cli/influx/org/, also, worth reading: https://v2.docs.influxdata.com/v2.0/reference/cli/influx/

Finding your token:

You can find your token following the steps here

Set up influxDB for the Xatkit environment (Docker version)

Pull the Docker image with InfluxDB 2.0+: docker pull quay.io/influxdb/influxdb:2.0.0-beta

Make it run:

docker run -p 8086:9999 \
-v influxdb:/var/lib/influxdb \
-d quay.io/influxdb/influxdb:2.0.0-beta 

InfluxDB should be available at http://localhost:8086

Xatkit database options

Add the following dependency to your pom.xml

<dependency>
    <groupId>com.xatkit</groupId>
    <artifactId>xatkit-logs-influx</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</dependency>

In order to make the bot work with influxDB you will need to set up ALL of the following options.

OPTION DEFINITION
xatkit.logs.database com.xatkit.core.recognition.RecognitionMonitorInflux
xatkit.influx.token token that connects to the bucket
xatkit.influx.bucket influxDB bucket that we want to populate with our bot's data
xatkit.influx.organization influxDB defined organization where the bucket belongs
xatkit.influx.url Where to find the influxDB database. Default: http://localhost:9999
xatkit.influx.bot_id ID of the bot inside the current bucket. Default: xatkitBot

Note: By using influxDB, data WON'T be stored in the internal mapDB instance, which means the bot becomes dependant on the influxDB availability to write/store data

TL;DR

Clone this wiki locally