Database Dumps are not working #578

Closed
opened 2022-09-01 11:06:51 +00:00 by Bleala · 3 comments

Hello there!

I'm trying to do database dumps with borgmatic, but it is not working as expected.

This would be my database hook:

  mysql_databases:
    - name: database
      hostname: 192.xxx.xxx.xxx
      port: 3306
      username: borgmatic
      password: mypassword

This is the log (--verbosity 2) and as you can it stops at Processing files...

ssh://borgmatic@192.xxx.xxx.xxx/myborgrepo: Creating archive
ssh://borgmatic@192.xxx.xxx.xxx/myborgrepo: Calling mysql_databases hook function remove_database_dumps
ssh://borgmatic@192.xxx.xxx.xxx/myborgrepo: Removing MySQL database dumps
ssh://borgmatic@192.xxx.xxx.xxx/myborgrepo: Calling mysql_databases hook function dump_databases
ssh://borgmatic@192.xxx.xxx.xxx/myborgrepo: Dumping MySQL databases
ssh://borgmatic@192.xxx.xxx.xxx/myborgrepo: Dumping MySQL database mydatabase to /root/.borgmatic/mysql_databases/192.xxx.xxx.xxx/mydatabase
mysqldump --add-drop-database --host 192.xxx.xxx.xxx --port 3306 --protocol tcp --user borgmatic --databases mydatabase > /root/.borgmatic/mysql_databases/192.xxx.xxx.xxx/mydatabase
borg create --compression lz4 --one-file-system --read-special --remote-path /usr/local/bin/borg --stats --debug --show-rc ssh://borgmatic@192.xxx.xxx.xxx/myborgrepo::databases-{now:%Y-%m-%dT%H:%M:%S.%f} /root/.borgmatic
using builtin fallback logging configuration
33 self tests completed in 0.20 seconds
SSH command line: ['ssh', '-i', '/root/.ssh/id_ed25519', 'borgmatic@192.xxx.xxx.xxx', '/usr/local/bin/borg', 'serve', '--debug']
Remote: using builtin fallback logging configuration
Remote: 33 self tests completed in 0.19 seconds
Remote: using builtin fallback logging configuration
Remote: Initialized logging system for JSON-based protocol
Remote: Resolving repository path b'/myborgrepo'
Remote: Resolved repository path to '/myborgrepo'
Remote: Verified integrity of /myborgrepo/index.5
TAM-verified manifest
security: read previous location 'ssh://borgmatic@192.xxx.xxx.xxx/myborgrepo'
security: read manifest timestamp '2022-09-01T10:43:22.335281'
security: determined newest manifest timestamp as 2022-09-01T10:43:22.335281
security: repository checks ok, allowing access
Creating archive at "ssh://borgmatic@192.xxx.xxx.xxx/myborgrepo::databases-2022-09-01T10:43:54.590869"
Verified integrity of /root/.cache/borg/3a40c4a197b4f5d95ba9cdaaa709f4879a27168dc8329d854d78b1c97f4c88c9/chunks
Reading files cache ...
security: read previous location 'ssh://borgmatic@192.xxx.xxx.xxx/myborgrepo'
security: read manifest timestamp '2022-09-01T10:43:22.335281'
security: determined newest manifest timestamp as 2022-09-01T10:43:22.335281
security: repository checks ok, allowing access
Processing files ...

