OSS版のNexusはPostgreSQLへのmigrationが出来ない
- 2025/04/08
はじめに
Nexus Repository ManagerのOSS版では、PostgreSQLへのデータベース移行がサポートされていないことが分かった。
以下に、試した際の手順と発生したエラーをまとめた。
前提条件
- Database Migrator Utility for 3.70.x をダウンロード
- https://help.sonatype.com/en/orientdb-downloads.html#database-migrator-utility-for-3-70-x
- 試したバージョン: 3.70.4
※移行対象のNexusと同一のバージョンを使用すること!!
移行手順
1. PostgreSQLの準備
Docker Compose設定
services:
postgres:
image: postgres:17.4
ports:
- 5432:5432
environment:
POSTGRES_USER: nexus
POSTGRES_PASSWORD: xxxx
volumes:
- postgres-data:/var/lib/postgresql/data
nexus:
depends_on:
postgres:
condition: service_started
image: sonatype/nexus3:3.70.4
ports:
- 8081:8081
volumes:
- nexus-data:/nexus-data
volumes:
postgres-data: null
nexus-data: null
2. Nexusの設定変更
nexus-store.propertiesの設定
username=nexus
password=xxx
jdbcUrl=jdbc\:postgresql\://postgres\:5432/nexus
所有者設定
chown 200:200 /var/lib/docker/volumes/nexus_nexus-data/_data/etc/fabric/nexus-store.properties
nexus.propertiesの設定
echo "nexus.datastore.enabled=true" >> /var/lib/docker/volumes/nexus_nexus-data/_data/etc/nexus.properties
3. バックアップの準備
mkdir /var/lib/docker/volumes/nexus_nexus-data/_data/_backup
chown 200:200 /var/lib/docker/volumes/nexus_nexus-data/_data/_backup
4. フルバックアップの取得
admin
でにログイン- 上部の歯車アイコンをクリック
- System > Tasks に移動
- Create task を選択
- Admin - Export Database for backup をクリックし、以下を設定する
- Task name: 任意
- Backup location:
/nexus-data/_backup
- Task frequency: Manual
- 作成したTaskを選択し、
Run
をクリックしてタスクを実行
5. 移行作業の実行
移行用コンテナの準備
java:
image: openjdk:11-ea-jdk
restart: unless-stopped
command: tail -f /dev/null
volumes:
- /var/lib/docker/volumes/nexus_nexus-data/_data/_backup:/work
移行コマンドの実行
java -Xmx16G -Xms16G -XX:+UseG1GC -XX:MaxDirectMemorySize=28672M -jar nexus-db-migrator-3.70.4-02.jar --migration_type=postgres --db_url="jdbc:postgresql://postgres:5432/nexus?user=nexus&password=xxx" --add-exports java.base/sun.nio.ch=ALL-UNNAMED
結果
上記のコマンドを実行した際、以下のエラーが発生した:
~省略~
17:14:46 [main] INFO c.s.n.d.m.l.ProvidingJobInfoListener - ------------------------------------------------------------
17:14:46 [main] INFO c.s.n.d.m.l.ProvidingJobInfoListener - Migration job finished with status FAILED.
17:14:46 [main] INFO c.s.n.d.m.l.ProvidingJobInfoListener - Detailed message: com.sonatype.nexus.db.migrator.exception.WrongNxrmEditionException: Migration to an external database requires Nexus Repository Manager Pro and is not supported for Nexus Repository Manager OSS instances.
17:14:46 [main] INFO c.s.n.d.m.l.ProvidingJobInfoListener - ------------------------------------------------------------
結論
- OSS版のNexus Repository Managerでは、PostgreSQLへのデータベース移行はサポートされてない
- 3.70.x系ではH2データベースのみへ移行可能
- PostgreSQLへの移行には、Nexus Repository Manager Proライセンスが必要
参考リンク
Migrating From OrientDB to PostgreSQL
https://help.sonatype.com/en/upgrading-to-nexus-repository-3-71-0-and-beyond.html#migrating-from-orientdb-to-postgresql-252162
Do I have to buy a Pro license to upgrade to version 3.71.0+?
https://help.sonatype.com/en/upgrading-to-nexus-repository-3-71-0-and-beyond.html#UUID-7dff2da7-6b31-f525-7a91-a22de4fbd74e_bridgehead-idm234557900890996