![미디어 플레이어 문제를 일으키는 원격 서버와의 rsync](https://rvso.com/image/1345306/%EB%AF%B8%EB%94%94%EC%96%B4%20%ED%94%8C%EB%A0%88%EC%9D%B4%EC%96%B4%20%EB%AC%B8%EC%A0%9C%EB%A5%BC%20%EC%9D%BC%EC%9C%BC%ED%82%A4%EB%8A%94%20%EC%9B%90%EA%B2%A9%20%EC%84%9C%EB%B2%84%EC%99%80%EC%9D%98%20rsync.png)
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가 예를 들어 멋진 6GB 파일을 발견하고 당시 미디어를 스트리밍하고 있다면 재생이 버퍼링되고 점프하게 됩니다.
이 스크립트를 원격 서버로 이동하고 데이터를 가져오는 대신 데이터를 내보내면 도움이 될까요? 아니면 아무런 차이가 없나요?
다른 제안은 없나요?
답변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).