rsync 内存占用_避免rsync占用所有带宽

rsync 内存占用

rsync 内存占用

If you use the rsync utility to keep your backups synchronized from your database server over to your backup or secondary file server, you might want to prevent the script from using too much bandwidth. Here’s how.

如果使用rsync实用程序将备份从数据库服务器同步到备份或辅助文件服务器,则可能要防止脚本使用过多带宽。 这是如何做。

The point of limiting bandwidth is to make sure your backup scripts don’t clog up the network connection between your web server and database server. 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.

限制带宽的目的是确保您的备份脚本不会阻塞Web服务器和数据库服务器之间的网络连接。 自然地,限制备份所使用的带宽量将使备份的执行速度变得更慢,但是如果您能够解决问题,这就是做到这一点的方法。

Normally your rsync command will look something like this:

通常,您的rsync命令将如下所示:

rsync -a /backup/folder user@host:/remote/backup/folder/

rsync -a / backup / folder user @ host:/远程/备份/文件夹/

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

您要做的是将--bwlimit参数与KB / second值一起使用,如下所示:

rsync --bwlimit=<kb/second> <source> <dest>

rsync --bwlimit=<kb/second> <source> <dest>

So if you wanted to limit transfer to around 5MB per second, you could use a command like this:

因此,如果要将传输速度限制为每秒5MB,可以使用以下命令:

rsync --bwlimit=5000 /backup/folder user@host:/remote/backup/folder/

rsync --bwlimit=5000 /backup/folder user@host:/remote/backup/folder/

You’ll want to make sure to calculate the size of your backups, and figure out how long it’ll take to transfer them at a slower rate – it wouldn’t be very helpful if your backup script takes 12 hours to run, for example.

您需要确保计算备份的大小,并弄清楚以较低的速度传输备份需要花费多长时间–如果备份脚本需要花费12个小时来运行,这并不会很有帮助。例。

You can also use the ionice command to limit the amount of bandwidth your script uses, which will help keep your scripts from using too much disk I/O. It’s not quite as useful since you can’t set absolute numbers like you can with the bwlimit parameter, but it’s another thing you can consider.

您还可以使用ionice命令限制脚本使用的带宽量,这将有助于防止脚本使用过多的磁盘I / O。 它并不是很有用,因为您无法像使用bwlimit参数那样设置绝对数,但这是您可以考虑的另一件事。

翻译自: https://www.howtogeek.com/50794/keep-rsync-from-using-all-your-bandwidth/

rsync 内存占用

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值