Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st. We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here. Need help or have questions? Drop us a line at [email protected]
Created on 07-29-202212:52 AM - edited on 04-21-202612:51 AM by GrazittiAPI
Introduction
Apache Ranger delivers a comprehensive approach to security for a Hadoop cluster. It provides a centralised platform to define, administer and manage security policies consistently across Hadoop components.
This article focuses on Export and Import of Ranger policies using API calls during HDP to CDP migration.
Export
List of Services configured in Ranger
### Command to get list of services
curl -s -u admin:pass -H "Accept: application/json" -H "Content-Type: application/json" -X GET "http://<hostname>:<ranger-port>/service/public/v2/api/service" > services.json
Export of Policies
### Export all policies
To export all policies
curl -X GET --header "text/json" -H "Content-Type: text/json" -o file.json -u admin:admin "http://<hostname>:<ranger-port>/service/plugins/policies/exportJson"
This exported json file.json contains all policies including Tag based policies
Export of users and Groups, which can be used for validation purposes.
## Api call to download all Users from Ranger
curl -s -u admin:pass -H "Accept: application/json" -H "Content-Type: application/json" -X GET "https://ranger.com/service/xusers/users" > users.json
## Api call to download all groups from Ranger
curl -s -u admin:pass -H "Accept: application/json" -H "Content-Type: application/json" -X GET "https://ranger.com/service/xusers/groups" > groups.json
Import
Importing policies into Target CDP cluster
Step 1: Prepare the Ranger service and make sure to configure all service plugins.
Step 2: Prepare servicemapping.json file which has mapping of Ranger service from HDP to CDP world