In Linux system operation, when you are making a direct copy of the machine, it is a waste of time when encountering large files, especially when copying files to multiple machines at the same time. So, is there any good way to improve the copying efficiency of large files? Let's learn together.
You can copy one by one by one from the source machine to the target machine, but often time is doubled. Or you can copy from the source machine to multiple target machines at the same time, but depending on the bandwidth of the source machine, the speed is not really fast.
Fortunately, with some UNIX tools you can do better. Combine tee and FIFO to form a fast distribution chain of files: each machine in the distribution chain saves the file and distributes it to its next ring.
First, select a target machine as the last link of the distribution chain. On this machine, you only need to use nc to listen (assuming the port is 1234), then decompress it by pipez through the pipeline and continue to pass. The pipeline divides the data into tar to decompose.
nc -l 1234|
Pigz -d |
Tar xvf -
Then, go up from the end of the distribution chain, set up other target machines, and also listen, decompress, and decompose, but before decompression we output the data to the named pipe through the tee command ( FIFO), another shell pipeline will distribute these uncompressed data to the next ring of the distribution chain:
mkfifo myfifo
nc hostname_of_next_box 1234 nc -l 1234|
Tee myfifo |
Pigz -d |
Tar xvf -
Finally, start the distribution chain on the source machine and transfer the data to the first ring of the distribution chain:
tar cv some_files |
Pigz |
Nc hostname_of_first_box 1234
In my tests, each machine in the distribution chain lost about 3%-10% of its performance (as opposed to a one-to-one copy), but relatively one by one. Or a single machine can be distributed to multiple machines at the same time, and the efficiency improvement is obvious.
The above is the introduction of Linux to improve the efficiency of large file copying, mainly through the UNIX tool to form a file fast distribution chain to achieve fast copy of large files, the efficiency has improved a lot.
In Ubuntu system, when reading Windows files, it shows garbled characters, while Wi
In the Linux system, the Glibc-2.7 version is required when installing the software
We all know that most of the Linux operations are done through commands, the average person will cle
The locate command is one of the Linux lookup commands. It can be used to find data. It is similar t
Differences between Linux system MBR and GPT partitions
Ubuntu System Installation Tutorial How to Install Ubuntu System
How Linux can modify the TCP port range
Three ways to configure Java environment variables in Linux
Ubuntu disables the shutdown confirmation box step
How to change the position of the close/maximize/minimize button in the Ubuntu program window
Solution for Lantern tool cannot be started under Linux system
Linux system how to configure multi-path
How to generate reports using Linux using the Sosreport command
What should I do if ORA-12528 reports an error when building DataGuard in Linux?
Win8 can not use the proxy server to access the Internet. Reason
Upgrade Win10 update to 99% blue screen constantly restart solution
Win8 system inserts the disc without a solution
IE7 directly enter the FTP address can not log in how to do
Wireless network is safe without passwords
Under Win8/8.1, extract the install.wim file through the dism command. Step
Win7 system can not close the dial-up connection dialog window how to do