Skip to main content

Data Store

Note

Only available in Sonatype Nexus Repository Pro. Interested in a free trial? Start here.

Tip

Sonatype Nexus Repository Pro users that have migrated away from the default OrientDB database can determine their current database by checking the JDBC URL displayed on the Data Store configuration screen:

  • If the JDBC URL references H2, then you are using an H2 database.

  • If the JDBC URL does not reference H2, then you are using a PostgreSQL database.

If you are a Sonatype Nexus Repository Pro customer and have not migrated from the default OrientDB database, you will not see the Data Store option.

If you are using Sonatype Nexus Repository OSS, you will not see the Data Store option and will be using the default OrientDB database as no other database options are available for OSS deployments.

Administrators using Nexus Repository Pro will see a Data Store option in the user interface at Administration → Repository → Data Store. This screen contains information about your H2 or PostgreSQL database connection.

Configuring Database Connection

Note

If you are using a PostgreSQL database, please see PostgreSQL Configuration Options and Priority Order before making any changes via the UI.

Data store screen with JDBC URL, Username, Schema, Maximum Connection Pool Size, and Advanced Settings fields

The Data Store screen contains the following information:

  • JDBC URL (read-only) - URL for connecting to your database.

  • Username (read-only) - This will be populated for PostgreSQL only.

  • Schema (read-only) - This will be populated for PostgreSQL only.

  • Maximum Connection Pool Size (optional) - The maximum number of connections that can be created to meet client requests. For H2, this defaults to 10; for PostgreSQL, this defaults to 100.

    Note

    Note that, for high availability deployments, you must increase the number of connections that PostgreSQL allows so that your Maximum Connection Pool size does not exceed your the maximum number of allowed connections. See Prerequisite Step: Adjust max_connections.

    • Large deployments with a lot of traffic may need to increase their Maximum Connection Pool Size.

  • Advanced Settings (optional) - This field is used for troubleshooting and accepts JDBC parameters (e.g.,maxLifetime=840000). Leave this section blank unless provided specific instruction by the Sonatype Product Support Team.

    To set multiple advanced settings in the UI, separate each value onto a separate line:

    maxLifetime=840000
    maximumPoolSize=200

    These values will be written to the nexus-store.properties file as advanced settings. A single value will look similar to the following:

    advanced=maxLifetime\=840000

    Multiple values will be delimited by "\n" as shown in the following example:

    advanced=maximumPoolSize\=200\nmaxLifetime\=840000

    Because Sonatype Nexus Repository honors the maximumPoolSize value before considering the advanced=maximumPoolSize value, if you've configured maximumPoolSize in some other way, this value will be used instead of what you've configured under the advanced setting.

PostgreSQL Configuration Options and Priority Order

Database Connection Configuration

Note

As of release 3.53.0, you must provide database connection details through one mechanism. Changes made through environment variables and system properties are not written to the nexus-store.properties file

You can configure PostgreSQL database connection details (JDBC URL, username, password) through environment variables, system properties, or the nexus-store.properties file. See Configuring Nexus Repository Pro for H2 or PostgreSQL for full details on these configuration methods.

Changes made through the Data Store UI are persisted to the nexus-store.properties file; Sonatype Nexus Repository will only use the values defined in the nexus-store.properties file if you've not used environment variables or system properties.

Sonatype Nexus Repository will use the first of the following mechanisms that it encounters and will ignore the others:

  1. Environment variables

  2. System Properties (through JVM arguments or in the nexus.properties file as detailed in Configuring Nexus Repository Pro for H2 or PostgreSQL)

  3. sonatype-work/nexus3/etc/fabric/nexus-store.properties

This is evaluated each time you start Sonatype Nexus Repository.

Connection Pool Size

You can only configure connection pool size through the sonatype-work/nexus3/etc/fabric/nexus-store.properties file.

This is done via two settings in the following priority order:

  1. maximumPoolSize=N

  2. advanced=maximumPoolSize=N

If you set maximumPoolSize, it will take precedence over the advanced setting.