SOLR-2099: Add ability to throttle rsync based replication using rsync option --bwlimit

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@992913 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Koji Sekiguchi 2010-09-06 00:29:07 +00:00
parent e7d5b829c7
commit d9226b03c3
2 changed files with 17 additions and 4 deletions

View File

@ -252,6 +252,9 @@ New Features
* SOLR-1665: Add debug component options for timings, results and query info only (gsingers, hossman, yonik)
* SOLR-2099: Add ability to throttle rsync based replication using rsync option --bwlimit.
(Brandon Evans via koji)
Optimizations
----------------------

View File

@ -22,7 +22,7 @@ cd ${0%/*}/..
solr_root=$(pwd)
cd ${orig_dir}
unset data_dir solr_port rsyncd_port user verbose debug
unset data_dir solr_port rsyncd_port user rsyncd_bwlimit verbose debug
. ${solr_root}/bin/scripts-util
# set up variables
@ -31,16 +31,17 @@ log=${solr_root}/logs/rsyncd.log
# define usage string
USAGE="\
usage: $prog [-d dir] [-p portnum] [-u username] [-v] [-V]
usage: $prog [-d dir] [-p portnum] [-u username] [-b kbps] [-v] [-V]
-d specify directory holding index data
-p specify rsyncd port number
-u specify user to sudo to before running script
-b specify a max transfer rate in kilobytes per second (defaults to 0 (no limit))
-v increase verbosity
-V output debugging info
"
# parse args
while getopts d:p:u:vV OPTION
while getopts d:p:u:b:vV OPTION
do
case $OPTION in
d)
@ -52,6 +53,9 @@ do
u)
user="$OPTARG"
;;
b)
rsyncd_bwlimit="$OPTARG"
;;
v)
verbose="v"
;;
@ -82,6 +86,12 @@ then
fi
fi
# Set bwlimit to unlimited by default
if [[ -z ${rsyncd_bwlimit} ]]
then
rsyncd_bwlimit='0'
fi
dataDir
logMessage started by $oldwhoami
@ -119,7 +129,7 @@ log file = ${solr_root}/logs/rsyncd.log
comment = Solr
EOF
rsync --daemon --port=${rsyncd_port} --config=${solr_root}/conf/rsyncd.conf
rsync --daemon --port=${rsyncd_port} --bwlimit=${rsyncd_bwlimit} --config=${solr_root}/conf/rsyncd.conf
# first make sure rsyncd is accepting connections
i=1