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.
Thanks.
scott
April 19, 2021, 10:38pm
2
@vainkop This certainly isn’t ideal, but you could:
Export all each database as line protocol:
influx_inspect export \
-database db-name \
-lponly \
-out path/to/dbname.lp
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:
telegraf.conf
[global_tags]
db = "${DBNAME}"
[[inputs.file]]
files = ["path/to/${DBNAME}.lp"]
data_format = "influx"
[[outputs.influxdb]]
urls = ["http://127.0.0.1:8086"]
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
Rinse and repeat.
Like I said, it’s not ideal, but it should work.