Nexus迁移与密码重置

本文档详细介绍了Nexus仓库的迁移步骤,包括停服务、备份、上传覆盖、密码重置以及启动新服务等操作。在密码重置过程中,通过OrientDB console连接并更新了管理员密码。此外,还提供了登陆页面的URL以及如何修改环境变量、用户配置、JAVA设置、端口和日志设置的说明。

旧仓库停服务

bin/nexus stop

 

旧仓库备份

tar -czvf sonatype-work.tgz sonatype-work

 

新仓库上传备份文件并覆盖

alias cp='cp'
cp -rf temp/sonatype-work .

 

重置密码

java -jar ./lib/support/nexus-orient-console.jar
connect plocal:../sonatype-work/nexus3/db/security admin admin
update user SET password="$shiro1$SHA-512$1024$NE+wqQq/TmjZMvfI7ENh/g==$V4yPw8T64UQ6GfJfxYq2hLsVrBY8D1v+bktfOxGdt4b/9BthpWPNUy/CBk6V9iA0nHpzYzJFWO8v/tZFtES8CA==" UPSERT WHERE id="admin"

OrientDB console v.2.2.36 (build d3beb772c02098ceaea89779a7afd4b7305d3788, branch 2.2.x) https://www.orientdb.com
Type 'help' to display all the supported commands.
orientdb> connect plocal:../sonatype-work/nexus3/db/security admin admin

Connecting to database [plocal:../sonatype-work/nexus3/db/security] with user 'admin'...
2020-04-21 17:07:05:546 WARNI {db=security} Storage 'security' was not closed properly. Will try to recover from write ahead log... [OLocalPaginatedStorage]
2020-04-21 17:07:05:550 WARNI {db=security} Record com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OFuzzyCheckpointEndRecord{lsn=LSN{segment=11, position=1459360}} will be skipped during data restore [OLocalPaginatedStorage]
2020-04-21 17:07:05:550 WARNI {db=security} Record OFuzzyCheckpointStartRecord{lsn=LSN{segment=11, position=1459367}} com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OFuzzyCheckpointStartRecord{lsn=null, previousCheckpoint=LSN{segment=11, position=1459320}} will be skipped during data restore [OLocalPaginatedStorage]
2020-04-21 17:07:05:551 WARNI {db=security} Record com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OFuzzyCheckpointEndRecord{lsn=LSN{segment=11, position=1459407}} will be skipped during data restore [OLocalPaginatedStorage]OK
orientdb {db=security}> update user SET password="$shiro1$SHA-512$1024$NE+wqQq/TmjZMvfI7ENh/g==$V4yPw8T64UQ6GfJfxYq2hLsVrBY8D1v+bk
tfOxGdt4b/9BthpWPNUy/CBk6V9iA0nHpzYzJFWO8v/tZFtES8CA==" UPSERT WHERE id="admin"

Updated record(s) '1' in 0.022000 sec(s).

orientdb {db=security}> quit    

 

启动新仓库服务

bin/nexus start

 

登陆页面

https://127.0.0.1:8081/


修改环境变量

# nexus
export RUN_AS_USER=root
export PATH=$PATH:$RUN_AS_USER

修改用户:nexus-3.22.1-02/bin/nexus.rc 

run_as_user="root"

修改JAVA:nexus-3.22.1-02/bin/nexus

INSTALL4J_JAVA_HOME_OVERRIDE=/usr/local/java

修改端口:nexus-3.22.1-02/etc/nexus-default.properties

application-port=8081

修改日志: nexus-3.22.1-02/bin/nexus.vmoptions

-XX:LogFile=../sonatype-work/nexus3/log/jvm.log

 

### Nexus 迁移指南及版本升级、服务器变更 Nexus 是一个广泛使用的仓库管理工具,其迁移过程涉及数据备份、版本升级以及服务器变更等多个方面。以下是关于 Nexus 迁移的详细说明: #### 1. 数据备份 在进行任何迁移操作之前,确保对现有 Nexus 实例的数据进行完整备份。这可以通过以下方式实现: - 使用 Nexus 自带的备份功能导出数据[^2]。 - 确保备份文件存储在安全位置,并验证备份文件的完整性。 ```bash # 备份命令示例(根据实际情况调整路径) nexus backup /path/to/backup/directory ``` #### 2. 版本升级 Nexus 的版本升级需要遵循官方文档中的指导,确保兼容性和稳定性: - **检查兼容性**:确认目标版本当前环境的兼容性,包括操作系统、数据库和插件等[^2]。 - **停止服务**:在升级前停止 Nexus 服务以避免数据损坏。 - **执行升级**:下载目标版本的安装包并替换现有安装文件。 - **验证升级**:启动 Nexus 服务后,检查日志文件以确保没有错误发生。 ```bash # 停止 Nexus 服务 systemctl stop nexus # 替换安装文件 cp nexus-latest-bundle.tar.gz /opt/nexus/ tar -xvzf nexus-latest-bundle.tar.gz # 启动 Nexus 服务 systemctl start nexus ``` #### 3. 服务器变更 当需要将 Nexus 从一个服务器迁移到另一个服务器时,需注意以下关键点: - **复制数据目录**:将源服务器上的 `sonatype-work` 目录完整复制到目标服务器。 - **配置文件同步**:确保目标服务器上的 `settings.xml` 文件源服务器一致。 - **网络配置**:更新 DNS 或负载均衡器配置,确保客户端能够正确访问新的 Nexus 实例。 ```bash # 复制数据目录 rsync -avz /path/to/source/sonatype-work/ user@target-server:/path/to/target/sonatype-work/ # 检查 settings.xml 配置 vim /home/UserName/.m2/settings.xml ``` #### 4. 测试验证 完成迁移后,进行全面测试以确保新环境正常运行: - **用户权限**:验证所有用户的访问权限是否正确。 - **仓库可用性**:检查所有仓库是否可访问且数据完整。 - **构建工具集成**:确保 Maven、Gradle 等工具能够正常连接到新的 Nexus 实例。 --- ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值