Skip to main content

Guide to Installing InfluxDB with Docker

In this guide, we’ll look at how to install InfluxDB with Docker, create an administrator user, and enable authentication

InfluxDB is a well-known time-series database capable of ingesting and collecting millions of metrics, which are useful for network monitoring and for generating performance charts and status reports for hosts and services
. Docker allows us to perform rapid deployments and maintain consistent containerized environments across development, testing, and production, ensuring reliability for customers through our Docker support

Installing InfluxDB

For a quick installation, we used the official InfluxDB container available on Docker Hub; this brief guide is available for the installation. Installing Docker on Debian
To make the configuration and data persistent, we created volumes mounted on the filesystem at /docker/influxdb
We also enabled the reception of metrics exported by Collectd and Graphite by exposing TCP port 8086 and UDP port 25826. It is also necessary to download the types-dbto tag Collectd
metrics. We can download it from the CollectD project’s Git repository: types-db. Using this script, place it in /docker/influxdb/types-db/collectd-types.db

VERSION="latest"
APP="/docker"
INFLUX_ROOT="$APP/influxdb"
INFLUX_DATA="$INFLUX_ROOT/data"
INFLUX_CONF="$INFLUX_ROOT/etc"
INFLUX_TYPESDB="$INFLUX_ROOT/types-db"

# Create directory
mkdir -p $INFLUX_DATA ; mkdir -p $INFLUX_CONF

docker run --name=influxdb \
        --restart=always \
        -p 8086:8086 \
        -p 25826:25826/udp \
        -e INFLUXDB_GRAPHITE_ENABLED=true \
        -v $INFLUX_DATA:/var/lib/influxdb \
        -v $INFLUX_CONF/influxdb.conf:/etc/influxdb/influxdb.conf:ro \
        -v $INFLUX_TYPESDB/collectd-types.db:/usr/share/collectd/types.db:ro \
        influxdb:$VERSION -config /etc/influxdb/influxdb.conf

Creating an Administrator User

At this point, you need to create an account adminby running commands inside the Docker container

docker exec -it influxdb bash
influx

In the database console:

CREATE USER username WITH PASSWORD 'mypassword' WITH ALL ALL PRIVILEGES

Enable Influx authentication

  • Edit /etc/influxdb.conf

    auth-enabled = true
  • Restart InfluxDB

    docker restart influxdb

Test the connection with the administrator user

influx -username 'username' -password mypassword
Achieve Maximum Efficiency with Docker

Rely on our Docker Support and Consulting service to optimize your infrastructure. Customized solutions for your business!

Free 30-minute Docker consultation!

Add new comment

Comment

  • Allowed HTML tags: <br> <p> <code class="language-*"> <pre>
  • Lines and paragraphs break automatically.
  • Only images hosted on this site may be used in <img> tags.