Skip to content

Instantly share code, notes, and snippets.

@hi-ko
Last active January 3, 2024 15:36
Show Gist options
  • Save hi-ko/98be62cce20e7178c0e8b64980275cee to your computer and use it in GitHub Desktop.
Save hi-ko/98be62cce20e7178c0e8b64980275cee to your computer and use it in GitHub Desktop.
SOLR_CONTEXT="https://${SOLR_TOMCAT_HOST}:${SOLR_TOMCAT_PORT}/${SOLR_TOMCAT_CONTEXT}"
REPO_CERT=$SSL_BASE/certs/client.pem
CURL_PARAMS=( -k -s --cert "$REPO_CERT":"$REPO_CERT_PW" )
# get indexing status
curl "${CURL_PARAMS[@]}" "$SOLR_CONTEXT/admin/cores?action=SUMMARY&wt=json" |jq -r '.Summary | keys_unsorted[] as $k | "\($k), \(.[$k]."TX Duration"), \(.[$k]."Id for last TX in index")/\(.[$k]."Id for last TX on server") tx, \(.[$k]."On disk (GB)") GB, \(.[$k]."Approx transaction indexing time remaining")"'
# Show numDocs,maxDoc and deletedDocs for each Alfresco core
curl "${CURL_PARAMS[@]}" "$SOLR_CONTEXT/admin/cores?action=SUMMARY&wt=json"| \
jq '.Summary[].Searcher' | jq -r '"\(.searcherName),\(.numDocs),\(.maxDoc),\(.deletedDocs)"'
# Check SOLR nodes errors in alfresco and archive core
curl "${CURL_PARAMS[@]}" "$SOLR_CONTEXT/alfresco/afts?q=DOC_TYPE:ErrorNode&wt=json" | jq '.response.docs[].DBID'
curl "${CURL_PARAMS[@]}" "$SOLR_CONTEXT/archive/afts?q=DOC_TYPE:ErrorNode&wt=json" | jq '.response.docs[].DBID'
# https://docs.alfresco.com/5.2/concepts/solr-index-fix.html
CORE='&core=alfresco' # alfresco|archive
# repair an unindexed or failed transaction identified by the REPORT option in the Unindexed Solr Transactions section
curl "${CURL_PARAMS[@]}" "$SOLR_CONTEXT/admin/cores?action=FIX&wt=json"
# reindex a transaction, acl transactions, nodes and acls.
# &txid=1&acltxid=2&nodeid=3&aclid=4
curl "${CURL_PARAMS[@]}" "$SOLR_CONTEXT/admin/cores?action=REINDEX&nodeid=3&wt=json"
# retry indexing any node that failed to index and was skipped and and appear in the solr report
curl "${CURL_PARAMS[@]}" "$SOLR_CONTEXT/admin/cores?action=RETRY$CORE&wt=json"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment