git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@518637 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
William Au 2007-03-15 14:22:24 +00:00
parent dc7a3984f1
commit a1b021eb60
6 changed files with 158 additions and 100 deletions

View File

@ -184,6 +184,11 @@ Bug Fixes
8. SOLR-167: The SynonymFilter sometimes generated incorrect offsets when 8. SOLR-167: The SynonymFilter sometimes generated incorrect offsets when
multi token synonyms were mached in the source text. (yonik) multi token synonyms were mached in the source text. (yonik)
9. SOLR-188: bin scripts do not support non-default webapp names. Added "-U"
option to specify a full path to the update url, overriding the
"-h" (hostname), "-p" (port) and "-w" (webapp name) parameters.
(Jeff Rodenburg via billa)
Other Changes Other Changes
1. Updated to Lucene 2.1 1. Updated to Lucene 2.1

View File

@ -22,8 +22,9 @@ orig_dir=$(pwd)
cd ${0%/*}/.. cd ${0%/*}/..
solr_root=$(pwd) solr_root=$(pwd)
cd ${orig_dir} cd ${orig_dir}
curl_url=""
unset solr_hostname solr_port data_dir webapp_name user verbose debug unset solr_hostname solr_port data_dir webapp_name user verbose debug solr_url
. ${solr_root}/bin/scripts-util . ${solr_root}/bin/scripts-util
# set up variables # set up variables
@ -32,18 +33,19 @@ log=${solr_root}/logs/${prog}.log
# define usage string # define usage string
USAGE="\ USAGE="\
usage: $prog [-h hostname] [-p port] [-d dir] [-w webappname] [-u username] [-v] usage: $prog [-h hostname] [-p port] [-d dir] [-w webappname] [-u username] [-U url] [-v] [-V]
-h specify Solr hostname -h specify Solr hostname (defaults to localhost)
-p specify Solr port number -p specify Solr port number
-d specify directory holding index data
-w specify name of Solr webapp (defaults to solr) -w specify name of Solr webapp (defaults to solr)
-u specify user to sudo to before running script -u specify user to sudo to before running script
-U specify full update url (overrides -h,-p,-w parameters)
-d specify directory holding index data
-v increase verbosity -v increase verbosity
-V output debugging info -V output debugging info
" "
# parse args # parse args
while getopts h:p:d:w:u:vV OPTION while getopts h:p:d:w:u:U:vV OPTION
do do
case $OPTION in case $OPTION in
h) h)
@ -61,6 +63,9 @@ do
u) u)
user="$OPTARG" user="$OPTARG"
;; ;;
U)
solr_url="$OPTARG"
;;
v) v)
verbose="v" verbose="v"
;; ;;
@ -75,13 +80,6 @@ done
[[ -n $debug ]] && set -x [[ -n $debug ]] && set -x
if [[ -z ${solr_port} ]]
then
echo "Solr port number missing in $confFile or command line."
echo "$USAGE"
exit 1
fi
# use default value for data_dir if not specified # use default value for data_dir if not specified
# relative path starts at ${solr_root} # relative path starts at ${solr_root}
if [[ -z ${data_dir} ]] if [[ -z ${data_dir} ]]
@ -92,16 +90,29 @@ then
data_dir=${solr_root}/${data_dir} data_dir=${solr_root}/${data_dir}
fi fi
# use default hostname if not specified if [[ -n ${solr_url} ]]
if [[ -z ${solr_hostname} ]]
then then
solr_hostname=localhost curl_url=${solr_url}
fi else
if [[ -z ${solr_port} ]]
then
echo "Solr port number missing in $confFile or command line."
echo "$USAGE"
exit 1
fi
# use default webapp name if not specified # use default hostname if not specified
if [[ -z ${webapp_name} ]] if [[ -z ${solr_hostname} ]]
then then
solr_hostname=localhost
fi
# use default webapp name if not specified
if [[ -z ${webapp_name} ]]
then
webapp_name=solr webapp_name=solr
fi
curl_url=http://${solr_hostname}:${solr_port}/${webapp_name}/update
fi fi
fixUser "$@" fixUser "$@"
@ -111,11 +122,11 @@ start=`date +"%s"`
logMessage started by $oldwhoami logMessage started by $oldwhoami
logMessage command: $0 $@ logMessage command: $0 $@
logMessage sending commit to Solr server at port ${solr_port} logMessage sending commit to Solr server at ${curl_url}
rs=`curl http://${solr_hostname}:${solr_port}/solr/update -s -d "<commit/>"` rs=`curl ${curl_url} -s -d "<commit/>"`
if [[ $? != 0 ]] if [[ $? != 0 ]]
then then
logMessage failed to connect to Solr server at port ${solr_port} logMessage failed to connect to Solr server at ${curl_url}
logMessage commit failed logMessage commit failed
logExit failed 1 logExit failed 1
fi fi
@ -124,7 +135,7 @@ fi
echo $rs | grep '<result.*status="0"' > /dev/null 2>&1 echo $rs | grep '<result.*status="0"' > /dev/null 2>&1
if [[ $? != 0 ]] if [[ $? != 0 ]]
then then
logMessage commit request to Solr at port ${solr_port} failed: logMessage commit request to Solr at ${curl_url} failed:
logMessage $rs logMessage $rs
logExit failed 2 logExit failed 2
fi fi
@ -134,7 +145,7 @@ lastsnap=`ls -drt1 ${data_dir}/snapshot.* 2> /dev/null | tail -1 `
if [[ $lastsnap == "" ]] if [[ $lastsnap == "" ]]
then then
logMessage commit did not create snapshot at port ${solr_port}, backup failed: logMessage commit did not create snapshot at ${curl_url}, backup failed:
logExit failed 3 logExit failed 3
fi fi

View File

@ -22,8 +22,9 @@ orig_dir=$(pwd)
cd ${0%/*}/.. cd ${0%/*}/..
solr_root=$(pwd) solr_root=$(pwd)
cd ${orig_dir} cd ${orig_dir}
curl_url=""
unset solr_hostname solr_port data_dir webapp_name user verbose debug unset solr_hostname solr_port data_dir webapp_name user verbose debug solr_url
. ${solr_root}/bin/scripts-util . ${solr_root}/bin/scripts-util
# set up variables # set up variables
@ -32,18 +33,19 @@ log=${solr_root}/logs/${prog}.log
# define usage string # define usage string
USAGE="\ USAGE="\
usage: $prog [-h hostname] [-p port] [-d dir] [-w webapp_name] [-u username] [-v] usage: $prog [-h hostname] [-p port] [-d dir] [-w webapp_name] [-u username] [-U url] [-v] [-V]
-h specify Solr hostname -h specify Solr hostname (defaults to localhost)
-p specify Solr port number -p specify Solr port number
-d specify directory holding index data
-w specify name of Solr webapp (defaults to solr) -w specify name of Solr webapp (defaults to solr)
-u specify user to sudo to before running script -u specify user to sudo to before running script
-U specify full update url (overrides -h,-p,-w parameters)
-d specify directory holding index data (defaults to data)
-v increase verbosity -v increase verbosity
-V output debugging info -V output debugging info
" "
# parse args # parse args
while getopts h:p:d:w:u:vV OPTION while getopts h:p:d:w:u:U:vV OPTION
do do
case $OPTION in case $OPTION in
h) h)
@ -61,6 +63,9 @@ do
u) u)
user="$OPTARG" user="$OPTARG"
;; ;;
U)
solr_url="$OPTARG"
;;
v) v)
verbose="v" verbose="v"
;; ;;
@ -75,13 +80,6 @@ done
[[ -n $debug ]] && set -x [[ -n $debug ]] && set -x
if [[ -z ${solr_port} ]]
then
echo "Solr port number missing in $confFile or command line."
echo "$USAGE"
exit 1
fi
# use default value for data_dir if not specified # use default value for data_dir if not specified
# relative path starts at ${solr_root} # relative path starts at ${solr_root}
if [[ -z ${data_dir} ]] if [[ -z ${data_dir} ]]
@ -92,16 +90,29 @@ then
data_dir=${solr_root}/${data_dir} data_dir=${solr_root}/${data_dir}
fi fi
# use default hostname if not specified if [[ -n ${solr_url} ]]
if [[ -z ${solr_hostname} ]]
then then
solr_hostname=localhost curl_url=${solr_url}
fi else
if [[ -z ${solr_port} ]]
then
echo "Solr port number missing in $confFile or command line."
echo "$USAGE"
exit 1
fi
# use default webapp name if not specified # use default hostname if not specified
if [[ -z ${webapp_name} ]] if [[ -z ${solr_hostname} ]]
then then
solr_hostname=localhost
fi
# use default webapp name if not specified
if [[ -z ${webapp_name} ]]
then
webapp_name=solr webapp_name=solr
fi
curl_url=http://${solr_hostname}:${solr_port}/${webapp_name}/update
fi fi
fixUser "$@" fixUser "$@"
@ -111,11 +122,11 @@ start=`date +"%s"`
logMessage started by $oldwhoami logMessage started by $oldwhoami
logMessage command: $0 $@ logMessage command: $0 $@
logMessage sending optimize to Solr server at port ${solr_port} logMessage sending optimize to Solr server at ${curl_url}
rs=`curl http://${solr_hostname}:${solr_port}/solr/update -s -d "<optimize/>"` rs=`curl ${curl_url} -s -d "<optimize/>"`
if [[ $? != 0 ]] if [[ $? != 0 ]]
then then
logMessage failed to connect to Solr server at port ${solr_port} logMessage failed to connect to Solr server at ${curl_url}
logMessage optimize failed logMessage optimize failed
logExit failed 1 logExit failed 1
fi fi
@ -124,7 +135,7 @@ fi
echo $rs | grep '<result.*status="0"' > /dev/null 2>&1 echo $rs | grep '<result.*status="0"' > /dev/null 2>&1
if [[ $? != 0 ]] if [[ $? != 0 ]]
then then
logMessage optimize request to Solr at port ${solr_port} failed: logMessage optimize request to Solr at ${curl_url} failed:
logMessage $rs logMessage $rs
logExit failed 2 logExit failed 2
fi fi
@ -134,7 +145,7 @@ lastsnap=`ls -drt1 ${data_dir}/snapshot.* | tail -1 `
if [[ $lastsnap == "" ]] if [[ $lastsnap == "" ]]
then then
logMessage commit did not create snapshot at port ${solr_port}, backup failed: logMessage commit did not create snapshot at ${curl_url}, backup failed:
logExit failed 3 logExit failed 3
fi fi

View File

@ -22,8 +22,9 @@ orig_dir=$(pwd)
cd ${0%/*}/.. cd ${0%/*}/..
solr_root=$(pwd) solr_root=$(pwd)
cd ${orig_dir} cd ${orig_dir}
curl_url=""
unset solr_hostname solr_port webapp_name user verbose debug unset solr_hostname solr_port webapp_name user verbose debug solr_url
. ${solr_root}/bin/scripts-util . ${solr_root}/bin/scripts-util
# set up variables # set up variables
@ -32,17 +33,18 @@ log=${solr_root}/logs/${prog}.log
# define usage string # define usage string
USAGE="\ USAGE="\
usage: $prog [-h hostname] [-p port] [-w webapp_name] [-u username] [-v] usage: $prog [-h hostname] [-p port] [-w webapp_name] [-u username] [-U url] [-v] [-V]
-h specify Solr hostname -h specify Solr hostname (defaults to localhost)
-p specify Solr port number -p specify Solr port number
-w specify name of Solr webapp (defaults to solr) -w specify name of Solr webapp (defaults to solr)
-u specify user to sudo to before running script -u specify user to sudo to before running script
-U specify full update url (overrides -h,-p,-w parameters)
-v increase verbosity -v increase verbosity
-V output debugging info -V output debugging info
" "
# parse args # parse args
while getopts h:p:w:u:vV OPTION while getopts h:p:w:u:U:vV OPTION
do do
case $OPTION in case $OPTION in
h) h)
@ -57,6 +59,9 @@ do
u) u)
user="$OPTARG" user="$OPTARG"
;; ;;
U)
solr_url="$OPTARG"
;;
v) v)
verbose="v" verbose="v"
;; ;;
@ -71,25 +76,29 @@ done
[[ -n $debug ]] && set -x [[ -n $debug ]] && set -x
if [[ -z ${solr_port} ]] if [[ -n ${solr_url} ]]
then then
curl_url=${solr_url}
else
if [[ -z ${solr_port} ]]
then
echo "Solr port number missing in $confFile or command line." echo "Solr port number missing in $confFile or command line."
echo "$USAGE" echo "$USAGE"
exit 1
fi
# use default hostname if not specified
exit 1 if [[ -z ${solr_hostname} ]]
fi then
# use default hostname if not specified
if [[ -z ${solr_hostname} ]]
then
solr_hostname=localhost solr_hostname=localhost
fi fi
# use default webapp name if not specified # use default webapp name if not specified
if [[ -z ${webapp_name} ]] if [[ -z ${webapp_name} ]]
then then
webapp_name=solr webapp_name=solr
fi
curl_url=http://${solr_hostname}:${solr_port}/${webapp_name}/update
fi fi
fixUser "$@" fixUser "$@"
@ -99,10 +108,10 @@ start=`date +"%s"`
logMessage started by $oldwhoami logMessage started by $oldwhoami
logMessage command: $0 $@ logMessage command: $0 $@
rs=`curl http://${solr_hostname}:${solr_port}/solr/update -s -d "<commit/>"` rs=`curl ${curl_url} -s -d "<commit/>"`
if [[ $? != 0 ]] if [[ $? != 0 ]]
then then
logMessage failed to connect to Solr server at port ${solr_port} logMessage failed to connect to Solr server at ${curl_url}
logMessage commit failed logMessage commit failed
logExit failed 1 logExit failed 1
fi fi
@ -111,7 +120,7 @@ fi
echo $rs | grep '<result.*status="0"' > /dev/null 2>&1 echo $rs | grep '<result.*status="0"' > /dev/null 2>&1
if [[ $? != 0 ]] if [[ $? != 0 ]]
then then
logMessage commit request to Solr at port ${solr_port} failed: logMessage commit request to Solr at ${curl_url} failed:
logMessage $rs logMessage $rs
logExit failed 2 logExit failed 2
fi fi

View File

@ -22,8 +22,9 @@ orig_dir=$(pwd)
cd ${0%/*}/.. cd ${0%/*}/..
solr_root=$(pwd) solr_root=$(pwd)
cd ${orig_dir} cd ${orig_dir}
curl_url=""
unset solr_hostname solr_port webapp_name user verbose debug unset solr_hostname solr_port webapp_name user verbose debug solr_url
. ${solr_root}/bin/scripts-util . ${solr_root}/bin/scripts-util
# set up variables # set up variables
@ -32,18 +33,19 @@ log=${solr_root}/logs/${prog}.log
# define usage string # define usage string
USAGE="\ USAGE="\
usage: $prog [-h hostname] [-p port] [-u username] [-v] usage: $prog [-h hostname] [-p port] [-u username] [-U url] [-v] [-V]
-h specify Solr hostname -h specify Solr hostname (defaults to localhost)
-p specify Solr port number -p specify Solr port number
-w specify name of Solr webapp (defaults to solr) -w specify name of Solr webapp (defaults to solr)
-u specify user to sudo to before running script -u specify user to sudo to before running script
-U specify full update url (overrides -h,-p,-w parameters)
-v increase verbosity -v increase verbosity
-V output debugging info -V output debugging info
" "
# parse args # parse args
originalargs="$@" originalargs="$@"
while getopts h:p:w:u:vV OPTION while getopts h:p:w:u:U:vV OPTION
do do
case $OPTION in case $OPTION in
h) h)
@ -58,6 +60,9 @@ do
u) u)
user="$OPTARG" user="$OPTARG"
;; ;;
U)
solr_url="$OPTARG"
;;
v) v)
verbose="v" verbose="v"
;; ;;
@ -72,23 +77,29 @@ done
[[ -n $debug ]] && set -x [[ -n $debug ]] && set -x
if [[ -z ${solr_port} ]] if [[ -n ${solr_url} ]]
then then
curl_url=${solr_url}
else
if [[ -z ${solr_port} ]]
then
echo "Solr port number missing in $confFile or command line." echo "Solr port number missing in $confFile or command line."
echo "$USAGE" echo "$USAGE"
exit 1 exit 1
fi fi
# use default hostname if not specified # use default hostname if not specified
if [[ -z ${solr_hostname} ]] if [[ -z ${solr_hostname} ]]
then then
solr_hostname=localhost solr_hostname=localhost
fi fi
# use default webapp name if not specified # use default webapp name if not specified
if [[ -z ${webapp_name} ]] if [[ -z ${webapp_name} ]]
then then
webapp_name=solr webapp_name=solr
fi
curl_url=http://${solr_hostname}:${solr_port}/${webapp_name}/update
fi fi
fixUser "$@" fixUser "$@"
@ -98,19 +109,19 @@ start=`date +"%s"`
logMessage started by $oldwhoami logMessage started by $oldwhoami
logMessage command: $0 $@ logMessage command: $0 $@
rs=`curl http://${solr_hostname}:${solr_port}/solr/update -s -d "<optimize/>"` rs=`curl ${curl_url} -s -d "<optimize/>"`
if [[ $? != 0 ]] if [[ $? != 0 ]]
then then
logMessage failed to connect to Solr server at port ${solr_port} logMessage failed to connect to Solr server at ${curl_url}
logMessage optimize failed logMessage optimize failed
logExit failed 1 logExit failed 1
fi fi
# check status of optimize request # check status of optimize request
echo $rs | grep '<response.*status="0"' > /dev/null 2>&1 rc=`echo $rs|cut -f2 -d'"'`
if [[ $? != 0 ]] if [[ $? != 0 ]]
then then
logMessage optimize request to Solr at port ${solr_port} failed: logMessage optimize request to Solr at ${curl_url} failed:
logMessage $rs logMessage $rs
logExit failed 2 logExit failed 2
fi fi

View File

@ -22,8 +22,9 @@ orig_dir=$(pwd)
cd ${0%/*}/.. cd ${0%/*}/..
solr_root=$(pwd) solr_root=$(pwd)
cd ${orig_dir} cd ${orig_dir}
curl_url=""
unset solr_hostname solr_port webapp_name user verbose debug unset solr_hostname solr_port webapp_name user verbose debug solr_url
. ${solr_root}/bin/scripts-util . ${solr_root}/bin/scripts-util
# set up variables # set up variables
@ -32,18 +33,19 @@ log=${solr_root}/logs/${prog}.log
# define usage string # define usage string
USAGE="\ USAGE="\
usage: $prog [-p hostname] [-p port] [-w webapp_name] [-u username] [-v] usage: $prog [-p hostname] [-p port] [-w webapp_name] [-u username] [-U url] [-v] [-V]
-h specify Solr hostname -h specify Solr hostname (defaults to localhost)
-p specify Solr port number -p specify Solr port number
-w specify name of Solr webapp (defaults to solr) -w specify name of Solr webapp (defaults to solr)
-u specify user to sudo to before running script -u specify user to sudo to before running script
-U specify full update url (overrides -h,-p,-w parameters)
-v increase verbosity -v increase verbosity
-V output debugging info -V output debugging info
" "
# parse args # parse args
originalargs="$@" originalargs="$@"
while getopts h:p:w:u:vV OPTION while getopts h:p:w:u:U:vV OPTION
do do
case $OPTION in case $OPTION in
h) h)
@ -58,6 +60,9 @@ do
u) u)
user="$OPTARG" user="$OPTARG"
;; ;;
U)
solr_url="$OPTARG"
;;
v) v)
verbose="v" verbose="v"
;; ;;
@ -72,23 +77,29 @@ done
[[ -n $debug ]] && set -x [[ -n $debug ]] && set -x
if [[ -z ${solr_port} ]] if [[ -n ${solr_url} ]]
then then
curl_url=${solr_url}
else
if [[ -z ${solr_port} ]]
then
echo "Solr port number missing in $confFile or command line." echo "Solr port number missing in $confFile or command line."
echo "$USAGE" echo "$USAGE"
exit 1 exit 1
fi fi
# use default hostname if not specified # use default hostname if not specified
if [[ -z ${solr_hostname} ]] if [[ -z ${solr_hostname} ]]
then then
solr_hostname=localhost solr_hostname=localhost
fi fi
# use default webapp name if not specified # use default webapp name if not specified
if [[ -z ${webapp_name} ]] if [[ -z ${webapp_name} ]]
then then
webapp_name=solr webapp_name=solr
fi
curl_url=http://${solr_hostname}:${solr_port}/${webapp_name}/update
fi fi
fixUser "$@" fixUser "$@"
@ -98,10 +109,10 @@ start=`date +"%s"`
logMessage started by $oldwhoami logMessage started by $oldwhoami
logMessage command: $0 $@ logMessage command: $0 $@
rs=`curl http://${solr_hostname}:${solr_port}/solr/update -s -d "<commit/>"` rs=`curl ${curl_url} -s -d "<commit/>"`
if [[ $? != 0 ]] if [[ $? != 0 ]]
then then
logMessage failed to connect to Solr server at port ${solr_port} logMessage failed to connect to Solr server at ${curl_url}
logMessage reader cycle failed logMessage reader cycle failed
logExit failed 1 logExit failed 1
fi fi
@ -110,7 +121,7 @@ fi
echo $rs | grep '<response.*status="0"' > /dev/null 2>&1 echo $rs | grep '<response.*status="0"' > /dev/null 2>&1
if [[ $? != 0 ]] if [[ $? != 0 ]]
then then
logMessage reader cycle request to Solr at port ${solr_port} failed: logMessage reader cycle request to Solr at ${curl_url} failed:
logMessage $rs logMessage $rs
logExit failed 2 logExit failed 2
fi fi