Importing and exporting resource-based policies

You can export and import policies from the Ranger Admin UI for cluster resiliency (backups), during recovery operations, or when moving policies from test clusters to production clusters. You can export/import a specific subset of policies (such as those that pertain to specific resources or user/groups) or clone the entire repository (or multiple repositories) via Ranger Admin UI.

Interfaces

You can import and export policies from Ranger > Admin Web UI > Service Manager > Resource:


You can also export policies from Ranger > Admin Web UI > Service Manager > Reports:


Table 1. Export Policy Options
Service Manager Page Reports Page
Formats JSON

JSON

Excel

CSV

Filtering Supported No Yes
Specific Service Export Yes Via filtering

Filtering

When exporting from the Reports page, you can apply filters before saving the file.

Export Formats

You can export policies in the following formats:
  • Excel

  • JSON

  • CSV

    Note: CSV format is not supported for importing policies.

When you export policies from the Service Manager page, the policies are automatically downloaded in JSON format. If you wish to export in Excel or CSV format, export the policies from the Reports page dropdown menu.

Required User Roles

The Ranger admin user can import and export only Resource & Tag based policies. The credentials for this user are set in Ranger Configs > Advanced ranger-env in the fields labeled admin_username (default: admin/admin).

The Ranger KMS keyadmin user can import and export only KMS policies. The default credentials for this user are keyadmin/keyadmin.

Limitations

To successfully import policies, use the following database versions:
  • MariaDB: 10.1.16+

  • MySQL: 5.6.x+

  • Oracle: 11gR2+

  • PostgreSQL: 8.4+

  • MS SQL: 2008 R2+

Partial import is not supported.