4

I have running the following command for 5 hours and still going. mysql has gigabytes of data, but how can I make sure that the following command is actually transferring data. Can someone check the correctness?

tar -czpf - ./ --exclude mysql mysql-bin* mysql.sock | ssh -lroot xxx.xx.xxx.xx tar -xzpf - -C /var/lib/mysql 
HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
user12145
  • 1,115
  • 6
  • 28
  • 47

2 Answers2

13

You can insert the pv command into your pipeline to get a report of how many bytes have been transferred, like this:

tar -czpf - ./ --exclude mysql mysql-bin* mysql.sock | 
pv |
ssh -lroot xxx.xx.xxx.xx tar -xzpf - -C /var/lib/mysql 

This will give you output like this, including the total number of bytes and the current transfer rate:

 202MB 0:00:13 [  17MB/s] [            <=>                                    ]

You can also just run du -sh on the destination directory.

larsks
  • 43,623
  • 14
  • 121
  • 180
0

If you have a fast network between the two server, you should try without compression (-C).

To limit the use of CPU, you should change the default encryption algorithm used with "-c blowfish" for instance.

(you can also use ifstat or iptraf to check speed of data exchange)

aligot
  • 328
  • 1
  • 7