<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Is there a way to export ranger policies from cluster1 and import into cluster? in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-export-ranger-policies-from-cluster1-and/m-p/108885#M16091</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/113/jstraub.html" nodeid="113"&gt;@Jonas Straub&lt;/A&gt;, &lt;A rel="user" href="https://community.cloudera.com/users/140/nsabharwal.html" nodeid="140"&gt;@Neeraj Sabharwal&lt;/A&gt;, &lt;A rel="user" href="https://community.cloudera.com/users/2648/sshimpi.html" nodeid="2648"&gt;@Sagar Shimpi&lt;/A&gt; : Guys, using this I could export the entire policy repository using : &lt;/P&gt;&lt;PRE&gt;&amp;lt;Ranger_Host:IP&amp;gt;/service/public/api/policy &lt;/PRE&gt;&lt;P&gt;and also using &lt;/P&gt;&lt;PRE&gt;&lt;A href="http://&amp;lt;ranger_address&amp;gt;:6080/service/plugins/policies/download/&amp;lt;clustername&amp;gt;_hadoop" target="_blank"&gt;http://&amp;lt;ranger_address&amp;gt;:6080/service/plugins/policies/download/&amp;lt;clustername&amp;gt;_hadoop&lt;/A&gt;&lt;/PRE&gt;&lt;P&gt;I went through the link shared which talks about exporting policies one by one. Is there a way to export entire repository instead of exporting policies one after another?&lt;/P&gt;</description>
    <pubDate>Thu, 02 Jun 2016 16:56:15 GMT</pubDate>
    <dc:creator>smartninja723</dc:creator>
    <dc:date>2016-06-02T16:56:15Z</dc:date>
    <item>
      <title>Is there a way to export ranger policies from cluster1 and import into cluster?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-export-ranger-policies-from-cluster1-and/m-p/108881#M16087</link>
      <description />
      <pubDate>Sat, 23 Jan 2016 12:57:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-export-ranger-policies-from-cluster1-and/m-p/108881#M16087</guid>
      <dc:creator>nsabharwal</dc:creator>
      <dc:date>2016-01-23T12:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to export ranger policies from cluster1 and import into cluster?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-export-ranger-policies-from-cluster1-and/m-p/108882#M16088</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/140/nsabharwal.html" nodeid="140"&gt;@Neeraj Sabharwal&lt;/A&gt; Yes, but I am afraid not without a little bit of additional work. Maybe copying the database and adjusting some values like repo id, ranger address, etc. is an alternative to look into (not recommended though!). Here is the API-way &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You can access all policies of a repository (e.g. hdfs/hadoop) by using: &lt;/P&gt;&lt;PRE&gt;&lt;A href="http://&amp;lt;ranger_address&amp;gt;:6080/service/plugins/policies/download/&amp;lt;clustername&amp;gt;_hadoop" target="_blank"&gt;http://&amp;lt;ranger_address&amp;gt;:6080/service/plugins/policies/download/&amp;lt;clustername&amp;gt;_hadoop&lt;/A&gt;&lt;/PRE&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;PRE&gt;curl -ivk -H "Content-type:application/json" -u &amp;lt;user&amp;gt;:&amp;lt;password&amp;gt; &lt;A href="http://&amp;lt;ranger_address&amp;gt;:6080/service/plugins/policies/download/bigdata_hadoop" target="_blank"&gt;http://&amp;lt;ranger_address&amp;gt;:6080/service/plugins/policies/download/bigdata_hadoop&lt;/A&gt;&lt;/PRE&gt;&lt;P&gt;This will return:&lt;/P&gt;&lt;PRE&gt;{
   "serviceName":"bigdata_hadoop",
   "serviceId":1,
   "policyVersion":23,
   "policyUpdateTime":1450245444000,
   "policies":[
      {
         "id":2,
         "guid":"1448089401967_197_71",
         "isEnabled":true,
         "createdBy":"Admin",
         "updatedBy":"Admin",
         "createTime":1448118201000,
         "updateTime":1449582864000,
         "version":5,
         "service":"bigdata_hadoop",
         "name":"Ranger_audits",
         "description":"",
         "resourceSignature":"6dbd7c49e533baa8082b48895acabf20",
         "isAuditEnabled":false,
         "resources":{
            "path":{
               "isRecursive":true,
               "values":[
                  "/apps/solr/ranger_audits"
               ],
               "isExcludes":false
            }
         },
         "policyItems":[
            {
               "users":[
                  "solr"
               ],
               "groups":[


               ],
               "delegateAdmin":false,
               "accesses":[
                  {
                     "isAllowed":true,
                     "type":"read"
                  },
                  {
                     "isAllowed":true,
                     "type":"write"
                  },
                  {
                     "isAllowed":true,
                     "type":"execute"
                  }
               ],
               "conditions":[


               ]
            }
         ]
      },
      {
         ...
	 ...
      }
      ...
   ],
   ...
   ...
   ...
}
&lt;/PRE&gt;&lt;P&gt;After downloading all policies of a repo you can use the Rest calls I mentioned here =&amp;gt; &lt;A target="_blank" href="https://community.hortonworks.com/questions/10826/rest-api-url-to-configure-ranger-objects.html"&gt;https://community.hortonworks.com/questions/10826/rest-api-url-to-configure-ranger-objects.html&lt;/A&gt; to recreate the policies in your other cluster.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Note: Make sure the users from Cluster1 are available in Cluster2 as well, otherwise Ranger will throw an exception when you create a policy for a user that doesn't exist.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Thats it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Jan 2016 15:52:19 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-export-ranger-policies-from-cluster1-and/m-p/108882#M16088</guid>
      <dc:creator>jstraub</dc:creator>
      <dc:date>2016-01-23T15:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to export ranger policies from cluster1 and import into cluster?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-export-ranger-policies-from-cluster1-and/m-p/108883#M16089</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/113/jstraub.html" nodeid="113"&gt;@Jonas Straub&lt;/A&gt;  Very nice!  Thank you for sharing this. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Jan 2016 19:54:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-export-ranger-policies-from-cluster1-and/m-p/108883#M16089</guid>
      <dc:creator>nsabharwal</dc:creator>
      <dc:date>2016-01-23T19:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to export ranger policies from cluster1 and import into cluster?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-export-ranger-policies-from-cluster1-and/m-p/108884#M16090</link>
      <description>&lt;P&gt;Our latest tutorial on ranger walls you through importing a policy with rest &lt;A rel="user" href="https://community.cloudera.com/users/140/nsabharwal.html" nodeid="140"&gt;@Neeraj Sabharwal&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Jan 2016 20:34:19 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-export-ranger-policies-from-cluster1-and/m-p/108884#M16090</guid>
      <dc:creator>aervits</dc:creator>
      <dc:date>2016-01-23T20:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to export ranger policies from cluster1 and import into cluster?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-export-ranger-policies-from-cluster1-and/m-p/108885#M16091</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/113/jstraub.html" nodeid="113"&gt;@Jonas Straub&lt;/A&gt;, &lt;A rel="user" href="https://community.cloudera.com/users/140/nsabharwal.html" nodeid="140"&gt;@Neeraj Sabharwal&lt;/A&gt;, &lt;A rel="user" href="https://community.cloudera.com/users/2648/sshimpi.html" nodeid="2648"&gt;@Sagar Shimpi&lt;/A&gt; : Guys, using this I could export the entire policy repository using : &lt;/P&gt;&lt;PRE&gt;&amp;lt;Ranger_Host:IP&amp;gt;/service/public/api/policy &lt;/PRE&gt;&lt;P&gt;and also using &lt;/P&gt;&lt;PRE&gt;&lt;A href="http://&amp;lt;ranger_address&amp;gt;:6080/service/plugins/policies/download/&amp;lt;clustername&amp;gt;_hadoop" target="_blank"&gt;http://&amp;lt;ranger_address&amp;gt;:6080/service/plugins/policies/download/&amp;lt;clustername&amp;gt;_hadoop&lt;/A&gt;&lt;/PRE&gt;&lt;P&gt;I went through the link shared which talks about exporting policies one by one. Is there a way to export entire repository instead of exporting policies one after another?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2016 16:56:15 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-export-ranger-policies-from-cluster1-and/m-p/108885#M16091</guid>
      <dc:creator>smartninja723</dc:creator>
      <dc:date>2016-06-02T16:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to export ranger policies from cluster1 and import into cluster?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-export-ranger-policies-from-cluster1-and/m-p/108886#M16092</link>
      <description>&lt;P&gt;I have used above API calls and executed on my cluster it worked below is the procedure I have followed for one hdfs service and one policy.&lt;/P&gt;&lt;P&gt;Objective:&lt;/P&gt;&lt;P&gt;Export ranger policies from cluster1 to cluster2&lt;/P&gt;&lt;P&gt;variables:
