Apache Solr open-source search software
SOLR-7453: Remove replication & backup scripts in the solr/scripts directory of the checkout
Varun Thacker0f5875b735d8
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 99a0a4225f7..0f1cac5a3b7 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -252,6 +252,8 @@ Other Changes* SOLR-9450: The docs/ folder in the binary distribution now contains a single index.html file linkingto the online documentation, reducing the size of the download (janhoy, Shawn Heisey, Uwe Schindler)+* SOLR-7453: Remove replication & backup scripts in the solr/scripts directory of the checkout (Varun Thacker)+================== 6.4.2 ==================Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.diff --git a/solr/scripts/README.txt b/solr/scripts/README.txtdeleted file mode 100644index fb61e7b4788..00000000000--- a/solr/scripts/README.txt+++ /dev/null@@ -1,13 +0,0 @@-This directory contains shell scripts which provided the original-replication & backup functionality dating back to Solr 1.1. These-scripts only work on systems that support removing open hard links and-were superseded by the ReplicationHandler in Solr 1.4.--These scripts are no longer actively maintained, improved, or tested,-but they have been left in the source tree for use by legacy users who-are satisfied with their basic functionality.--For more information on how these scripts can be used, please consult-the wiki...--https://wiki.apache.org/solr/CollectionDistributiondiff --git a/solr/scripts/abc b/solr/scripts/abcdeleted file mode 100755index 1031ef11599..00000000000--- a/solr/scripts/abc+++ /dev/null@@ -1,159 +0,0 @@-#!/bin/bash-#-# Licensed to the Apache Software Foundation (ASF) under one or more-# contributor license agreements. See the NOTICE file distributed with-# this work for additional information regarding copyright ownership.-# The ASF licenses this file to You under the Apache License, Version 2.0-# (the "License"); you may not use this file except in compliance with-# the License. You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.-#-# Shell script to make an Atomic Backup after Commit of-# a Solr Lucene collection.--orig_dir=$(pwd)-cd ${0%/*}/..-solr_root=$(pwd)-cd ${orig_dir}-curl_url=""--unset solr_hostname solr_port data_dir webapp_name user verbose debug solr_url-. ${solr_root}/bin/scripts-util--# set up variables-prog=${0##*/}-log=${solr_root}/logs/${prog}.log--# define usage string-USAGE="\-usage: $prog [-h hostname] [-p port] [-d dir] [-w webapp_name] [-u username] [-U url] [-v] [-V]- -h specify Solr hostname (defaults to localhost)- -p specify Solr port number- -w specify name of Solr webapp (defaults to solr)- -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 output debugging info-"--# parse args-while getopts h:p:d:w:u:U:vV OPTION-do- case $OPTION in- h)- solr_hostname="$OPTARG"- ;;- p)- solr_port="$OPTARG"- ;;- d)- data_dir="$OPTARG"- ;;- w)- webapp_name="$OPTARG"- ;;- u)- user="$OPTARG"- ;;- U)- solr_url="$OPTARG"- ;;- v)- verbose="v"- ;;- V)- debug="V"- ;;- *)- echo "$USAGE"- exit 1- esac-done--[[ -n $debug ]] && set -x--dataDir--curlUrl--fixUser "$@"--setStartTime--logMessage started by $oldwhoami-logMessage command: $0 $@--logMessage sending commit to Solr server at ${curl_url}-rs=`curl ${curl_url} -s -H 'Content-type:text/xml; charset=utf-8' -d "<commit/>"`-if [[ $? != 0 ]]-then- logMessage failed to connect to Solr server at ${curl_url}- logMessage commit failed- logExit failed 1-fi--# check status of commit request - original format-echo $rs | grep '<result.*status="0"' > /dev/null 2>&1-if [[ $? != 0 ]]-then-# check status of commit request - new format- echo $rs | grep '<lst name="responseHeader"><int name="status">0</int>' > /dev/null 2>&1- if [[ $? != 0 ]]- then- logMessage commit request to Solr at ${curl_url} failed:- logMessage $rs- logExit failed 2- fi-fi--# successful commit creates a snapshot file synchronously-lastsnap=`find ${data_dir} -type d -name 'snapshot.*' 2>/dev/null| sort -r | head -1`--if [[ $lastsnap == "" ]]-then- logMessage commit did not create snapshot at ${curl_url}, backup failed:- logExit failed 3-fi--name=backup.${lastsnap##*snapshot.}-temp=temp-${name}--if [[ -d ${data_dir}/${name} ]]-then- logMessage backup directory ${data_dir}/${name} already exists- logExit aborted 1-fi--if [[ -d ${data_dir}/${temp} ]]-then- logMessage backingup of ${data_dir}/${name} in progress- logExit aborted 1-fi-logMessage making backup ${data_dir}/${name}--# clean up after INT/TERM-trap 'echo cleaning up, please wait ...;/bin/rm -rf ${data_dir}/${name} ${data_dir}/${temp};logExit aborted 13' INT TERM--# make a backup using hard links into temporary location-# then move it into place atomically-if [[ "${OS}" == "SunOS" || "${OS}" == "Darwin" || "${OS}" == "FreeBSD" ]]-then- orig_dir=$(pwd)- mkdir ${data_dir}/${temp}- cd ${lastsnap}- find . -print|cpio -pdlmu ${data_dir}/${temp} 1>/dev/null 2>&1- cd ${orig_dir}-else- cp -lr ${lastsnap} ${data_dir}/${temp}-fi-mv ${data_dir}/${temp} ${data_dir}/${name}--logExit ended 0diff --git a/solr/scripts/abo b/solr/scripts/abodeleted file mode 100755index 144ae8d59cc..00000000000--- a/solr/scripts/abo+++ /dev/null@@ -1,158 +0,0 @@-#!/bin/bash-#-# Licensed to the Apache Software Foundation (ASF) under one or more-# contributor license agreements. See the NOTICE file distributed with-# this work for additional information regarding copyright ownership.-# The ASF licenses this file to You under the Apache License, Version 2.0-# (the "License"); you may not use this file except in compliance with-# the License. You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.-#-# Shell script to make an Atomic Backup after Optimize of-# a Solr Lucene collection.--orig_dir=$(pwd)-cd ${0%/*}/..-solr_root=$(pwd)-cd ${orig_dir}--unset solr_hostname solr_port data_dir webapp_name user verbose debug solr_url-. ${solr_root}/bin/scripts-util--# set up variables-prog=${0##*/}-log=${solr_root}/logs/${prog}.log--# define usage string-USAGE="\-usage: $prog [-h hostname] [-p port] [-d dir] [-w webapp_name] [-u username] [-U url] [-v] [-V]- -h specify Solr hostname (defaults to localhost)- -p specify Solr port number- -w specify name of Solr webapp (defaults to solr)- -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 output debugging info-"--# parse args-while getopts h:p:d:w:u:U:vV OPTION-do- case $OPTION in- h)- solr_hostname="$OPTARG"- ;;- p)- solr_port="$OPTARG"- ;;- d)- data_dir="$OPTARG"- ;;- w)- webapp_name="$OPTARG"- ;;- u)- user="$OPTARG"- ;;- U)- solr_url="$OPTARG"- ;;- v)- verbose="v"- ;;- V)- debug="V"- ;;- *)- echo "$USAGE"- exit 1- esac-done--[[ -n $debug ]] && set -x--dataDir--curlUrl--fixUser "$@"--setStartTime--logMessage started by $oldwhoami-logMessage command: $0 $@--logMessage sending optimize to Solr server at ${curl_url}-rs=`curl ${curl_url} -s -H 'Content-type:text/xml; charset=utf-8' -d "<optimize/>"`-if [[ $? != 0 ]]-then- logMessage failed to connect to Solr server at ${curl_url}- logMessage optimize failed- logExit failed 1-fi--# check status of optimize request - original format-echo $rs | grep '<result.*status="0"' > /dev/null 2>&1-if [[ $? != 0 ]]-then-# check status of optimize request - new format- echo $rs | grep '<lst name="responseHeader"><int name="status">0</int>' > /dev/null 2>&1- if [[ $? != 0 ]]- then- logMessage optimize request to Solr at ${curl_url} failed:- logMessage $rs- logExit failed 2- fi-fi--# successful optimize creates a snapshot file synchronously-lastsnap=`find ${data_dir} -type d -name 'snapshot.*' 2>/dev/null| sort -r | head -1`--if [[ $lastsnap == "" ]]-then- logMessage commit did not create snapshot at ${curl_url}, backup failed:- logExit failed 3-fi--name=backup.${lastsnap##*snapshot.}-temp=temp-${name}--if [[ -d ${data_dir}/${name} ]]-then- logMessage backup directory ${data_dir}/${name} already exists- logExit aborted 1-fi--if [[ -d ${data_dir}/${temp} ]]-then- logMessage backingup of ${data_dir}/${name} in progress- logExit aborted 1-fi-logMessage making backup ${data_dir}/${name}--# clean up after INT/TERM-trap 'echo cleaning up, please wait ...;/bin/rm -rf ${data_dir}/${name} ${data_dir}/${temp};logExit aborted 13' INT TERM--# make a backup using hard links into temporary location-# then move it into place atomically-if [[ "${OS}" == "SunOS" || "${OS}" == "Darwin" || "${OS}" == "FreeBSD" ]]-then- orig_dir=$(pwd)- mkdir ${data_dir}/${temp}- cd ${lastsnap}- find . -print|cpio -pdlmu ${data_dir}/${temp} 1>/dev/null 2>&1- cd ${orig_dir}-else- cp -lr ${lastsnap} ${data_dir}/${temp}-fi-mv ${data_dir}/${temp} ${data_dir}/${name}--logExit ended 0diff --git a/solr/scripts/backup b/solr/scripts/backupdeleted file mode 100755index 633d7accaaf..00000000000--- a/solr/scripts/backup+++ /dev/null@@ -1,109 +0,0 @@-#!/bin/bash-#-# Licensed to the Apache Software Foundation (ASF) under one or more-# contributor license agreements. See the NOTICE file distributed with-# this work for additional information regarding copyright ownership.-# The ASF licenses this file to You under the Apache License, Version 2.0-# (the "License"); you may not use this file except in compliance with-# the License. You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.-#-# Shell script to make a backup of a Solr Lucene collection.--orig_dir=$(pwd)-cd ${0%/*}/..-solr_root=$(pwd)-cd ${orig_dir}--unset data_dir user verbose debug-. ${solr_root}/bin/scripts-util--# set up variables-prog=${0##*/}-log=${solr_root}/logs/${prog}.log--# define usage string-USAGE="\-usage: $prog [-d dir] [-u username] [-v] [-V]- -d specify directory holding index data- -u specify user to sudo to before running script- -v increase verbosity- -V output debugging info-"--# parse args-while getopts d:u:vV OPTION-do- case $OPTION in- d)- data_dir="$OPTARG"- ;;- u)- user="$OPTARG"- ;;- v)- verbose="v"- ;;- V)- debug="V"- ;;- *)- echo "$USAGE"- exit 1- esac-done--[[ -n $debug ]] && set -x--dataDir--fixUser "$@"--setStartTime--logMessage started by $oldwhoami-logMessage command: $0 $@--name=backup.`date +"%Y%m%d%H%M%S"`-temp=temp-${name}--if [[ -d ${data_dir}/${name} ]]-then- logMessage backup directory ${data_dir}/${name} already exists- logExit aborted 1-fi--if [[ -d ${data_dir}/${temp} ]]-then- logMessage backingup of ${data_dir}/${name} in progress- logExit aborted 1-fi--# clean up after INT/TERM-trap 'echo cleaning up, please wait ...;/bin/rm -rf ${data_dir}/${name} ${data_dir}/${temp};logExit aborted 13' INT TERM--logMessage making backup ${data_dir}/${name}--# make a backup using hard links into temporary location-# then move it into place atomically-if [[ "${OS}" == "SunOS" || "${OS}" == "Darwin" || "${OS}" == "FreeBSD" ]]-then- orig_dir=$(pwd)- mkdir ${data_dir}/${temp}- cd ${data_dir}/index- find . -print|cpio -pdlmu ${data_dir}/${temp} 1>/dev/null 2>&1- cd ${orig_dir}-else- cp -lr ${data_dir}/index ${data_dir}/${temp}-fi-mv ${data_dir}/${temp} ${data_dir}/${name}--logExit ended 0-diff --git a/solr/scripts/backupcleaner b/solr/scripts/backupcleanerdeleted file mode 100755index 360e7346a32..00000000000--- a/solr/scripts/backupcleaner+++ /dev/null@@ -1,134 +0,0 @@-#!/bin/bash-#-# Licensed to the Apache Software Foundation (ASF) under one or more-# contributor license agreements. See the NOTICE file distributed with-# this work for additional information regarding copyright ownership.-# The ASF licenses this file to You under the Apache License, Version 2.0-# (the "License"); you may not use this file except in compliance with-# the License. You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.-#-# Shell script to clean up backups of a Solr Lucene collection.--orig_dir=$(pwd)-cd ${0%/*}/..-solr_root=$(pwd)-cd ${orig_dir}--unset days num data_dir user verbose debug-. ${solr_root}/bin/scripts-util--# set up variables-prog=${0##*/}-log=${solr_root}/logs/${prog}.log--# define usage string-USAGE="\-usage: $prog -D <days> | -N <num> [-d dir] [-u username] [-v] [-V]- -D <days> cleanup backups more than <days> days old- -N <num> keep the most recent <num> number of backups and- cleanup up the remaining ones that are not being pulled- -d specify directory holding index data- -u specify user to sudo to before running script- -v increase verbosity- -V output debugging info-"--# parse args-while getopts D:N:d:u:vV OPTION-do- case $OPTION in- D)- days="$OPTARG"- ;;- N)- num="$OPTARG"- ;;- d)- data_dir="$OPTARG"- ;;- u)- user="$OPTARG"- ;;- v)- verbose="v"- ;;- V)- debug="V"- ;;- *)- echo "$USAGE"- exit 1- esac-done--[[ -n $debug ]] && set -x--if [[ -z ${days} && -z ${num} ]]-then- echo "$USAGE"- exit 1-fi--fixUser "$@"--dataDir--function remove-{- logMessage removing backup $1- /bin/rm -rf $1-}--setStartTime--logMessage started by $oldwhoami-logMessage command: $0 $@--# trap control-c-trap 'echo "caught INT/TERM, exiting now but partial cleanup may have already occured";logExit aborted 13' INT TERM--if [[ -n ${days} ]]-then- #is maxdepth supported?- find ${data_dir} -maxdepth 0 -name foobar >/dev/null 2>&1- if [ $? = 0 ]; then- maxdepth="-maxdepth 1"- else- unset maxdepth- fi-- logMessage cleaning up backups more than ${days} days old- for i in `find ${data_dir} ${maxdepth} -name 'backup.*' -mtime +${days} -print`- do- remove $i- done-elif [[ -n ${num} ]]-then- logMessage cleaning up all backups except for the most recent ${num} ones- unset backups count- backups=`find ${data_dir} -type d -name 'backup.*' 2>/dev/null| sort -r`- if [[ $? == 0 ]]- then- count=`echo $backups|wc -w`- startpos=`expr $num + 1`- if [[ $count -gt $num ]]- then- for i in `echo $backups|cut -f${startpos}- -d" "`- do- remove $i- done- fi- fi-fi--logExit ended 0--diff --git a/solr/scripts/commit b/solr/scripts/commitdeleted file mode 100755index c73c042dd1b..00000000000--- a/solr/scripts/commit+++ /dev/null@@ -1,109 +0,0 @@-#!/bin/bash-#-# Licensed to the Apache Software Foundation (ASF) under one or more-# contributor license agreements. See the NOTICE file distributed with-# this work for additional information regarding copyright ownership.-# The ASF licenses this file to You under the Apache License, Version 2.0-# (the "License"); you may not use this file except in compliance with-# the License. You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.-#-# Shell script to force a commit of all changes since last commit-# for a Solr server--orig_dir=$(pwd)-cd ${0%/*}/..-solr_root=$(pwd)-cd ${orig_dir}--unset solr_hostname solr_port webapp_name user verbose debug solr_url-. ${solr_root}/bin/scripts-util--# set up variables-prog=${0##*/}-log=${solr_root}/logs/${prog}.log--# define usage string-USAGE="\-usage: $prog [-h hostname] [-p port] [-w webapp_name] [-u username] [-U url] [-v] [-V]- -h specify Solr hostname (defaults to localhost)- -p specify Solr port number- -w specify name of Solr webapp (defaults to solr)- -u specify user to sudo to before running script- -U specify full update url (overrides -h,-p,-w parameters)- -v increase verbosity- -V output debugging info-"--# parse args-while getopts h:p:w:u:U:vV OPTION-do- case $OPTION in- h)- solr_hostname="$OPTARG"- ;;- p)- solr_port="$OPTARG"- ;;- w)- webapp_name="$OPTARG"- ;;- u)- user="$OPTARG"- ;;- U)- solr_url="$OPTARG"- ;;- v)- verbose="v"- ;;- V)- debug="V"- ;;- *)- echo "$USAGE"- exit 1- esac-done--[[ -n $debug ]] && set -x--curlUrl--fixUser "$@"--setStartTime--logMessage started by $oldwhoami-logMessage command: $0 $@--rs=`curl ${curl_url} -s -H 'Content-type:text/xml; charset=utf-8' -d "<commit/>"`-if [[ $? != 0 ]]-then- logMessage failed to connect to Solr server at ${curl_url}- logMessage commit failed- logExit failed 1-fi--# check status of commit request - original format-echo $rs | grep '<result.*status="0"' > /dev/null 2>&1-if [[ $? != 0 ]]-then-# check status of commit request - new format- echo $rs | grep '<lst name="responseHeader"><int name="status">0</int>' > /dev/null 2>&1- if [[ $? != 0 ]]- then- logMessage commit request to Solr at ${curl_url} failed:- logMessage $rs- logExit failed 2- fi-fi--logExit ended 0diff --git a/solr/scripts/optimize b/solr/scripts/optimizedeleted file mode 100755index 6620607ba81..00000000000--- a/solr/scripts/optimize+++ /dev/null@@ -1,109 +0,0 @@-#!/bin/bash-#-# Licensed to the Apache Software Foundation (ASF) under one or more-# contributor license agreements. See the NOTICE file distributed with-# this work for additional information regarding copyright ownership.-# The ASF licenses this file to You under the Apache License, Version 2.0-# (the "License"); you may not use this file except in compliance with-# the License. You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.-#-# Shell script to force a optimized commit of all changes since last commit-# for a Solr server--orig_dir=$(pwd)-cd ${0%/*}/..-solr_root=$(pwd)-cd ${orig_dir}--unset solr_hostname solr_port webapp_name user verbose debug solr_url-. ${solr_root}/bin/scripts-util--# set up variables-prog=${0##*/}-log=${solr_root}/logs/${prog}.log--# define usage string-USAGE="\-usage: $prog [-h hostname] [-p port] [-w webapp_name] [-u username] [-U url] [-v] [-V]- -h specify Solr hostname (defaults to localhost)- -p specify Solr port number- -w specify name of Solr webapp (defaults to solr)- -u specify user to sudo to before running script- -U specify full update url (overrides -h,-p,-w parameters)- -v increase verbosity- -V output debugging info-"--# parse args-while getopts h:p:w:u:U:vV OPTION-do- case $OPTION in- h)- solr_hostname="$OPTARG"- ;;- p)- solr_port="$OPTARG"- ;;- w)- webapp_name="$OPTARG"- ;;- u)- user="$OPTARG"- ;;- U)- solr_url="$OPTARG"- ;;- v)- verbose="v"- ;;- V)- debug="V"- ;;- *)- echo "$USAGE"- exit 1- esac-done--[[ -n $debug ]] && set -x--curlUrl--fixUser "$@"--setStartTime--logMessage started by $oldwhoami-logMessage command: $0 $@--rs=`curl ${curl_url} -s -H 'Content-type:text/xml; charset=utf-8' -d "<optimize/>"`-if [[ $? != 0 ]]-then- logMessage failed to connect to Solr server at ${curl_url}- logMessage optimize failed- logExit failed 1-fi--# check status of optimize request - original format-rc=`echo $rs|cut -f2 -d'"'`-if [[ $? != 0 ]]-then-# check status of optimize request - new format- echo $rs | grep '<lst name="responseHeader"><int name="status">0</int>' > /dev/null 2>&1- if [[ $? != 0 ]]- then- logMessage optimize request to Solr at ${curl_url} failed:- logMessage $rs- logExit failed 2- fi-fi--logExit ended 0diff --git a/solr/scripts/rsyncd-disable b/solr/scripts/rsyncd-disabledeleted file mode 100755index 8e6c56966fa..00000000000--- a/solr/scripts/rsyncd-disable+++ /dev/null@@ -1,77 +0,0 @@-#!/bin/bash-#-# Licensed to the Apache Software Foundation (ASF) under one or more-# contributor license agreements. See the NOTICE file distributed with-# this work for additional information regarding copyright ownership.-# The ASF licenses this file to You under the Apache License, Version 2.0-# (the "License"); you may not use this file except in compliance with-# the License. You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.-#-# Shell script to disable rsyncd--orig_dir=$(pwd)-cd ${0%/*}/..-solr_root=$(pwd)-cd ${orig_dir}--unset user verbose debug-. ${solr_root}/bin/scripts-util--# set up variables-prog=${0##*/}-log=${solr_root}/logs/rsyncd.log--# define usage string-USAGE="\-usage: $prog [-u username] [-v] [-V]- -u specify user to sudo to before running script- -v increase verbosity- -V output debugging info-"--# parse args-while getopts u:vV OPTION-do- case $OPTION in- u)- user="$OPTARG"- ;;- v)- verbose="v"- ;;- V)- debug="V"- ;;- *)- echo "$USAGE"- exit 1- esac-done--[[ -n $debug ]] && set -x--fixUser "$@"--setStartTime--logMessage disabled by $oldwhoami-logMessage command: $0 $@-name=${solr_root}/logs/rsyncd-enabled--if [[ -f ${name} ]]-then- rm -f ${name}-else- logMessage rsyncd not currently enabled- logExit exited 1-fi--logExit ended 0diff --git a/solr/scripts/rsyncd-enable b/solr/scripts/rsyncd-enabledeleted file mode 100755index 075368d4f97..00000000000--- a/solr/scripts/rsyncd-enable+++ /dev/null@@ -1,76 +0,0 @@-#!/bin/bash-#-# Licensed to the Apache Software Foundation (ASF) under one or more-# contributor license agreements. See the NOTICE file distributed with-# this work for additional information regarding copyright ownership.-# The ASF licenses this file to You under the Apache License, Version 2.0-# (the "License"); you may not use this file except in compliance with-# the License. You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.-#-# Shell script to enable rsyncd--orig_dir=$(pwd)-cd ${0%/*}/..-solr_root=$(pwd)-cd ${orig_dir}--unset user verbose debug-. ${solr_root}/bin/scripts-util--# set up variables-log=${solr_root}/logs/rsyncd.log--# define usage string-USAGE="\-usage: $prog [-u username] [-v] [-V]- -u specify user to sudo to before running script- -v increase verbosity- -V output debugging info-"--# parse args-while getopts u:vV OPTION-do- case $OPTION in- u)- user="$OPTARG"- ;;- v)- verbose="v"- ;;- V)- debug="V"- ;;- *)- echo "$USAGE"- exit 1- esac-done--[[ -n $debug ]] && set -x--fixUser "$@"--setStartTime--logMessage enabled by $oldwhoami-logMessage command: $0 $@-name=${solr_root}/logs/rsyncd-enabled--if [[ -f ${name} ]]-then- logMessage rsyncd already currently enabled- logExit exited 1-else- touch ${name}-fi--logExit ended 0diff --git a/solr/scripts/rsyncd-start b/solr/scripts/rsyncd-startdeleted file mode 100755index 08929ce1ef7..00000000000--- a/solr/scripts/rsyncd-start+++ /dev/null@@ -1,147 +0,0 @@-#!/bin/bash-#-# Licensed to the Apache Software Foundation (ASF) under one or more-# contributor license agreements. See the NOTICE file distributed with-# this work for additional information regarding copyright ownership.-# The ASF licenses this file to You under the Apache License, Version 2.0-# (the "License"); you may not use this file except in compliance with-# the License. You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.-#-# Shell script to start rsyncd on master Solr server--orig_dir=$(pwd)-cd ${0%/*}/..-solr_root=$(pwd)-cd ${orig_dir}--unset data_dir solr_port rsyncd_port user rsyncd_bwlimit verbose debug-. ${solr_root}/bin/scripts-util--# set up variables-prog=${0##*/}-log=${solr_root}/logs/rsyncd.log--# define usage string-USAGE="\-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:b:vV OPTION-do- case $OPTION in- d)- data_dir="$OPTARG"- ;;- p)- rsyncd_port="$OPTARG"- ;;- u)- user="$OPTARG"- ;;- b)- rsyncd_bwlimit="$OPTARG"- ;;- v)- verbose="v"- ;;- V)- debug="V"- ;;- *)- echo "$USAGE"- exit 1- esac-done--[[ -n $debug ]] && set -x--fixUser "$@"--# try to determine rsyncd port number from $confFile if not specified on-# command line, default to solr_port+10000-if [[ -z ${rsyncd_port} ]]-then- if [[ "${solr_port}" ]]- then- rsyncd_port=`expr 10000 + ${solr_port}`- else- echo "rsyncd port number missing in $confFile or command line."- echo "$USAGE"- exit 1- fi-fi--# Set bwlimit to unlimited by default-if [[ -z ${rsyncd_bwlimit} ]]-then- rsyncd_bwlimit='0'-fi--dataDir--logMessage started by $oldwhoami-logMessage command: $0 $@--if [[ ! -f ${solr_root}/logs/rsyncd-enabled ]]-then- logMessage rsyncd disabled- exit 2-fi--if \- rsync rsync://localhost:${rsyncd_port} >/dev/null 2>&1-then- logMessage "rsyncd already running at port ${rsyncd_port}"- exit 1-fi--# create conf/rsyncd.conf on the fly, creating solrlogs directory if needed-if [[ ! -d ${solr_root}/conf ]]-then- mkdir ${solr_root}/conf-fi-cat <<EOF > ${solr_root}/conf/rsyncd.conf-#### rsyncd.conf file ####--uid = $(whoami)-gid = $(whoami)-use chroot = no-list = no-pid file = ${solr_root}/logs/rsyncd.pid-log file = ${solr_root}/logs/rsyncd.log-[solr]- path = ${data_dir}- comment = Solr-EOF--rsync --daemon --port=${rsyncd_port} --bwlimit=${rsyncd_bwlimit} --config=${solr_root}/conf/rsyncd.conf--# first make sure rsyncd is accepting connections-i=1-while \- ! rsync rsync://localhost:${rsyncd_port} >/dev/null 2>&1-do- if (( i++ > 15 ))- then- logMessage "rsyncd not accepting connections, exiting" >&2- exit 2- fi- sleep 1-done--logMessage rsyncd started with data_dir=${data_dir} and accepting requestsdiff --git a/solr/scripts/rsyncd-stop b/solr/scripts/rsyncd-stopdeleted file mode 100755index 4a5899d6d92..00000000000--- a/solr/scripts/rsyncd-stop+++ /dev/null@@ -1,105 +0,0 @@-#!/bin/bash-#-# Licensed to the Apache Software Foundation (ASF) under one or more-# contributor license agreements. See the NOTICE file distributed with-# this work for additional information regarding copyright ownership.-# The ASF licenses this file to You under the Apache License, Version 2.0-# (the "License"); you may not use this file except in compliance with-# the License. You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.-#-# Shell script to stop rsyncd on master Solr server--orig_dir=$(pwd)-cd ${0%/*}/..-solr_root=$(pwd)-cd ${orig_dir}--unset user verbose debug-. ${solr_root}/bin/scripts-util--# set up variables-prog=${0##*/}-log=${solr_root}/logs/rsyncd.log--# define usage string-USAGE="\-usage: $prog [-u username] [-v] [-V]- -u specify user to sudo to before running script- -v increase verbosity- -V output debugging info-"--# parse args-while getopts u:vV OPTION-do- case $OPTION in- u)- user="$OPTARG"- ;;- v)- verbose="v"- ;;- V)- debug="V"- ;;- *)- echo "$USAGE"- exit 1- esac-done--[[ -n $debug ]] && set -x--fixUser "$@"--logMessage stopped by $oldwhoami-logMessage command: $0 $@--# look for pid file-if [[ ! -f ${solr_root}/logs/rsyncd.pid ]]-then- logMessage "missing rsyncd pid file ${solr_root}/logs/rsyncd.pid"- exit 2-fi--# get PID from file-pid=$(<${solr_root}/logs/rsyncd.pid)-if [[ -z $pid ]]-then- logMessage "unable to get rsyncd's PID"- exit 2-fi--kill $pid--# wait until rsyncd dies or we time out-dead=0-timer=0-timeout=300-while (( ! dead && timer < timeout ))-do- if ps -eo pid | grep -qw $pid- then- kill $pid- (( timer++ ))- sleep 1- else- dead=1- fi-done-if ps -eo pid | grep -qw $pid-then- logMessage rsyncd failed to stop after $timeout seconds- exit 3-fi--# remove rsyncd.conf-/bin/rm -f ${solr_root}/conf/rsyncd.confdiff --git a/solr/scripts/scripts-util b/solr/scripts/scripts-utildeleted file mode 100755index 05441e00fac..00000000000--- a/solr/scripts/scripts-util+++ /dev/null@@ -1,141 +0,0 @@-#!/bin/bash-#-# Licensed to the Apache Software Foundation (ASF) under one or more-# contributor license agreements. See the NOTICE file distributed with-# this work for additional information regarding copyright ownership.-# The ASF licenses this file to You under the Apache License, Version 2.0-# (the "License"); you may not use this file except in compliance with-# the License. You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.-#-# util functions used by scripts--export PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH--# set up variables-prog=${0##*/}-OS=`uname`--# source the config file if present-confFile=${solr_root}/conf/scripts.conf-if [[ -f $confFile ]]-then- . $confFile-fi--function fixUser-{-# set user to $(whoami) if not specified- if [[ -z ${user} ]]- then- user=$(whoami)- fi--# sudo- if [[ $(whoami) != ${user} ]]- then- sudo -u ${user} $0 "$@"- exit $?- fi-- oldwhoami=$(who -m | cut -d' ' -f1 | sed -e's/^.*!//')-- if [[ "${oldwhoami}" == "" ]]- then- oldwhoami=`ps h -Hfp $(pgrep -f -g0 $0) | tail -1|cut -f1 -d" "`- fi-}--function setStartTime-{- if [[ "${OS}" == "SunOS" ]]- then- start=`perl -e "print time;"`- else- start=`date +"%s"`- fi-}--function timeStamp-{- date +'%Y/%m/%d %H:%M:%S'-}--function curlUrl-{- curl_url=""- if [[ -n ${solr_url} ]]- then- curl_url=${solr_url}- else- if [[ -z ${solr_port} ]]- then- echo "Solr port number missing in $confFile or command line."- echo "$USAGE"- exit 1- fi-- # use default hostname if not specified- if [[ -z ${solr_hostname} ]]- then- solr_hostname=localhost- fi-- # use default webapp name if not specified- if [[ -z ${webapp_name} ]]- then- webapp_name=solr- fi- curl_url=http://${solr_hostname}:${solr_port}/${webapp_name}/update- fi-}--function dataDir-{- # use default value for data_dir if not specified- # relative path starts at ${solr_root}- if [[ -z ${data_dir} ]]- then- data_dir=${solr_root}/data- elif [[ "`echo ${data_dir}|cut -c1`" != "/" ]]- then- data_dir=${solr_root}/${data_dir}- fi-}--function logMessage-{- echo $(timeStamp) $@>>$log- if [[ -n ${verbose} ]]- then- echo $@- fi-}--function logExit-{- if [[ "${OS}" == "SunOS" ]]- then- end=`perl -e "print time;"`- else- end=`date +"%s"`- fi- diff=`expr $end - $start`- echo "$(timeStamp) $1 (elapsed time: $diff sec)">>$log- exit $2-}--# create logs directory if not there-if [[ ! -d ${solr_root}/logs ]]-then- mkdir ${solr_root}/logs-fi--umask 002diff --git a/solr/scripts/snapcleaner b/solr/scripts/snapcleanerdeleted file mode 100755index a6af6298717..00000000000--- a/solr/scripts/snapcleaner+++ /dev/null@@ -1,146 +0,0 @@-#!/bin/bash-#-# Licensed to the Apache Software Foundation (ASF) under one or more-# contributor license agreements. See the NOTICE file distributed with-# this work for additional information regarding copyright ownership.-# The ASF licenses this file to You under the Apache License, Version 2.0-# (the "License"); you may not use this file except in compliance with-# the License. You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.-#-# Shell script to clean up snapshots of a Solr Lucene collection.--orig_dir=$(pwd)-cd ${0%/*}/..-solr_root=$(pwd)-cd ${orig_dir}--unset days num data_dir user verbose debug-. ${solr_root}/bin/scripts-util--# set up variables-prog=${0##*/}-log=${solr_root}/logs/${prog}.log--# define usage string-USAGE="\-usage: $prog -D <days> | -N <num> [-d dir] [-u username] [-v] [-V]- -D <days> cleanup snapshots more than <days> days old- -N <num> keep the most recent <num> number of snapshots and- cleanup up the remaining ones that are not being pulled- -d specify directory holding index data- -u specify user to sudo to before running script- -v increase verbosity- -V output debugging info-"--# parse args-while getopts D:N:d:u:vV OPTION-do- case $OPTION in- D)- days="$OPTARG"- ;;- N)- num="$OPTARG"- ;;- d)- data_dir="$OPTARG"- ;;- u)- user="$OPTARG"- ;;- v)- verbose="v"- ;;- V)- debug="V"- ;;- *)- echo "$USAGE"- exit 1- esac-done--[[ -n $debug ]] && set -x--if [[ -z ${days} && -z ${num} ]]-then- echo "$USAGE"- exit 1-fi--fixUser "$@"--dataDir--function remove-{- if [[ "${OS}" == "Darwin" || "${OS}" == "FreeBSD" ]]- then- syncing=`ps -www -U ${user} |grep -w rsync|grep -v grep|grep -w $1`- else- syncing=`ps -fwwwu ${user}|grep -w rsync|grep -v grep|grep -w $1`- fi-- if [[ -n $syncing ]]- then- logMessage $1 not removed - rsync in progress- else- logMessage removing snapshot $1- /bin/rm -rf $1- fi-}--setStartTime--logMessage started by $oldwhoami-logMessage command: $0 $@--# trap control-c-trap 'echo "caught INT/TERM, exiting now but partial cleanup may have already occured";logExit aborted 13' INT TERM--if [[ -n ${days} ]]-then- #is maxdepth supported?- find ${data_dir} -maxdepth 0 -name foobar >/dev/null 2>&1- if [ $? = 0 ]; then- maxdepth="-maxdepth 1"- else- unset maxdepth- fi-- logMessage cleaning up snapshots more than ${days} days old- for i in `find ${data_dir} ${maxdepth} -name 'snapshot.*' -mtime +${days} -print`- do- remove $i- done-elif [[ -n ${num} ]]-then- logMessage cleaning up all snapshots except for the most recent ${num} ones- unset snapshots count- snapshots=`find ${data_dir} -type d -name 'snapshot.*' 2>/dev/null| sort -r`- if [[ $? == 0 ]]- then- count=`echo $snapshots|wc -w`- startpos=`expr $num + 1`- if [[ $count -gt $num ]]- then- for i in `echo $snapshots|cut -f${startpos}- -d" "`- do- remove $i- done- fi- fi-fi--logExit ended 0--diff --git a/solr/scripts/snapinstaller b/solr/scripts/snapinstallerdeleted file mode 100755index f921b383f72..00000000000--- a/solr/scripts/snapinstaller+++ /dev/null@@ -1,190 +0,0 @@-#!/bin/bash-#-# Licensed to the Apache Software Foundation (ASF) under one or more-# contributor license agreements. See the NOTICE file distributed with-# this work for additional information regarding copyright ownership.-# The ASF licenses this file to You under the Apache License, Version 2.0-# (the "License"); you may not use this file except in compliance with-# the License. You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.-#-# Shell script to install a snapshot into place as the Lucene collection-# for a Solr server--orig_dir=$(pwd)-cd ${0%/*}/..-solr_root=$(pwd)-cd ${orig_dir}--unset master_host master_status_dir data_dir user verbose debug-. ${solr_root}/bin/scripts-util--# set up variables-prog=${0##*/}-log=${solr_root}/logs/${prog}.log--LOCKDIR="${solr_root}/logs/snapinstaller-lock"-PIDFILE="${LOCKDIR}/PID"---# define usage string-USAGE="\-usage: $prog [-M master] [-S sdir] [-d dir] [-u username] [-v] [-V]- -M master specify hostname of master server from where to pull index- snapshot- -S specify directory holding snapshot status on master server- -d specify directory holding index data on local machine- -u specify user to sudo to before running script- -v increase verbosity- -V output debugging info-"--# parse args-while getopts M:S:d:u:vV OPTION-do- case $OPTION in- M)- master_host="$OPTARG"- ;;- S)- master_status_dir="$OPTARG"- ;;- d)- data_dir="$OPTARG"- ;;- u)- user="$OPTARG"- ;;- v)- verbose="v"- ;;- V)- debug="V"- ;;- *)- echo "$USAGE"- exit 1- esac-done--[[ -n $debug ]] && set -x--if [[ -z ${master_host} ]]-then- echo "name of master server missing in $confFile or command line."- echo "$USAGE"- exit 1-fi--if [[ -z ${master_status_dir} ]]-then- echo "directory holding snapshot status on master server missing in $confFile or command line."- echo "$USAGE"- exit 1-fi--fixUser "$@"--dataDir--# assume relative path to start at ${solr_root}-if [[ "`echo ${master_status_dir}|cut -c1`" != "/" ]]-then- master_status_dir=${solr_root}/${master_status_dir}-fi--setStartTime--if test -r $PIDFILE-then- OTHERPID="$(cat "${PIDFILE}")"- if ! kill -0 $OTHERPID &>/dev/null; then- logMessage removing stale lock ${OTHERPID}- rm -rf "${LOCKDIR}"- else- logExit "lock failed, PID ${OTHERPID} is active" 1- fi-fi--mkdir "${LOCKDIR}" &>/dev/null-echo "$$" >"${PIDFILE}"--logMessage started by $oldwhoami-logMessage command: $0 $@--# get directory name of latest snapshot-name=`perl -e 'chdir q|'${data_dir}'|; print ((sort grep {/^snapshot[.][1-9][0-9]{13}$/} <*>)[-1])'`--# clean up after INT/TERM-trap 'echo "caught INT/TERM, exiting now but partial installation may have already occured";/bin/rm -rf ${data_dir}/index.tmp$$;logExit aborted 13' INT TERM--# is there a snapshot-if [[ "${name}" == "" ]]-then- logMessage no shapshot available- logExit ended 0-fi--name=${data_dir}/${name}--# has snapshot already been installed-if [[ ${name} == `cat ${solr_root}/logs/snapshot.current 2>/dev/null` ]]-then- logMessage latest snapshot ${name} already installed- logExit ended 0-fi--# make sure master has directory for hold slaves stats/state-if- ! ssh -o StrictHostKeyChecking=no ${master_host} mkdir -p ${master_status_dir}-then- logMessage failed to ssh to master ${master_host}, snapshot status not updated on master-fi--# install using hard links into temporary directory-# remove original index and then atomically copy new one into place-logMessage installing snapshot ${name}-if [[ "${OS}" == "SunOS" || "${OS}" == "Darwin" || "${OS}" == "FreeBSD" ]]-then- orig_dir=$(pwd)- mkdir ${data_dir}/index.tmp$$ && \- cd ${name} && \- find . -print|cpio -pdlmu ${data_dir}/index.tmp$$ 1>/dev/null 2>&1 && \- /bin/rm -rf ${data_dir}/index && \- mv -f ${data_dir}/index.tmp$$ ${data_dir}/index- cd ${orig_dir}-else- cp -lr ${name}/ ${data_dir}/index.tmp$$ && \- /bin/rm -rf ${data_dir}/index && \- mv -f ${data_dir}/index.tmp$$ ${data_dir}/index-fi--# update distribution stats-echo ${name} > ${solr_root}/logs/snapshot.current--# push stats/state to master-if- ! scp -q -o StrictHostKeyChecking=no ${solr_root}/logs/snapshot.current ${master_host}:${master_status_dir}/snapshot.current.`uname -n`-then- logMessage failed to ssh to master ${master_host}, snapshot status not updated on master-fi--# notify Solr to open a new Searcher-logMessage notifing Solr to open a new Searcher-${solr_root}/bin/commit-if [[ $? != 0 ]]-then- logMessage failed to connect to Solr server- logMessage snapshot installed but Solr server has not open a new Searcher- logExit failed 1-fi--rm -rf "${LOCKDIR}"-logExit ended 0diff --git a/solr/scripts/snappuller b/solr/scripts/snappullerdeleted file mode 100755index 7a7c4aee7d5..00000000000--- a/solr/scripts/snappuller+++ /dev/null@@ -1,261 +0,0 @@-#!/bin/bash-#-# Licensed to the Apache Software Foundation (ASF) under one or more-# contributor license agreements. See the NOTICE file distributed with-# this work for additional information regarding copyright ownership.-# The ASF licenses this file to You under the Apache License, Version 2.0-# (the "License"); you may not use this file except in compliance with-# the License. You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.-#-# Shell script to copy snapshots of a Solr Lucene collection from the master--orig_dir=$(pwd)-cd ${0%/*}/..-solr_root=$(pwd)-cd ${orig_dir}--unset master_host rsyncd_port master_data_dir master_status_dir snap_name-unset sizeonly stats data_dir user verbose debug compress startStatus-. ${solr_root}/bin/scripts-util--# set up variables-prog=${0##*/}-log=${solr_root}/logs/${prog}.log--# define usage string-USAGE="\-usage: $prog [-M master] [-P portnum] [-D mdir] [-S sdir] [-n snapshot] [-d dir] [-u username] [-svVz]- -M master specify hostname of master server from where to pull index- snapshot- -P port specify rsyncd port number of master server from where to- pull index snapshot- -D specify directory holding index data on master server- -S specify directory holding snapshot status on master server- -n snapshot pull a specific snapshot by name- -d specify directory holding index data on local machine- -u specify user to sudo to before running script- -s use the --size-only option with rsync- -v increase verbosity (-vv show file transfer stats also)- -V output debugging info- -z enable compression of data-"--# parse args-while getopts M:P:D:S:n:d:u:svVz OPTION-do- case $OPTION in- M)- master_host="$OPTARG"- ;;- P)- rsyncd_port="$OPTARG"- ;;- D)- master_data_dir="$OPTARG"- ;;- S)- master_status_dir="$OPTARG"- ;;- n)- snap_name="$OPTARG"- ;;- d)- data_dir="$OPTARG"- ;;- u)- user="$OPTARG"- ;;- s)- sizeonly="--size-only"- ;;- v)- [[ -n $verbose ]] && stats="--stats" || verbose=v- ;;- V)- debug="V"- ;;- z)- compress="z"- ;;- *)- echo "$USAGE"- exit 1- esac-done--[[ -n $debug ]] && set -x--if [[ -z ${master_host} ]]-then- echo "name of master server missing in $confFile or command line."- echo "$USAGE"- exit 1-fi--# try to determine rsyncd port number from $confFile if not specified on-# command line, default to solr_port+10000-if [[ -z ${rsyncd_port} ]]-then- if [[ "${solr_port}" ]]- then- rsyncd_port=`expr 10000 + ${solr_port}`- else- echo "rsyncd port number of master server missing in $confFile or command line."- echo "$USAGE"- exit 1- fi-fi--if [[ -z ${master_data_dir} ]]-then- echo "directory holding index data on master server missing in $confFile or command line."- echo "$USAGE"- exit 1-fi--if [[ -z ${master_status_dir} ]]-then- echo "directory holding snapshot status on master server missing in $confFile or command line."- echo "$USAGE"- exit 1-fi--fixUser "$@"--dataDir--# assume relative path to start at ${solr_root}-if [[ "`echo ${master_data_dir}|cut -c1`" != "/" ]]-then- master_data_dir=${solr_root}/${master_data_dir}-fi-if [[ "`echo ${master_status_dir}|cut -c1`" != "/" ]]-then- master_status_dir=${solr_root}/${master_status_dir}-fi--# push stats/state to master if necessary-function pushStatus-{- scp -q -o StrictHostKeyChecking=no ${solr_root}/logs/snappuller.status ${master_host}:${master_status_dir}/snapshot.status.`uname -n`-}--setStartTime--logMessage started by $oldwhoami-logMessage command: $0 $@--if [[ ! -f ${solr_root}/logs/snappuller-enabled ]]-then- logMessage snappuller disabled- exit 2-fi--# make sure we can ssh to master-if- ! ssh -o StrictHostKeyChecking=no ${master_host} id 1>/dev/null 2>&1-then- logMessage failed to ssh to master ${master_host}- exit 1-fi--# get directory name of latest snapshot if not specified on command line-if [[ -z ${snap_name} ]]-then- snap_name=`ssh -o StrictHostKeyChecking=no ${master_host} "perl -e 'chdir q|${master_data_dir}|; print ((sort grep {/^snapshot[.][1-9][0-9]{13}$/} <*>)[-1])'"`-fi-if [[ "${snap_name}" == "" ]]-then- logMessage no snapshot available on ${master_host} in ${master_data_dir}- logExit ended 0-else- name=`basename ${snap_name}`-fi--# clean up after INT/TERM-trap 'echo cleaning up, please wait ...;/bin/rm -rf ${data_dir}/${name} ${data_dir}/${name}-wip;echo ${startStatus} aborted:$(timeStamp)>${solr_root}/logs/snappuller.status;pushStatus;logExit aborted 13' INT TERM--if [[ -d ${data_dir}/${name} || -d ${data_dir}/${name}-wip ]]-then- logMessage no new snapshot available on ${master_host} in ${master_data_dir}- logExit ended 0-fi--# take a snapshot of current index so that only modified files will be rsync-ed-# put the snapshot in the 'work-in-progress" directory to prevent it from-# being installed while the copying is still in progress-if [[ "${OS}" == "SunOS" || "${OS}" == "Darwin" || "${OS}" == "FreeBSD" ]]-then- orig_dir=$(pwd)- mkdir ${data_dir}/${name}-wip- cd ${data_dir}/index- find . -print|cpio -pdlmu ${data_dir}/${name}-wip 1>/dev/null 2>&1- cd ${orig_dir}-else- cp -lr ${data_dir}/index ${data_dir}/${name}-wip-fi-# force rsync of segments and .del files since we are doing size-only-if [[ -n ${sizeonly} ]]-then- rm -f ${data_dir}/${name}-wip/segments- rm -f ${data_dir}/${name}-wip/*.del-fi--logMessage pulling snapshot ${name}--# make sure master has directory for hold slaves stats/state-ssh -o StrictHostKeyChecking=no ${master_host} mkdir -p ${master_status_dir}--# start new distribution stats-rsyncStart=`date +'%Y-%m-%d %H:%M:%S'`-if [[ "${OS}" == "Darwin" || "${OS}" == "FreeBSD" ]]-then- startTimestamp=`date -j -f '%Y-%m-%d %H:%M:%S' "$rsyncStart" +'%Y%m%d-%H%M%S'`- rsyncStartSec=`date -j -f '%Y-%m-%d %H:%M:%S' "$rsyncStart" +'%s'`-else-startTimestamp=`date -d "$rsyncStart" +'%Y%m%d-%H%M%S'`-rsyncStartSec=`date -d "$rsyncStart" +'%s'`-fi-startStatus="rsync of `basename ${name}` started:$startTimestamp"-echo ${startStatus} > ${solr_root}/logs/snappuller.status-pushStatus--# rsync over files that have changed-rsync -Wa${verbose}${compress} --delete ${sizeonly} \-${stats} rsync://${master_host}:${rsyncd_port}/solr/${name}/ ${data_dir}/${name}-wip--rc=$?-rsyncEnd=`date +'%Y-%m-%d %H:%M:%S'`-if [[ "${OS}" == "Darwin" || "${OS}" == "FreeBSD" ]]-then- endTimestamp=`date -j -f '%Y-%m-%d %H:%M:%S' "$rsyncEnd" +'%Y%m%d-%H%M%S'`- rsyncEndSec=`date -j -f '%Y-%m-%d %H:%M:%S' "$rsyncEnd" +'%s'`-else-endTimestamp=`date -d "$rsyncEnd" +'%Y%m%d-%H%M%S'`-rsyncEndSec=`date -d "$rsyncEnd" +'%s'`-fi-elapsed=`expr $rsyncEndSec - $rsyncStartSec`-if [[ $rc != 0 ]]-then- logMessage rsync failed- /bin/rm -rf ${data_dir}/${name}-wip- echo ${startStatus} failed:$endTimestamp > ${solr_root}/logs/snappuller.status- pushStatus- logExit failed 1-fi--# move into place atomically-mv ${data_dir}/${name}-wip ${data_dir}/${name}--# finish new distribution stats`-echo ${startStatus} ended:$endTimestamp rsync-elapsed:${elapsed} > ${solr_root}/logs/snappuller.status-pushStatus-logExit ended 0diff --git a/solr/scripts/snappuller-disable b/solr/scripts/snappuller-disabledeleted file mode 100755index 1a988afec5a..00000000000--- a/solr/scripts/snappuller-disable+++ /dev/null@@ -1,77 +0,0 @@-#!/bin/bash-#-# Licensed to the Apache Software Foundation (ASF) under one or more-# contributor license agreements. See the NOTICE file distributed with-# this work for additional information regarding copyright ownership.-# The ASF licenses this file to You under the Apache License, Version 2.0-# (the "License"); you may not use this file except in compliance with-# the License. You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.-#-# Shell script to disable snappuller--orig_dir=$(pwd)-cd ${0%/*}/..-solr_root=$(pwd)-cd ${orig_dir}--unset user verbose debug-. ${solr_root}/bin/scripts-util--# set up variables-prog=${0##*/}-log=${solr_root}/logs/snappuller.log--# define usage string-USAGE="\-usage: $prog [-u username] [-v] [-V]- -u specify user to sudo to before running script- -v increase verbosity- -V output debugging info-"--# parse args-while getopts u:vV OPTION-do- case $OPTION in- u)- user="$OPTARG"- ;;- v)- verbose="v"- ;;- V)- debug="V"- ;;- *)- echo "$USAGE"- exit 1- esac-done--[[ -n $debug ]] && set -x--fixUser "$@"--setStartTime--logMessage disabled by $oldwhoami-logMessage command: $0 $@-name=${solr_root}/logs/snappuller-enabled--if [[ -f ${name} ]]-then- rm -f ${name}-else- logMessage snappuller not currently enabled- logExit exited 1-fi--logExit ended 0diff --git a/solr/scripts/snappuller-enable b/solr/scripts/snappuller-enabledeleted file mode 100755index 7d842ba39f6..00000000000--- a/solr/scripts/snappuller-enable+++ /dev/null@@ -1,77 +0,0 @@-#!/bin/bash-#-# Licensed to the Apache Software Foundation (ASF) under one or more-# contributor license agreements. See the NOTICE file distributed with-# this work for additional information regarding copyright ownership.-# The ASF licenses this file to You under the Apache License, Version 2.0-# (the "License"); you may not use this file except in compliance with-# the License. You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.-#-# Shell script to enable snappuller--orig_dir=$(pwd)-cd ${0%/*}/..-solr_root=$(pwd)-cd ${orig_dir}--unset user verbose debug-. ${solr_root}/bin/scripts-util--# set up variables-prog=${0##*/}-log=${solr_root}/logs/snappuller.log--# define usage string-USAGE="\-usage: $prog [-u username] [-v] [-V]- -u specify user to sudo to before running script- -v increase verbosity- -V output debugging info-"--# parse args-while getopts u:vV OPTION-do- case $OPTION in- u)- user="$OPTARG"- ;;- v)- verbose="v"- ;;- V)- debug="V"- ;;- *)- echo "$USAGE"- exit 1- esac-done--[[ -n $debug ]] && set -x--fixUser "$@"--setStartTime--logMessage enabled by $oldwhoami-logMessage command: $0 $@-name=${solr_root}/logs/snappuller-enabled--if [[ -f ${name} ]]-then- logMessage snappuller already currently enabled- logExit exited 1-else- touch ${name}-fi--logExit ended 0diff --git a/solr/scripts/snapshooter b/solr/scripts/snapshooterdeleted file mode 100755index 2bf3ff1db4a..00000000000--- a/solr/scripts/snapshooter+++ /dev/null@@ -1,128 +0,0 @@-#!/bin/bash-#-# Licensed to the Apache Software Foundation (ASF) under one or more-# contributor license agreements. See the NOTICE file distributed with-# this work for additional information regarding copyright ownership.-# The ASF licenses this file to You under the Apache License, Version 2.0-# (the "License"); you may not use this file except in compliance with-# the License. You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.-#-# Shell script to take a snapshot of a Solr Lucene collection.--orig_dir=$(pwd)-cd ${0%/*}/..-solr_root=$(pwd)-cd ${orig_dir}--unset data_dir user verbose debug-. ${solr_root}/bin/scripts-util--# set up variables-prog=${0##*/}-log=${solr_root}/logs/${prog}.log--# define usage string-USAGE="\-usage: $prog [-d dir] [-u username] [-v] [-V] [-c]- -d specify directory holding index data- -u specify user to sudo to before running script- -v increase verbosity- -V output debugging info- -c only take snapshot if different than previous-"--# parse args-while getopts d:u:vVc OPTION-do- case $OPTION in- d)- data_dir="$OPTARG"- ;;- u)- user="$OPTARG"- ;;- v)- verbose="v"- ;;- V)- debug="V"- ;;- c)- check=1- ;;- *)- echo "$USAGE"- exit 1- esac-done--[[ -n $debug ]] && set -x--fixUser "$@"--dataDir--setStartTime--logMessage started by $oldwhoami-logMessage command: $0 $@--snap_name=snapshot.`date +"%Y%m%d%H%M%S"`-name=${data_dir}/${snap_name}-temp=${data_dir}/temp-${snap_name}--if [[ -d ${name} ]]-then- logMessage snapshot directory ${name} already exists- logExit aborted 1-fi--if [[ -d ${temp} ]]-then- logMessage snapshoting of ${name} in progress- logExit aborted 1-fi--if [[ ${check} ]]-then- previous=`find ${data_dir} -name snapshot.\* | sort -r | head -1`- if [[ -d ${previous} ]]- then- differences=`diff -q ${data_dir}/index ${previous} | wc -l`- if [[ ${differences} -lt 1 ]]- then- logMessage Snap would be same as last, exiting- logExit aborted 1- fi- fi-fi--# clean up after INT/TERM-trap 'echo cleaning up, please wait ...;/bin/rm -rf ${name} ${temp};logExit aborted 13' INT TERM--logMessage taking snapshot ${name}--# take a snapshot using hard links into temporary location-# then move it into place atomically-if [[ "${OS}" == "SunOS" || "${OS}" == "Darwin" || "${OS}" == "FreeBSD" ]]-then- orig_dir=$(pwd)- mkdir ${temp}- cd ${data_dir}/index- find . -print|cpio -pdlmu ${temp} 1>/dev/null 2>&1- cd ${orig_dir}-else- cp -lr ${data_dir}/index ${temp}-fi-mv ${temp} ${name}--logExit ended 0-