Best way to have multiple databases with the same data on InfluxCloud

I want to set up separate production and staging DBs on InfluxCloud which should have approximately the same data (they should be the same in terms of upload, but it’s possible that the retention policies might differ or something like that). What’s the best way of setting this up? Data is currently being uploaded using InfluxDB-Python.

Follow-up question: if at some point I want to sync the staging DB to production, how should I do that?

Hi @roddycx! I think you’ve got a few options here. I don’t know whether all of these work with InfluxCloud, but worth a try:

  1. Probably stating the obvious (and the ugly), but you could double up your write statements in the python script, to push to both databases.
  2. You can set up replication via Telegraf; see here: https://www.influxdata.com/blog/multiple-data-center-replication-influxdb/
  3. The above article also mentions replication via Kapacitor (i.e. via a TICK script), which provides you near-infinite flexibility but may take a bit more effort to set up if you haven’t got it running already.
  4. Another option which could be extremely neat (if it worked) would be to set up a “subscription” from one database to the other: https://docs.influxdata.com/influxdb/v1.7/administration/subscription-management/. However, subscriptions are designed for replicating data from one host to another, and while I’m pretty sure you could just point the writes to localhost, I don’t see a way to modify the DB name - which is necessary here.

Finally, in terms of syncing, you may want to check out https://github.com/toni-moreno/syncflux. I haven’t tried it out myself - and it potentially seems a bit experimental - but would be interesting to know whether it works for you.

Good luck!