如何备份 Nexus 存储库管理器
关系书: http://www.sonatype.com/books/nexus-book/参考/。 似乎没有花任何时间来讨论如何备份 Nexus 存储库。 如果我将快照和版本安装到此本地存储库中,似乎我有必要对其进行备份。 但是,我对备份任何可以轻松从远程存储库下载的内容并不真正感兴趣。
一些谷歌搜索似乎也没有揭示规范的答案,所以也许为了后代,它可以记录在这里。
谢谢, 内森
The nexus book: http://www.sonatype.com/books/nexus-book/reference/. Does not seem to spend any time on how one should go about backing up a nexus repository. If I am installing my snapshot and releases into this local repository, it seems that it would behoove me to back it up. However, I'm not really interested in backing up anything that can easily be downloaded from a remote repository.
Some google searches do not seem to reveal the canonical answer either, so perhaps for posterity it can be recorded here.
Thanks,
Nathan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

当您安装 Nexus 时,您最终会得到两个目录:
我们将应用程序与数据和配置分开。 Nexus 应用程序位于
nexus-webapp-1.3.1.1/
中,数据和配置位于sonatype-work/nexus
中。 这样做主要是为了方便升级,但它也有一个副作用,就是让备份 Nexus 安装变得非常容易。简单的答案
Nexus 不会在数据库中存储存储库,也不执行任何会妨碍在
sonatype-work/nexus
下对文件系统进行简单备份的操作。 如果您需要创建完整的备份,只需存档sonatype-work/nexus
的内容即可。更好的答案
如果您想要一种更智能的方法来备份 Nexus 安装,您肯定会想要备份
sonatype-work/nexus/conf
、sonatype 下的所有内容-work/nexus/storage
,sonatype-work/nexus/template-store
。 如果您想备份 Nexus 为代理存储库保留的元数据和文件属性,请备份sonatype-work/nexus/proxy
,但这不是必需的,因为有关代理存储库的信息将在-demand 作为属性的请求。您不需要备份
sonatype-work/nexus/logs
,也不需要备份sonatype-work/nexus/indexer
中的 Lucene 索引。Nexus Pro 答案
有一个 Nexus Professional 插件,可以自动执行创建 Nexus 配置数据备份的过程。 该插件将处理
sonatype-work/nexus/conf
目录的内容。 如果您需要备份sonatype-work/nexus/storage目录,您将需要配置一些备份系统来备份该文件系统的内容。 再次强调,与 Nexus Open Source 一样,目前备份sonatype-work/nexus/indexer
或sonatype-work/nexus/logs
的内容并没有真正的好处。 。排除远程存储库的存储
在您的问题中,您提到您想要排除专用于远程存储库的本地缓存的存储。 如果您有兴趣这样做,则必须采取进一步的粒度,并排除
sonatype-work/nexus/storage
下与远程存储库对应的目录。您需要关闭 Nexus 进行备份吗?
Brian Fox 告诉我不需要,文件争用的唯一真正机会是
indexer/
目录中的文件。 使用正在运行的 Nexus 实例备份 sonatype-work 文件系统应该不会有问题。顺便说一句,谢谢你的提问,这个答案可能会被纳入下一版本的 Nexus 书中。
When you install Nexus, you'll end up with two directories:
We've separated the application from the data and configuration. The Nexus application is in
nexus-webapp-1.3.1.1/
and the data and configuration is insonatype-work/nexus
. This was mainly done to facilitate easier upgrades, but it also has the side-effect of making it very easy to backup a Nexus installation.The Simple Answer
Nexus doesn't store repositories in a database or do anything that would preclude a simple backup of the file system under
sonatype-work/nexus
. If you need to create a complete backup, just archive the contents of thesonatype-work/nexus
.Better Answer
If you want a more intelligent approach to backing up a Nexus installation, you will certainly want to backup everything under
sonatype-work/nexus/conf
,sonatype-work/nexus/storage
,sonatype-work/nexus/template-store
. If you want to backup the metadata and file attributes that Nexus keeps for proxy repository, backupsonatype-work/nexus/proxy
, although this isn't required as the information about the proxy repository will be generated on-demand as attributes are requested.You don't need to backup
sonatype-work/nexus/logs
and you don't need to backup the Lucene indexes insonatype-work/nexus/indexer
.Nexus Pro Answer
There is a Nexus Professional plugin which can automate the process of creating a backup of the Nexus configuration data. This plugin is going to address the contents of the
sonatype-work/nexus/conf
directory. If you need to backup thesonatype-work/nexus/storage
directory, you will need to configure some backup system to backup the contents of that filesystem. Once again, as with Nexus Open Source, there is currently no real benefit in backing up the contents ofsonatype-work/nexus/indexer
orsonatype-work/nexus/logs
.Excluding Storage for Remote Repositories
In your question you mention that you want to exclude the storage devoted to the local cache of a remote repository. If you are interested in doing this, you'll have to take a further level of granularity and just exclude the directories under
sonatype-work/nexus/storage
that correspond to the remote repositories.Do you need to shut Nexus down for a backup?
Brian Fox told me no, the only real chance for file contention is going to be the files in the
indexer/
directory. You shouldn't have a problem backing up the sonatype-work filesystem with a running instance of Nexus.BTW, thanks for the question, this answer will likely be incorporated into the next version of the Nexus book.