When i cancel the process (Ctrl+c) I'm getting the following error:

  File "/usr/local/bin/borgmatic", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/borgmatic/commands/borgmatic.py", line 1037, in main
    summary_logs = parse_logs + list(collect_configuration_run_summary_logs(configs, arguments))
  File "/usr/local/lib/python3.10/site-packages/borgmatic/commands/borgmatic.py", line 930, in collect_configuration_run_summary_logs
    results = list(run_configuration(config_filename, config, arguments))
  File "/usr/local/lib/python3.10/site-packages/borgmatic/commands/borgmatic.py", line 117, in run_configuration
    yield from run_actions(
  File "/usr/local/lib/python3.10/site-packages/borgmatic/commands/borgmatic.py", line 380, in run_actions
    json_output = borg_create.create_archive(
  File "/usr/local/lib/python3.10/site-packages/borgmatic/borg/create.py", line 322, in create_archive
    return execute_command_with_processes(
  File "/usr/local/lib/python3.10/site-packages/borgmatic/execute.py", line 275, in execute_command_with_processes
    captured_outputs = log_outputs(
  File "/usr/local/lib/python3.10/site-packages/borgmatic/execute.py", line 95, in log_outputs
    line = ready_buffer.readline().rstrip().decode()
KeyboardInterrupt

Same issue with Postgres databases!

Does anyone has an idea why this is not working?

Environment

borgmatic version: 1.7.1

borgmatic installation method: Official Docker Container

Borg version: 1.2.2

Python version: 3.10.6

Database version (if applicable): MariaDB 10.8.3

operating system and version: Docker Contanier

Hello there! I'm trying to do database dumps with borgmatic, but it is not working as expected. This would be my database hook: ``` mysql_databases: - name: database hostname: 192.xxx.xxx.xxx port: 3306 username: borgmatic password: mypassword ``` This is the log (--verbosity 2) and as you can it stops at `Processing files...` ``` ssh://borgmatic@192.xxx.xxx.xxx/myborgrepo: Creating archive ssh://borgmatic@192.xxx.xxx.xxx/myborgrepo: Calling mysql_databases hook function remove_database_dumps ssh://borgmatic@192.xxx.xxx.xxx/myborgrepo: Removing MySQL database dumps ssh://borgmatic@192.xxx.xxx.xxx/myborgrepo: Calling mysql_databases hook function dump_databases ssh://borgmatic@192.xxx.xxx.xxx/myborgrepo: Dumping MySQL databases ssh://borgmatic@192.xxx.xxx.xxx/myborgrepo: Dumping MySQL database mydatabase to /root/.borgmatic/mysql_databases/192.xxx.xxx.xxx/mydatabase mysqldump --add-drop-database --host 192.xxx.xxx.xxx --port 3306 --protocol tcp --user borgmatic --databases mydatabase > /root/.borgmatic/mysql_databases/192.xxx.xxx.xxx/mydatabase borg create --compression lz4 --one-file-system --read-special --remote-path /usr/local/bin/borg --stats --debug --show-rc ssh://borgmatic@192.xxx.xxx.xxx/myborgrepo::databases-{now:%Y-%m-%dT%H:%M:%S.%f} /root/.borgmatic using builtin fallback logging configuration 33 self tests completed in 0.20 seconds SSH command line: ['ssh', '-i', '/root/.ssh/id_ed25519', 'borgmatic@192.xxx.xxx.xxx', '/usr/local/bin/borg', 'serve', '--debug'] Remote: using builtin fallback logging configuration Remote: 33 self tests completed in 0.19 seconds Remote: using builtin fallback logging configuration Remote: Initialized logging system for JSON-based protocol Remote: Resolving repository path b'/myborgrepo' Remote: Resolved repository path to '/myborgrepo' Remote: Verified integrity of /myborgrepo/index.5 TAM-verified manifest security: read previous location 'ssh://borgmatic@192.xxx.xxx.xxx/myborgrepo' security: read manifest timestamp '2022-09-01T10:43:22.335281' security: determined newest manifest timestamp as 2022-09-01T10:43:22.335281 security: repository checks ok, allowing access Creating archive at "ssh://borgmatic@192.xxx.xxx.xxx/myborgrepo::databases-2022-09-01T10:43:54.590869" Verified integrity of /root/.cache/borg/3a40c4a197b4f5d95ba9cdaaa709f4879a27168dc8329d854d78b1c97f4c88c9/chunks Reading files cache ... security: read previous location 'ssh://borgmatic@192.xxx.xxx.xxx/myborgrepo' security: read manifest timestamp '2022-09-01T10:43:22.335281' security: determined newest manifest timestamp as 2022-09-01T10:43:22.335281 security: repository checks ok, allowing access Processing files ... ``` When i cancel the process (Ctrl+c) I'm getting the following error: ``` File "/usr/local/bin/borgmatic", line 8, in <module> sys.exit(main()) File "/usr/local/lib/python3.10/site-packages/borgmatic/commands/borgmatic.py", line 1037, in main summary_logs = parse_logs + list(collect_configuration_run_summary_logs(configs, arguments)) File "/usr/local/lib/python3.10/site-packages/borgmatic/commands/borgmatic.py", line 930, in collect_configuration_run_summary_logs results = list(run_configuration(config_filename, config, arguments)) File "/usr/local/lib/python3.10/site-packages/borgmatic/commands/borgmatic.py", line 117, in run_configuration yield from run_actions( File "/usr/local/lib/python3.10/site-packages/borgmatic/commands/borgmatic.py", line 380, in run_actions json_output = borg_create.create_archive( File "/usr/local/lib/python3.10/site-packages/borgmatic/borg/create.py", line 322, in create_archive return execute_command_with_processes( File "/usr/local/lib/python3.10/site-packages/borgmatic/execute.py", line 275, in execute_command_with_processes captured_outputs = log_outputs( File "/usr/local/lib/python3.10/site-packages/borgmatic/execute.py", line 95, in log_outputs line = ready_buffer.readline().rstrip().decode() KeyboardInterrupt ``` Same issue with Postgres databases! Does anyone has an idea why this is not working? #### Environment **borgmatic version:** 1.7.1 **borgmatic installation method:** Official Docker Container **Borg version:** 1.2.2 **Python version:** 3.10.6 **Database version (if applicable):** MariaDB 10.8.3 **operating system and version:** Docker Contanier
Owner

Thanks for taking the time to file this! It looks like Borg is hanging on reading special files (e.g., stale named pipes) due to the --read-special parameter, which borgmatic uses so database dumps can stream directly to Borg without hitting disk. Given that the only files you appear to be backing up here are database dumps, I'm guessing the problem is in the ~/.borgmatic directory where the dumps get streamed. So my recommendation is to delete the whole ~/.borgmatic directory and then try the backup again. Generally you shouldn't have to do that as borgmatic cleans up after itself, but there may be a few edge cases where this doesn't work properly.

Let me know what you find out!

Thanks for taking the time to file this! It *looks* like Borg is hanging on reading special files (e.g., stale named pipes) due to the `--read-special` parameter, which borgmatic uses so database dumps can stream directly to Borg without hitting disk. Given that the only files you appear to be backing up here are database dumps, I'm guessing the problem is in the `~/.borgmatic` directory where the dumps get streamed. So my recommendation is to delete the whole `~/.borgmatic` directory and then try the backup again. Generally you *shouldn't* have to do that as borgmatic cleans up after itself, but there may be a few [edge cases](https://projects.torsion.org/borgmatic-collective/borgmatic/issues/360) where this doesn't work properly. Let me know what you find out!
witten added the
question / support
label 2022-09-01 15:32:01 +00:00
Author

@witten Thanks that worked!

Yeah I was only backing up database dumps with this config.
Do I have to worry about this again, after deleting the ~/.borgmatic directory, or is there another way to control this behaviour?

@witten Thanks that worked! Yeah I was only backing up database dumps with this config. Do I have to worry about this again, after deleting the `~/.borgmatic` directory, or is there another way to control this behaviour?
Owner

Glad to hear it worked! You generally shouldn't have to delete ~/.borgmatic, as borgmatic cleans up after itself except in a few edge cases. Those edge cases should be covered by #360.

Glad to hear it worked! You generally shouldn't have to delete `~/.borgmatic`, as borgmatic cleans up after itself except in a few edge cases. Those edge cases should be covered by #360.
Sign in to join this conversation.
No Milestone
No Assignees
2 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#578
No description provided.