0

I am neither a DB administrator, nor a DevOps but I need to migrate a very large table (~500M rows) from one MySQL schema to another. For doing so, I use mysqldumpbackup tool. Also, since the DB is an AWS DB, I establish an SSH connection to the Ubuntu server from terminal and then run the command from command line.

Everything works as needed and I can see the process being output on my terminal, but once my computer sleeps or I have an internet connection interruption, I am facing a problem: client_loop: send disconnect: Broken pipe.

That's probably ok, but after reconnection to the Ubuntu server I don't see that process output on the terminal, nor I can see the corresponding process in the processes list.

I don't know if that can be, but once my terminal looses the connection with the server mysqldump terminates on the server without completion.

In order to be sure, I would like to know:

  • if that can happen or no?
  • Where mysqldump logs its process so I could take a look at the log file and see what happened?
2

1 Answer 1

0

Yes, when your terminal closes the stdout file descriptor for that process closes as well and it does not have where to write.

First thing which would make me nervous is that you do not store the output to a file, so you are NOT doing any backups. You have to store the backup somewhere.

One way how to do it to redirect the output to a file: mysqldump > backup_file_name.sql - you will see not output on the terminal, but you will see the file growing until the backup is ready.

You can also use programs like screen or tmux for "keeping the term open" for the program. When you connect back, you can re-attach your terminal to that output. But again - do not backup to screen. When you want to see the output while storing it also to a file you can use tee: mysqldump | tee backup_file.sql - it will split the output and write it both to terminal and to file.

Writing to terminal is really slow and you should not do it anyway. If you backup an AWS RDS instance, it is already has some automatic backup and you can trigger manual ones via UI or programatically. If you backup mysql running on your instance and you backup it onto the same instance it is not a very good backup after all. You should then copy that file to s3 or somewhere.

1
  • Actually, I dump directly to a DB, so I don't need to backup to a file and then restore a DB from that file: perhaps, that will be even slower than writing to terminal. But what is written in the terminal is just an info similar to this: Dump progress: 0/1 tables, 281222750/435250801 rows. And when it completes, it is just written that mysqlpump is completed. tee may be useful so thanks a lot.
    – Armine
    Feb 17, 2022 at 0:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.