Skip to content

Instantly share code, notes, and snippets.

@btedev
Created February 15, 2012 14:24
Show Gist options
  • Save btedev/1836088 to your computer and use it in GitHub Desktop.
Save btedev/1836088 to your computer and use it in GitHub Desktop.
Efficient file copying using pigz and nc
From Tumblr slidedeck "Massively Sharded MySQL" (http://assets.en.oreilly.com/1/event/74/Massively%20Sharded%20MySQL%20at%20Tumblr%20Presentation.pdf):
Our shard-split process relies on creating new slaves quickly, which involves copying around very large data sets.
For compression we use pigz (parallel gzip), but there are other alternatives.
On destination box:
$ nc -l [port] | pigz -d | tar xvf -
On source box:
$ tar vc . | pigz | nc [destination hostname] [port]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment