yunyezhang-work opened a new pull request, #741:
URL: https://github.com/apache/ranger/pull/741

   ## What changes were proposed in this pull request?
   In big data production environments, customers create a massive number of 
policies, often reaching hundreds of thousands or even millions. Exporting the 
entire set of policies for disaster recovery would result in an enormous data 
volume and extremely slow import speeds into the backup cluster. Our current 
experimental data shows that importing 100,000 policies via the API is 
memory-intensive and time-consuming. 
   With an even larger number of policies, memory consumption will increase 
significantly, and insufficient memory can cause import interruptions. 
Therefore, we recommend modifying the API to allow for segmented export. This 
will save memory and ensure data reliability when importing to other clusters 
for disaster recovery.
   
   
   ## How was this patch tested?
   To manually test this feature, you can send an HTTP request to the ranger. 
Using a shell command as an example:
   
   Without the segmentation parameter, calling the export API 
`getPoliciesInJson` will export all policies. As shown in the figure, there are 
18 policies in this environment for hdfs-xxx.
   `curl -u$USER:$PASSWORD -XGET 
"http://$RANGER_HOST:$RANGER_PORT/service/plugins/policies/exportJson?serviceName=$SERVICE&checkPoliciesExists=true";
 -v -o export.json`
   
   Adding the segmentation parameter will export the policies for the specified 
start and end position range. As shown in the figure, policies 1-5 of hdfs-xxx 
are exported.
   `curl -u$USER:$PASSWORD -XGET 
"http://$RANGER_HOST:$RANGER_PORT/service/plugins/policies/exportJson?serviceName=$SERVICE&checkPoliciesExists=true&beginIndex=$BEGIN_INDEX&offsetIndex=$OFFSET_INDEX";
 -v -o export_${BEGIN_INDEX}_${OFFSET_INDEX}.json`
   <img width="1209" height="271" alt="image" 
src="https://github.com/user-attachments/assets/59af97c0-35be-441b-a471-5c8bc125b0f7";
 />
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to