JBoss.orgCommunity Documentation

Chapter 33. HTTPBackupAgent and backup client

33.1. Introduction
33.2. HTTPBackupAgent
33.2.1. HTTPBackupAgent methods
33.2.2. HTTPBackupAgent Configuration
33.3. Backup Client
33.4. Backup Client Usage
33.4.1. Building application
33.4.2. Running application
33.4.3. Getting information about backup service
33.4.4. Starting full backup
33.4.5. Starting full and incremental backup on a single workspace
33.4.6. Getting information about the current backups (in progress)
33.4.7. Getting information about the current backup by 'backup_id'
33.4.8. Stopping backup by "backup_id"
33.4.9. Getting information about the completed (ready to restore) backups
33.4.10. Restoring to workspace
33.4.11. Getting information about the current restore
33.5. Full example about creating backup and restoring it for workspace 'backup'
33.5.1. Creating backup
33.5.2. Getting information about current backups
33.5.3. Stopping backup by id
33.5.4. Deleting the workspace "backup" and close opened sessions on this workspace
33.5.5. Restoring the workspace "backup"
33.5.6. Getting information about restore for workspace /repository/backup

Warning

For this service, you should configure the org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister in order to save the changes of the repository configuration. See the eXo JCR Configuration article at chapter '2 Portal and Standalone configuration' .

The service org.exoplatform.services.jcr.ext.backup.server.HTTPBackupAgent is REST-based front-end to service org.exoplatform.services.jcr.ext.backup.BackupManager. HTTPBackupAgent is representation BackupManager to creation backup, restore, getting status of current or completed backup/restore, etc.

The backup client is http client for HTTPBackupAgent.

The HTTPBackupAgent is based on REST (see details about the REST Framework).

HTTPBackupAgent is using POST and GET methods for request.

The HTTPBackupAgent allows :

  • Start backup

  • Stop backup

  • Restore from backup

  • Delete the workspace

  • Get information about backup service (BackupManager)

  • Get information about current backup / restores / completed backups

/rest/jcr-backup/start/{repo}/{ws}

Start backup on specific workspace

URL: http://host:port/rest/jcr-backup/start/{repo}/{ws}

Formats: json.

Method: POST

Parameters:

The BackupConfigBean:

header :
"Content-Type" = "application/json; charset=UTF-8"

body:
<JSON to BackupConfigBean>

The JSON bean of org.exoplatform.services.jcr.ext.backup.server.bean.BackupConfigBean :

{"incrementalRepetitionNumber":<Integer>,"incrementalBackupJobConfig":<JSON to BackupJobConfig>,
"backupType":<Integer>,"fullBackupJobConfig":<JSON to BackupJobConfig>,
"incrementalJobPeriod":<Long>,"backupDir":"<String>"}

Where :

backupType                  - the type of backup:
                                  0 - full backup only;
                                  1 - full and incremental backup.
backupDir                   - the path to backup folder;
incrementalJobPeriod        - the incremental job period;
incrementalRepetitionNumber - the incremental repetition number;
fullBackupJobConfig         - the configuration to full backup, JSON to BackupJobConfig;
incrementalJobPeriod        - the configuration to incremental backup, JSON to BackupJobConfig.

The JSON bean of org.exoplatform.services.jcr.ext.backup.server.bean.response.BackupJobConfig :

{"parameters":[<JSON to Pair>, ..., <JSON to pair> ],"backupJob":"<String>"}

Where:

backupJob  - the FQN (fully qualified name) to BackupJob class;
parameters - the list of JSON of Pair.

The JSON bean of org.exoplatform.services.jcr.ext.backup.server.bean.response.Pair :

{"name":"<String>","value":"<String>"}

Where:

name  - the name of parameter;
value - the value of parameter.

Returns:

/rest/jcr-backup/info/backup

Information about the current and completed backups

URL: http://host:port/rest/jcr-backup/info/backup

Formats: json

Method: GET

Parameters: no

Returns:

/rest/jcr-backup/info/backup/{id} Detailed information about a current or completed backup with identifier '{id}'.

URL: http://host:port/rest/jcr-backup/info/backup/{id}

Formats: json

Method: GET

Parameters:

Returns:

/rest/jcr-backup/restore/{repo}/{id}

Restore the workspace from specific backup.

URL: http://host:port/rest/jcr-backup/restore/{repo}/{id}

Formats: json.

Method: POST

Parameters:

The RestoreBean:

header :
"Content-Type" = "application/json; charset=UTF-8"

body:
<JSON to WorkspaceEntry>

The example of JSON bean to org.exoplatform.services.jcr.config.WorkspaceEntry :

