Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get size of specific repository in Nexus 3

Tags:

How can I get a size of specific repository in Nexus 3?

For example, Artifactory shows the repository "size on disk" via UI.

Does Nexus have something similar? If not - how can I get this information by script?

like image 395
Ivan Avatar asked Jun 29 '17 05:06

Ivan


People also ask

How big of a file is Nexus?

Scarlet Nexus PS5 file size is 14.2 GB.

What is blob store in Nexus?

Nexus Blob is the storage place linked to repository where the repository data are saved. By default, nexus uses the local file system as the blob store. The sonartype-work directory holds the default blobs data.

How do I run cleanup policy on Nexus?

Cleanup Policies Login to nexus as an admin user. Go to Server Administration and Configuration. Go to Repository >> Cleanup Policies.

How much space does Nexus VST take?

Nexus on Windows The software takes about 20GB of disk space. Also take into account the need for storage of temporary and production data. A backup solution is strongly advised.


1 Answers

You can use admin task with groovy script nx-blob-repo-space-report.groovy from https://issues.sonatype.org/browse/NEXUS-14837 - for me turned out too slow

Or you can get it from database:

  1. login with user-owner nexus installation on nexus server (e.g. nexus)

  2. go to application directory (e.g. /opt/nexus):

    $ cd /opt/nexus

  3. run java orient console:

    $ java -jar ./lib/support/nexus-orient-console.jar

  4. connect to local database (e.g. /opt/sonatype-work/nexus3/db/component):

    > CONNECT PLOCAL:/opt/sonatype-work/nexus3/db/component admin admin

  5. find out repository row id in @RID column by repository_name value:

    > select * from bucket limit 50;

  6. get sum for all assets with repo row id found in the previous step:

    > select sum(size) from asset where bucket = #15:9;

result should be like (apparently in bytes):
+----+------------+ |# |sum | +----+------------+ |0 |224981921470| +----+------------+

nexus database connection steps took from https://support.sonatype.com/hc/en-us/articles/115002930827-Accessing-the-OrientDB-Console

another useful queries

summary size by repository name (instead 5 and 6 steps):

> select sum(size) from asset where bucket.repository_name = 'releases'; 

top 10 repositories by size:

> select bucket.repository_name as repository,sum(size) as bytes from asset group by bucket.repository_name order by bytes desc limit 10; 
like image 174
tmf glzkv Avatar answered Sep 20 '22 05:09

tmf glzkv