Skip to content

Commit 34fedac

Browse files
committed
Improved (?) restore.sh.
1 parent 1e77a91 commit 34fedac

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

solr-restore/restore.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,20 @@ echo "SOLR is up and running at ${SOLR_SERVER}."
3434
# Step 2. Create fields for search.
3535
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
3636
source "$SCRIPT_DIR/../data-loading/setup_solr.sh"
37+
echo Solr database has been set up.
3738

3839
# Step 3. Restore the data
3940
CORE_NAME="${COLLECTION_NAME}_shard1_replica_n1"
41+
echo "Starting Solr restore on core ${CORE_NAME}, with status at ${SOLR_SERVER}/solr/${CORE_NAME}/replication?command=restorestatus"
4042
RESTORE_URL="${SOLR_SERVER}/solr/${CORE_NAME}/replication?command=restore&location=/var/solr/data/var/solr/data/&name=${BACKUP_NAME}"
4143
wget -O - "$RESTORE_URL"
4244
sleep 10
43-
RESTORE_STATUS=$(wget -q -O - ${SOLR_SERVER}/solr/${CORE_NAME}/replication?command=restorestatus 2>&1 | grep "success") >&2
45+
RESTORE_STATUS_URL="${SOLR_SERVER}/solr/${CORE_NAME}/replication?command=restorestatus"
46+
RESTORE_STATUS=$(wget -q -O - "$RESTORE_STATUS_URL" 2>&1 | grep "success") >&2
4447
echo "Restore status: ${RESTORE_STATUS}"
45-
until [ ! -z "$RESTORE_STATUS" ] ; do
46-
echo "Solr restore in progress. Note: if this takes too long please check solr health."
47-
RESTORE_STATUS=$(wget -O - ${SOLR_SERVER}/solr/${CORE_NAME}/replication?command=restorestatus 2>&1 | grep "success") >&2
48+
until [ -n "$RESTORE_STATUS" ] ; do
49+
echo "Solr restore in progress. Note: if this takes too long please check Solr health."
50+
RESTORE_STATUS=$(wget -O - "$RESTORE_STATUS_URL" 2>&1 | grep "success") >&2
4851
sleep 10
4952
done
5053
echo "Solr restore complete"

0 commit comments

Comments
 (0)