Towards a model for InfluxDB Multi-Tenancy

Docker Fargate Deployment

Recent fargate deployments of InfluxDB are necessarily docker container deployments. The currently deployed version is Influx 2.0.6 as described here. The deployment is done by a CDK project influxdb-v2

Version 2 gives us some extra support for multi-tenant deployments

Model

Multi Tenancy

Version 2 Specifics

  • Database instances are now referred to as buckets. The default name we use for a bucket is signals.

  • Each bucket is attached to an Influx organisation.

  • An influxdb-writer microservice is associated with a particular InfluxDB organisation.

  • The influxdb-writer uses a pre-defined API token that is owned by the organisation and allows write-only access to the bucket.

  • In this way signals from a particular MQTT broker can be written to an influx organisational bucket by a single writer. This creates a mapping between the PIs that are associated with an MQTT broker and an organisation in Influx.

  • Until such time (possibly never) that a change is made to use InfluxDB dashboards rather than Grafana dashboards then a single InfluxDB user is associated with an InfluxDB organisation.

  • The exception to this is that the InfluxDB root user is associated with all organisations for maintenance purposes

  • A Grafana organisation is associated with an InfluxDB organisation through a Grafana DataSource definition. For example the organisations DGOPS_AUTO and DGOPS_CUSTOM would be associated with the dgops organisation in InfluxDB through the credentials supplied to the data source definition. For InfluxDB version 2 these credentials would be an API token that specifically allows read-only access to the named bucket(s) associated with that organisation.

  • Each Grafana organisation has a default data source that maps through to the InfluxDB bucket for the corresponding InfluxDB organisation

  • The dashboard-generators are associated with the Grafana organisation through the Grafana API key that they use to access the Grafana API to create dashboards. They specify a default datasource in the dashboard which is defined for the organisation.

  • Grafana users are attached to organisations which allows access to dashboards and their associated data