![rsync с удаленным сервером вызывает проблему с медиаплеером](https://rvso.com/image/1345306/rsync%20%D1%81%20%D1%83%D0%B4%D0%B0%D0%BB%D0%B5%D0%BD%D0%BD%D1%8B%D0%BC%20%D1%81%D0%B5%D1%80%D0%B2%D0%B5%D1%80%D0%BE%D0%BC%20%D0%B2%D1%8B%D0%B7%D1%8B%D0%B2%D0%B0%D0%B5%D1%82%20%D0%BF%D1%80%D0%BE%D0%B1%D0%BB%D0%B5%D0%BC%D1%83%20%D1%81%20%D0%BC%D0%B5%D0%B4%D0%B8%D0%B0%D0%BF%D0%BB%D0%B5%D0%B5%D1%80%D0%BE%D0%BC.png)
У меня есть сервер Ubuntu, на котором запущен Serviio в качестве медиасервера DLNA.
По сути, единственное, что делает сервер, это проверяет наличие новых медиа на удаленном сервере. Я запускаю этот скрипт каждую минуту с помощью cron.
#!/bin/bash
DestDir='/home/vince/media'
lockfile='/home/vince/cron/sync.lock'
if [ ! -e $lockfile ]; then
trap "rm -f $lockfile; exit" INT TERM EXIT
touch $lockfile
nice -n 20 ionice -c 3 rsync -axvmP --rsh="ssh -c arcfour" --progress --delete --include='*/' --include='*.mkv' --include='*.mp4' --include='*.avi' --exclude='*' --log-file='/home/vince/log/sync' ***@***:/home/vince/media/ "$DestDir"
rm $lockfile
trap - INT TERM EXIT
[ $? -eq 0 ] && logger 'RSYNC sync completed successfully' || logger 'RSYNC sync Failed'
else
echo "script already running"
fi
Видите ли, я использовал более слабый шифр, Nice и Ionice, но если rsync обнаружит, например, файл Nice размером 6 ГБ, а я в это время транслирую мультимедиа, это приведет к буферизации и скачкам воспроизведения.
Поможет ли мне перенести этот скрипт на удаленный сервер и отправлять данные вместо того, чтобы извлекать их? Или это не имеет значения?
есть еще предложения?
решение1
Если проблема связана с пропускной способностью, то проверьте такие параметры rsync, как:
--bwlimit=KBPS
This option allows you to specify a maximum transfer rate in
kilobytes per second for the data the daemon sends. The client
can still specify a smaller --bwlimit value, but their requested
value will be rounded down if they try to exceed it. See the
client version of this option (above) for some extra details.
В зависимости от причины сбоя, возможно:
-z, --compress
With this option, rsync compresses the file data as it is sent
to the destination machine, which reduces the amount of data
being transmitted â something that is useful over a slow connecâ
tion.
Note that this option typically achieves better compression
ratios than can be achieved by using a compressing remote shell
or a compressing transport because it takes advantage of the
implicit information in the matching data blocks that are not
explicitly sent over the connection.
See the --skip-compress option for the default list of file sufâ
fixes that will not be compressed.
--compress-level=NUM
Explicitly set the compression level to use (see --compress)
instead of letting it default. If NUM is non-zero, the --comâ
press option is implied.
--skip-compress=LIST
Override the list of file suffixes that will not be compressed.
The LIST should be one or more file suffixes (without the dot)
separated by slashes (/).
You may specify an empty string to indicate that no file should
be skipped.
Simple character-class matching is supported: each must consist
of a list of letters inside the square brackets (e.g. no special
classes, such as â[:alpha:]â
The characters asterisk (*) and question-mark (?) have no speâ
cial meaning.
Here's an example that specifies 6 suffixes to skip (since 1 of
the 5 rules matches 2 suffixes):
--skip-compress=gz/jpg/mp[34]/7z/bz2
The default list of suffixes that will not be compressed is this
(several of these are newly added for 3.0.0):
gz/zip/z/rpm/deb/iso/bz2/t[gb]z/7z/mp[34]/mov/avi/ogg/jpg/jpeg
This list will be replaced by your --skip-compress list in all
but one situation: a copy from a daemon rsync will add your
skipped suffixes to its list of non-compressing files (and its
list may be configured to a different default).