&amp;lt;clustername&amp;gt;=DEVLHDP
&amp;lt;policy_name&amp;gt;=&amp;lt;clustername&amp;gt;_hadoop-1-20160615193010&lt;/P&gt;&lt;P&gt;To download all policies from cluster1 &lt;/P&gt;&lt;PRE&gt;&lt;A href="http://ranger1:6080/service/plugins/policies/download/&amp;lt;clustername&amp;gt;_hadoop" target="_blank"&gt;http://ranger1:6080/service/plugins/policies/download/&amp;lt;clustername&amp;gt;_hadoop&lt;/A&gt;&lt;/PRE&gt;&lt;P&gt;get service from cluster1 ranger1&lt;/P&gt;&lt;PRE&gt;curl -iv -u admin:xxxx -H "Content-type:application/json" -X GET &lt;A href="http://ranger1:6080/service/public/v2/api/service/name/&amp;lt;clustername&amp;gt;_hadoop" target="_blank"&gt;http://ranger1:6080/service/public/v2/api/service/name/&amp;lt;clustername&amp;gt;_hadoop&lt;/A&gt;&lt;/PRE&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;copy the json output to ranger-service.json&lt;/P&gt;&lt;P&gt;create service in new cluster2 ranger2&lt;/P&gt;&lt;PRE&gt;curl -iv -u admin:xxxxx -d @ranger-service.json -H "Content-Type: application/json" -X POST &lt;A href="http://ranger2:6080/service/public/v2/api/service" target="_blank"&gt;http://ranger2:6080/service/public/v2/api/service&lt;/A&gt;&lt;/PRE&gt;&lt;P&gt;Getting a sample policy from cluster1 ranger1&lt;/P&gt;&lt;PRE&gt;curl -iv -u admin:xxxxx -H "Content-type:application/json" -X GET &lt;A href="http://ranger1:6080/service/public/v2/api/service/&amp;lt;clustername&amp;gt;_hadoop/policy/&amp;lt;clustername&amp;gt;_hadoop-1-20160615193010" target="_blank"&gt;http://ranger1:6080/service/public/v2/api/service/&amp;lt;clustername&amp;gt;_hadoop/policy/&amp;lt;clustername&amp;gt;_hadoop-1-20160615193010&lt;/A&gt;&lt;/PRE&gt;&lt;P&gt;copy the json output to ranger_policy.json&lt;/P&gt;&lt;P&gt;create policy in new cluster2 ranger2&lt;/P&gt;&lt;PRE&gt;curl -iv -u admin:xxxxx -d @ranger_policy.json -H "Content-Type: application/json" -X POST &lt;A href="http://ranger2:6080/service/public/v2/api/policy" target="_blank"&gt;http://ranger2:6080/service/public/v2/api/policy&lt;/A&gt;&lt;/PRE&gt;&lt;P&gt;Tested in HDP 2.4.2 which has Apache Ranger 0.5.2&lt;/P&gt;&lt;P&gt;Ref:&lt;/P&gt;&lt;P&gt;&lt;A href="https://issues.apache.org/jira/browse/RANGER-1214" target="_blank"&gt;https://issues.apache.org/jira/browse/RANGER-1214&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If this helped, pls vote/accept answer.&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;TABLE&gt;&lt;TBODY&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Sat, 28 Jan 2017 01:01:15 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-export-ranger-policies-from-cluster1-and/m-p/108886#M16092</guid>
      <dc:creator>Arun-</dc:creator>
      <dc:date>2017-01-28T01:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to export ranger policies from cluster1 and import into cluster?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-export-ranger-policies-from-cluster1-and/m-p/108887#M16093</link>
      <description>&lt;P&gt;&lt;A href="http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.4.2/bk_Security_Guide/content/ranger_rest_api_create_policy.html" target="_blank"&gt;http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.4.2/bk_Security_Guide/content/ranger_rest_api_create_policy.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Feb 2017 03:49:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-export-ranger-policies-from-cluster1-and/m-p/108887#M16093</guid>
      <dc:creator>Arun-</dc:creator>
      <dc:date>2017-02-04T03:49:43Z</dc:date>
    </item>
  </channel>
</rss>

