InfluxDB support #450

Open
opened 2021-09-09 16:40:07 +00:00 by modem7 · 10 comments

What I'm trying to do and why

Backup InfluxDB databases

Other notes / implementation ideas

Heya, would it be possible in future to maybe support InfluxDB as one of the databases supported for backup?

Environment

Docker, latest borgmatic version

#### What I'm trying to do and why Backup InfluxDB databases #### Other notes / implementation ideas Heya, would it be possible in future to maybe support InfluxDB as one of the databases supported for backup? #### Environment Docker, latest borgmatic version
Owner

That would be cool! I haven't used InfluxDB though. Looks like influxd backup and influxd restore might be the way to do dump/restore from the command-line? Or maybe influx_inspect and influx -import?

That would be cool! I haven't used InfluxDB though. Looks like `influxd backup` and `influxd restore` might be the way to do dump/restore from the command-line? Or maybe `influx_inspect` and `influx -import`?
Owner

I will also mention that you can use the borgmatic hooks feature to do dumps and restores "manually" even for databases that borgmatic doesn't support natively.

I will also mention that you can use the borgmatic hooks feature to do dumps and restores "manually" even for databases that borgmatic doesn't support natively.
Author

Yupper!

My crappy script so far is as follows:

#Backup Varken Database
docker exec GrafanaDB influxd backup -since 2021-01-01T00:00:00Z -database varken /dbbackup/varken.bak
#Backup Telegraf Database
docker exec GrafanaDB influxd backup -since 2021-01-01T00:00:00Z -database telegraf /dbbackup/telegraf.bak

The "since" is something I'm still playing with.

The other option for a full backup is the "-portable" switch.

docker exec GrafanaDB influxd backup -portable /dbbackup/influxdb

This backs up all of the databases.

Yupper! My crappy script so far is as follows: ```bash #Backup Varken Database docker exec GrafanaDB influxd backup -since 2021-01-01T00:00:00Z -database varken /dbbackup/varken.bak #Backup Telegraf Database docker exec GrafanaDB influxd backup -since 2021-01-01T00:00:00Z -database telegraf /dbbackup/telegraf.bak ``` The "since" is something I'm still playing with. The other option for a full backup is the "-portable" switch. ```bash docker exec GrafanaDB influxd backup -portable /dbbackup/influxdb ``` This backs up all of the databases.
Contributor

For what it's worth I use hooks for backing up my influxdb databases.

hooks:
    # List of one or more shell commands or scripts to execute before creating a
    # backup, run once per configuration file.
    before_backup:
        - influxd backup -portable /root/influx-backup

    # List of one or more shell commands or scripts to execute after creating a
    # backup, run once per configuration file.
    after_backup:
        - rm -rf /root/influx-backup
For what it's worth I use hooks for backing up my influxdb databases. ```yaml hooks: # List of one or more shell commands or scripts to execute before creating a # backup, run once per configuration file. before_backup: - influxd backup -portable /root/influx-backup # List of one or more shell commands or scripts to execute after creating a # backup, run once per configuration file. after_backup: - rm -rf /root/influx-backup ```
Author

@s1shed - you've given me a great idea.

hooks:
    before_backup:
        - echo "Starting a backup job."
        - docker exec GrafanaDB influxd backup -portable /dbbackup/Influx.bak
        - exec /borgscripts/docker-stop.sh
    after_backup:
        - rm -rf /mnt/ramdrive/GrafanaInflux/*
        - exec /borgscripts/docker-start.sh
        - echo "Backup created."
    on_error:
        - echo "Error while creating a backup."
        - exec /borgscripts/docker-start.sh
    mysql_databases:
        - name: db
        - hostname: db
        - port: 3306
        - username: username
        - password: password

I've forked a version of b3vis's Borgmatic and included docker-cli in it so I can run Docker commands.

I've done some internal tests, and all seems good, but we'll see what happens tonight!

Thank you for the idea!

@s1shed - you've given me a great idea. ```yaml hooks: before_backup: - echo "Starting a backup job." - docker exec GrafanaDB influxd backup -portable /dbbackup/Influx.bak - exec /borgscripts/docker-stop.sh after_backup: - rm -rf /mnt/ramdrive/GrafanaInflux/* - exec /borgscripts/docker-start.sh - echo "Backup created." on_error: - echo "Error while creating a backup." - exec /borgscripts/docker-start.sh mysql_databases: - name: db - hostname: db - port: 3306 - username: username - password: password ``` I've [forked](https://hub.docker.com/repository/docker/modem7/borgmatic-docker) a version of b3vis's Borgmatic and included docker-cli in it so I can run Docker commands. I've done some internal tests, and all seems good, but we'll see what happens tonight! Thank you for the idea!
witten added the good first issue label 2023-02-04 17:44:16 +00:00
witten added the new feature area label 2023-06-28 18:42:26 +00:00
Owner
Some movement on this! https://github.com/borgmatic-collective/borgmatic/pull/88
Contributor

I would like to work on this issue. What remains to be implemented and what should I do as I can see a PR already for this issue??

I would like to work on this issue. What remains to be implemented and what should I do as I can see a PR already for this issue??
Owner

You might check in with KiaraGrouwstra on the PR to see if they plan on continuing it. If not, then you can either pick up where they left off on a new PR or start anew (potentially with that PR for inspiration). And please let me know if you have any questions along the way!

You might check in with KiaraGrouwstra on [the PR](https://github.com/borgmatic-collective/borgmatic/pull/88) to see if they plan on continuing it. If not, then you can either pick up where they left off on a new PR or start anew (potentially with that PR for inspiration). And please let me know if you have any questions along the way!
Contributor

@witten I checked with KiaraGrouwstra, and she has given me permission to take over this issue/PR. Her last update mentioned that the next step was running the tests, so I'll start from there because as far as I can see, she has made all changes asked by you in her code.

@witten I checked with KiaraGrouwstra, and she has given me permission to take over this issue/PR. Her last update mentioned that the next step was running the tests, so I'll start from there because as far as I can see, she has made all changes asked by you in her code.
Owner

Great, thanks for checking. I haven't reviewed the most recent version of the code, but if it looks like a good starting place for you, then by all means use it!

Great, thanks for checking. I haven't reviewed the most recent version of the code, but if it looks like a good starting place for you, then by all means use it!
Sign in to join this conversation.
4 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#450