Skip to content

QuestDB container setup

Introduction

QuestDB is a high-performance, open-source SQL database built from scratch in zero-GC Java, dependency-free. It supports the PostgreSQL wire protocol, InfluxDB Line Protocol, and a REST API for queries, bulk imports, and exports. QuestDB serves as an alternative to InfluxDB with a simpler design, avoiding the complexities of the Flux syntax and providing an enjoyable user experience.

For time-series data, QuestDB complements the relational data in MariaDB. Initially, I aimed to save sensor data from my smart meter [[P1 reader - Save Data From Smartmeter2mqtt with n8n to QuestDB|save sensor data]] using n8n with the QuestDB integration, making it an excellent test case for both QuestDB and n8n. Read more about the differences between InfluxDB, TimescaleDB, and QuestDB here.

Setup

  1. Create the folders needed by the container

    Run the following commands inside your home folder:

    # Open your terminal application
    cd ~
    mkdir -p questdb/data
    cd questdb
  2. Create the script needed to run the container

    Save the following script as questdb_run.sh:

    questdb_run.sh
    # To create this script use your text editor application, for example Nano
    docker run -d \
    --name=questdb \
    --hostname=questdb \
    -p 9000:9000 \
    -p 8812:8812 \
    -p 9009:9009 \
    -v $PWD/data:/var/lib/questdb \
    -e QDB_TELEMETRY_ENABLED=false \
    -e TZ="Europe/Amsterdam" \
    --restart unless-stopped \
    questdb/questdb
    # IMPORTANT: Please read the instructions below
    Instructions:
    • Optional Replace docker with podman if needed
    • Required Replace port number 9000 (on the left side of :) with a port number that is available if needed. This is the web console and REST port
    • Optional Replace port number 8812 (on the left side of :) with a port number that is available if needed. This is the PostgreSQL port
    • Optional Replace port number 9009 (on the left side of :) with a port number that is available if needed. This is the InfluxDB Line Protocol port
    • Optional Replace $PWD/data with the location of your data if needed. This can be a fileserver mount
    • Optional Add the setting -e QDB_TELEMETRY_ENABLED=false to disable sending anonymous telemetry data with information about usage
    • Required Replace Europe/Amsterdam with your own timezone. The GENERIC_TIMEZONE setting is used by for example the Cron-Node
  3. Run the script to create the container

    Run the following command:

    # Open your terminal application
    sudo sh questdb_run.sh

    The image questdb/questdb is automatically pulled and the container is created.

  4. Check the results

    If needed you can check if the container is running properly.

    Now you can use the QuestDB Web Console by opening a web browser and going to: http://localhost:9000. Replace localhost with the relevant IP address or FQDN if needed, and adjust the port if you changed it earlier.

Favorites

Comments

    No comments found for this note.

    Join the discussion for this note on Github. Comments appear on this page instantly.

    Copyright 2021- Fiction Becomes Fact