Rsync linux ограничение скорости

How to limit rsync speed and bandwidth usage using –bwlimit

rsync command is a fantastic tool to transfer data over hosts, however by default it uses all your available bandwidth and generates extra I/O. Recently one of my customers was streaming online radio and at the same time he was transfering some big files to an external server. He didn’t knew how to limit rsync speed and came to me seeking for help.

How can I avoid rsync from using all my bandwidth on Linux? How can I set a limit for rsync speed?

Today we will answer this questions related to rsync bwlimit.

Rsync speed can be limited to what ever you need, you just need to use a simple parameter callted ‘rsync bwlimit’ before the rest of the rsync options. Let’s see some examples.

You can easily limit I/O bandwidth using rsync –bwlimit option.

The rsync speed limit syntax is as you see below:

rsync --bwlimit=KBPS source destiny rsync --bwlimit=KBPS [other options] source destiny

This will set a 5000KBytes limit per second for all files transfered using rsync.

Control your rsync speed limit using Nload

You can check the rsync bandwidth limit consumed in real time by using an utility like nload, which allows you to see bandwidth usage from the terminal, example:

Читайте также:  Linux команда перемещения папки

On CentOS/RHEL you can install nload by using:

That’s all, at this point you should know how to limit rsync speed using rsync bwlimit parameter, and have a full real time control of your bandwidth using nload command.

How to limit rsync speed and bandwidth usage using –bwlimit was last modified: July 5th, 2017 by Esteban Borges

About the Author: Esteban Borges

Experienced Sr. Linux SysAdmin and Web Technologist, passionate about building tools, automating processes, fixing server issues, troubleshooting, securing and optimizing high traffic websites.

Источник

How to Limit/throttle rsync transfer speed in Linux

If you use the rsync utility to keep your backups synchronized between your servers or with a local machine, you might want to prevent the script from using too much bandwidth. However, rsync makes a lot of network I/O. The point of limiting bandwidth is to make sure your backup scripts don’t clog up the network connection.

Naturally, limiting the amount of bandwidth your backups are using is going to make them happen more slowly, but if you can deal with that, this is the way to do it.

Here is a normal rsync command:

$ rsync –avz -e 'ssh' /path/to/source user@remotehost:/path/to/dest/

What you’ll want to do is use the –bwlimit parameter with a KB/second value, like this:

$ rsync –bwlimit=[kb/second] –avz -e 'ssh' /path/to/source user@remotehost:/path/to/dest/

So if you wanted to limit transfer to around 10000KB/s (9.7MB/s), enter:

$ rsync –bwlimit=10000 –avz -e 'ssh' /path/to/source user@remotehost:/path/to/dest/

Here is a real world example:

rsync –bwlimit=10000 –avz -e 'ssh' /backup/ root@192.168.0.51:/backup/

Here, rsync will be throttled to a bandwidth of 10000kb/second or 9.7MB/s approximately.

Читайте также:  Linux tar все файлы

Using trickle

There is an alternative to the -bwlimit option. You can also use the “trickle” command to limit the bandwidth of any application you run. The syntax of trickle command is:

$ trickle -u|-d [uploadLimit|downloadLimit] [app]

Here,
-u uploadLimit -> limits the upload bandwidth
-d downloadLimit -> limits the download bandwidth
app -> is the application you want to limit bandwidth for e.g. rsync.

So in our case, we will limit the rsync command bandwidth usage to 0000kb/second using the below commands:

$ trickle -s -u 10000 -d 10000 rsync –avz -e 'ssh' /backup/ root@192.168.0.51:/backup/

Источник

Оцените статью
Adblock
detector