7.7. Maintenance tasks of Nexus:
When The instance that we run is experiencing issues with a lack of disk space and the inbuilt Nexus repository for artifacts is consuming a significant percentage of the disk, therefore we would like to try and clean up some of these artifacts. What would be the recommended method of cleaning up the artifacts which have been uploaded to the inbuilt artifact Nexus repository, deleting the files directly on the disk, or using Nexus itself to delete the artifacts? If we were to create scheduled tasks in this Nexus which removed artifacts which were uploaded.
How to create cleanup policy for artifacts uploaded to inbuilt Nexus repository:
Cleanup is a solution for removing components identified by format type. It allows you to select components of a single format, or you can select all to remove at once. To use the feature:
Click Create Cleanup Policy from the Repository submenu.
Name the policy and choose the format which is nothing but repository name that needs to cleanup
Then specify criteria to remove contents published before X days and downloaded before Y days.
Preview of the policies after created from the UI, too.
To Run above policy as a scheduled create task for this.
Click Create task from the Tasks under Repository submenu.
Name the task and choose the task frequency.
Then mention cron expression to run at particular time.
Preview looks like below:
Cleanup has a built-in scheduled task to execute the policies you create. You’ll need to run the task which deletes the binaries associated with the policy.
How to create compact blob store:
In order to physically delete the content from your blob store, you need to run Admin - Compact blob store. This task hard deletes repository data, returning space to your disk.
Click Create Blob stores from the Repository submenu.
Name the blob store and choose type of Quota, Quota limit in MB and mention the blob storage path.
To schedule this, create as a task which look like below:
When executed, all the tasks and policies will mark content for deletion from a blob store.
Share with your friends: |