InfluxDB support #450

Open
opened 2021-09-09 16:40:07 +00:00 by modem7 · 5 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
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#450
No description provided.