Merge multiple InfluxDB 1.8 dbs + add tag with name of each?

Hi all.

I have multiple InfluxDB 1.8 databases with same schema.

I need to merge them into a single database
& add tags with names of the original databases the data came from.

How to achieve that for all data?

~ 20 databases
total size: ~ 200Gb
No retention.


@vainkop This certainly isn’t ideal, but you could:

  1. Export all each database as line protocol:

    influx_inspect export \
      -database db-name \
      -lponly \
      -out path/to/dbname.lp
  2. Use Telegraf to read in the exported file and add a tag. I’d use environment variables in the telegraf configuration file to populate the database name. For example:


      db = "${DBNAME}"
      files = ["path/to/${DBNAME}.lp"]
      data_format = "influx"
      urls = [""]
      database = "new-db-name"

    Then just set the DBNAME environment variable and start Telegraf.

    > export DBNAME=example-db-name
    > telegraf -c path/to/telegraf.conf
  3. Rinse and repeat.

Like I said, it’s not ideal, but it should work.