搜索

此内容没有您所选择的语言版本。

Chapter 1. Migrating your data

download PDF
Use Red Hat JBoss Data Virtualization's backup and restore functionality to migrate the data stored in your hierarchical database. Each backup you create will contain all of the content for all of the workspaces in a single repository. Therefore, you will need to back up and restore each of your repositories one by one.
The backup and restore functionality is provided by the org.modeshape.jcr.api.RepositoryManager interface:
public interface RepositoryManager {

    ...

    Problems backupRepository( File backupDirectory ) throws RepositoryException;

    ...

    Problems restoreRepository( File backupDirectory ) throws RepositoryException;

    ...

}
Run this code in an Apache Jackrabbit (JCR) session in any workspace to access the repository manager:
javax.jcr.Repository repository = ...
javax.jcr.Credentials credentials = ...
String workspaceName = ...
javax.jcr.Session session = repository.login(credentials,workspaceName);
org.modeshape.jcr.api.Session msSession = (org.modeshape.jcr.api.Session)session;
org.modeshape.jcr.api.RepositoryManager repoMgr = ((org.modeshape.jcr.api.Session)session).getWorkspace().getRepositoryManager();

1.1. Back up your repository

Use the backupRepository method provided by the org.modeshape.jcr.api.RepositoryManager interface to back up your repository. All of the workspaces that existed when the back up was initiated will be saved. If you call the backup method on a repository that is in use, all of the changes made while the backup process is underway are also saved.

Note

The method blocks other calls until the backup is completed, so you must invoke the method asynchronously to avoid disruptions.
Each backup is stored on the file system in a series of Gzip archives. A sub-directory for storing large binaries is also created.
  • To back up your repository, run this code in your Apache JCR session:
    org.modeshape.jcr.api.RepositoryManager repoMgr = ...
    java.io.File backupDirectory = ...
    Problems problems = repoMgr.backupRepository(backupDirectory);
    if ( problems.hasProblems() ) {
        System.out.println("Problems restoring the repository:");
        // Report the problems (we'll just print them out) ...
        for ( Problem problem : problems ) {
           System.out.println(problem);
        }
    } else {
        System.out.println("The backup was successful");
    }

Note

You must initiate each operation. There is no way to automatically schedule a backup.
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.