InfluxDB: Getting Started

How to quickly set up and manage InfluxDB using best practices

👋 Welcome to the Stackhero documentation

Stackhero offers a fully managed InfluxDB cloud environment, designed for speed and simplicity:

  • Unlimited writes, queries, dashboards, tasks, and buckets.
  • Unlimited data retention: keep your metrics for as long as you need.
  • Unlimited network and disk transfers, with no hidden limits.
  • One-click updates: always benefit from the latest features and fixes.
  • Consistent performance and enhanced security on your own private, dedicated infrastructure.

With Stackhero, you can focus on your data and analytics. Deploying InfluxDB cloud hosting only takes a few minutes, and every setup is optimized for long-term reliability.

InfluxDB does not offer user management directly through its web interface. You can efficiently handle user creation and administration using the InfluxDB CLI.

You can access the InfluxDB CLI via Docker. For example, you can run the following command:

docker run -it influxdb:2.8 /bin/bash

Remember to use the version tag that matches your InfluxDB instance instead of 2.8.

After starting the container, create a configuration. Replace <XXXXXX>.stackhero-network.com with your actual InfluxDB domain:

influx config create \
  --config-name adminConfig \
  --active \
  --username-password admin \
  --org admin \
  --host-url https://<XXXXXX>.stackhero-network.com

Once the configuration is set up, you can use the InfluxDB CLI to manage users. For example, to create a new user:

influx user create --name <user> --password <password>

InfluxDB is optimized for handling large volumes of time series data. Since it does not automatically delete old data, an unmanaged database can quickly fill up available storage. Stackhero helps you avoid this by supporting InfluxDB’s built-in features for efficient data management.

InfluxDB offers two main solutions:

  1. Retention policies: Automatically delete data older than a specified period, such as 365 days. This keeps your storage usage predictable and eliminates the need for manual cleanup.
  2. Downsampling data: Keep high-resolution data for recent periods and aggregate data for older periods. For example:
    • Retain 1-second resolution for the last 5 minutes.
    • Store maximum, minimum, and average values at 1-minute intervals for the past 24 hours.
    • Keep hourly aggregates for older data.

Retention policies allow you to keep relevant historical data without using excessive disk space. For more information on downsampling, refer to the official InfluxDB downsampling documentation.

By default, InfluxDB retains data indefinitely. For most time series use cases, setting a retention period for each bucket ensures you only keep the data you need and prevents uncontrolled storage growth.

To configure retention:

  1. Open the InfluxDB web interface.
  2. Go to "Data" and select "Buckets".
  3. Click "Settings" next to the relevant bucket.
  4. Under "Delete data older than", select your preferred retention period.

Data older than the selected retention period will be permanently deleted.

InfluxDB stores data in shards. Shards containing only expired data are deleted automatically. If a shard contains both expired and current data, it remains until all its data has expired. By default, a shard covers 7 days of data. When you set a new retention policy, up to nearly 7 days of outdated data may remain until the next shard cycle. For more details, see the InfluxDB shard documentation.

You can find practical examples for sending data from Node.js to InfluxDB in this InfluxDB Getting Started repository.