Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Purge old indexes from Sonatype Nexus

We're using Sonatype's Nexus 1.9.2.2 for proxying maven repositories. Our problem is that the indexes are eating so much disk space. All our repositories are taking about 25GB space, and growing.

For example, this directory has ~4GB of index files like this:

sonatype-work/nexus/storage/mvnsearch/.index/nexus-maven-repository-index.825.gz
sonatype-work/nexus/storage/mvnsearch/.index/nexus-maven-repository-index.826.gz
sonatype-work/nexus/storage/mvnsearch/.index/nexus-maven-repository-index.827.gz
sonatype-work/nexus/storage/mvnsearch/.index/nexus-maven-repository-index.828.gz
...

Is there any clean way of purging those files? For example using a scheduled task?

Thanks in advance!

like image 977
infinito Avatar asked Nov 03 '11 11:11

infinito


People also ask

How do I clean my Nexus repository?

Nexus Repository does not come with any built-in pre-configured cleanup policies. These are something you should define as best suits your individual environment. You can create and assign one or more cleanup policies to a repository under Administration → Repository Management.

How do I delete old artifacts from Nexus?

You have two options to get rid of artifacts which are not needed any more. First you can configure “cleanup policies”. Another approach is that you might want to set up a task which executes a custom Groovy script which deals with the removal of old artifacts.

What does Rebuild Index do nexus?

The Rebuild Index button allows you to drop and recreate the search index for the proxy repository, synchronizing the contents with search index.

How do I remove Docker images from Nexus?

But basically 1) find the tags you want to delete listing them with the docker v2 api as reported in your quesiton. 2) delete those tags using the nexus asset API 3) set a nexus task of type "Delete unused docker manifests and blobs" 4) following this task, run a "compact blobstore" task to actually regain the space.


1 Answers

We run the "optimize repository index" weekly and also run the "empty trash" task hourly.

I can tell you that storage isn't an issue for us for indexes. We have a ton of files in those .index directories, but they're all under 1K in size...even for our central proxy repo. Our total comes in ~1GB.

However, our repo is quite large. We've got a very large number of artifacts though. We're currently at almost 300GB in repository disk space.

like image 196
Michael Avatar answered Oct 07 '22 17:10

Michael