Community Articles

Find and share helpful community-sourced technical articles.
Announcements
Now Live: Explore expert insights and technical deep dives on the new Cloudera Community BlogsRead the Announcement
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
4,117 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.

Version history
Last update:
‎01-03-2018 07:11 AM
Updated by:
Contributors