Community Articles

Find and share helpful community-sourced technical articles.
Labels (2)
avatar
Contributor

Below steps are for taking backup of ranger audits and then restore them back to new collection which will be using updated manage-schema fix given in RANGER-1938.

Note: Steps are only for Solr version 5.x and Ranger service managed by Ambari.


1) Backup existing ranger_audits collection:

curl -X GET "http://${SOLR_HOST}:${SOLR_PORT}/solr/ranger_audits/replication?command=backup&location=/tmp"

2) Download existing managed-schema from Zookeeper:

/usr/lib/ambari-infra-solr/server/scripts/cloud-scripts/zkcli.sh --zkhost "${ZK_HOST}:${ZK_PORT}/${SOLR_ZNODE}" -cmd getfile /configs/ranger_audits/managed-schema /tmp/managed-schema

3) Upload updated managed-schema given here to Zookeeper:

/usr/lib/ambari-infra-solr/server/scripts/cloud-scripts/zkcli.sh --zkhost "${ZK_HOST}:${ZK_PORT}/${SOLR_ZNODE}" -cmd putfile /configs/ranger_audits/managed-schema managed-schema

4) Delete existing ranger_audits collection:

curl -i "http://${SOLR_HOST}:${SOLR_PORT}/solr/admin/collections?action=DELETE&name=ranger_audits"

5) Update max retention days(ranger_audit_max_retention_days) config value in Advanced ranger-solr-configuration to 21 and Restart Ranger Service.

6) Restore ranger_audits collection backup to newly created collection:

curl -X POST "http://${SOLR_HOST}:${SOLR_PORT}/solr/ranger_audits/replication?command=restore&location=/tmp"

7) To check the status of restore:

curl http://${SOLR_HOST}:${SOLR_PORT}/solr/ranger_audits/replication?command=restorestatus
3,601 Views
Comments
avatar
Contributor

@mvaradkar Very good article :). Can you also check the code which might not work when kerberos authentication is enable for infra-solr.