{ "accessManager" : null,
  "autoInitPermissions" : null,
  "autoInitializedRootNt" : null,
  "cache" : { "parameters" : [ { "name" : "max-size",
            "value" : "10k"
          },
          { "name" : "live-time",
            "value" : "1h"
          }
        ],
      "type" : "org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl"
    },
  "container" : { "parameters" : [ { "name" : "source-name",
            "value" : "jdbcjcr"
          },
          { "name" : "dialect",
            "value" : "hsqldb"
          },
          { "name" : "multi-db",
            "value" : "false"
          },
          { "name" : "update-storage",
            "value" : "false"
          },
          { "name" : "max-buffer-size",
            "value" : "200k"
          },
          { "name" : "swap-directory",
            "value" : "../temp/swap/production"
          }
        ],
      "type" : "org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer",
      "valueStorages" : [ { "filters" : [ { "ancestorPath" : null,
                  "minValueSize" : 0,
                  "propertyName" : null,
                  "propertyType" : "Binary"
                } ],
            "id" : "system",
            "parameters" : [ { "name" : "path",
                  "value" : "../temp/values/production"
                } ],
            "type" : "org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage"
          } ]
    },
  "initializer" : { "parameters" : [ { "name" : "root-nodetype",
            "value" : "nt:unstructured"
          } ],
      "type" : "org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer"
    },
  "lockManager" : { "persister" : { "parameters" : [ { "name" : "path",
                "value" : "../temp/lock/system"
              } ],
          "type" : "org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister"
        },
      "timeout" : 15728640
    },
  "name" : "production",
  "queryHandler" : { "analyzer" : {  },
      "autoRepair" : true,
      "bufferSize" : 10,
      "cacheSize" : 1000,
      "documentOrder" : true,
      "errorLogSize" : 50,
      "excerptProviderClass" : "org.exoplatform.services.jcr.impl.core.query.lucene.DefaultHTMLExcerpt",
      "excludedNodeIdentifers" : null,
      "extractorBackLogSize" : 100,
      "extractorPoolSize" : 0,
      "extractorTimeout" : 100,
      "indexDir" : "../temp/jcrlucenedb/production",
      "indexingConfigurationClass" : "org.exoplatform.services.jcr.impl.core.query.lucene.IndexingConfigurationImpl",
      "indexingConfigurationPath" : null,
      "maxFieldLength" : 10000,
      "maxMergeDocs" : 2147483647,
      "mergeFactor" : 10,
      "minMergeDocs" : 100,
      "parameters" : [ { "name" : "index-dir",
            "value" : "../temp/jcrlucenedb/production"
          } ],
      "queryClass" : "org.exoplatform.services.jcr.impl.core.query.QueryImpl",
      "queryHandler" : null,
      "resultFetchSize" : 2147483647,
      "rootNodeIdentifer" : "00exo0jcr0root0uuid0000000000000",
      "spellCheckerClass" : null,
      "supportHighlighting" : false,
      "synonymProviderClass" : null,
      "synonymProviderConfigPath" : null,
      "type" : "org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex",
      "useCompoundFile" : false,
      "volatileIdleTime" : 3
    },
  "uniqueName" : "repository_production"
}

Returns:

/rest/jcr-backup/info/default-ws-config Will be returned the JSON bean to WorkspaceEntry for default workspace.

URL: http://host:port/rest/jcr-backup/info/default-ws-config

Formats: json

Method: GET

Parameters: no

Returns:

Backup client is console application.

The backup client is http client for HTTPBackupAgent.

Command signature:

Help info:
 <url> <cmd> 
 <url>  :   http(s)//login:password@host:port/<context> 
 <cmd>  :   start <repo/ws> <backup_dir> [<incr>] 
            stop <backup_id> 
            status <backup_id> 
            restores <repo/ws> 
            restore <repo/ws> <backup_id> <pathToConfigFile> 
            list [completed] 
            info 
            drop [force-close-session] <repo/ws>  
            help  

 start          - start backup 
 stop           - stop backup 
 status         - information about the current or completed backup by 'backup_id' 
 restores       - information about the last restore on specific workspace 
 restore        - restore the workspace from specific backup 
 list           - information about the current backups (in progress) 
 list completed - information about the completed (ready to restore) backups 
 info           - information about the service backup 
 drop           - delete the workspace 
 help           - print help information about backup console 

 <repo/ws>           - /<reponsitory-name>/<workspace-name>  the workspace 
 <backup_dir>        - path to folder for backup on remote server 
 <backup_id>         - the identifier for backup 
 <incr>              - incemental job period 
 <pathToConfigFile>  - path (local) to workspace configuration 
 force-close-session - close opened sessions on workspace.