com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.

Backing Up or Restoring Analytics Data

The analytics data backup/restore tool can be used to back up the record stores and file systems that already exist in the WSO2 EI analytics server to a specific directory in our machine. The backed up data can be restored later from the same directory to the current DAS node.

The following script is used to backup and restore data.

  • On Windows: CARBON_HOME=<EI_HOME>\wso2\analytics <EI_HOME>\wso2\analytics\bin\analytics-backup.bat --run
  • On Linux/Solaris/Mac OS: CARBON_HOME=<EI_HOME>/wso2/analytics <EI_HOME>/wso2/analytics/bin/analytics-backup.sh

The following table describes the arguments that are used with the backup script mentioned above.

ArgumentPurposeExamples
-backupRecordStoreTo backup the record store where the persisted events are saved.

CARBON_HOME=<EI_HOME>/wso2/analytics ./analytics-backup.sh -backupRecordStore -dir /home/user/backup

The above command backs up all the tables in the DAS record store to the /home/user/backup directory.

-dir <directory>Directory used as the target when backing up the record store/file system, or as the source when restoring an already backed up record store/file system. The directory should be specified in every command that is issued to backup or restore data.

-dir /home/user/backup

The above argument in all the other examples specifies the /home/user/backup directory as the location where the backed up data should be stored or as the source from which data should be restored.

-restoreRecordStoreRestores a record store. Before you use this command, the record store you want to restore should be already backed up.

CARBON_HOME=<EI_HOME>/wso2/analytics ./analytics-backup.sh -restoreRecordStore -dir /home/user/backup

The above command restores record store data currently saved in the/home/user/backup directory to the current DAS node.

-deleteTables

Deletes the specified table list. You need to specify the table list to be deleted using the -tables parameter.

Once you perform a deleteTable action, you need to send a DELETE request to https://<DAS-URL>:<PORT>/analytics/tables/<TABLE-NAME>/schema-invalidate in order to remove the in-memory schema.

CARBON_HOME=<EI_HOME>/wso2/analytics ./analytics-backup.sh -deleteTables -tables "tempTable" -tenantId -1234

-purgeAllows data purging for a given time range.

CARBON_HOME=<EI_HOME>/wso2/analytics ./analytics-backup.sh -purge -table "tempTable" -tenantId -1234 -timeFrom 15-10-11-12:40:00 -timeTo 15-10-15-17:00:00

-enableIndexing

Indexing is disabled in the data restoration step by default. This is because if the target DAS server is already running, that server will also index the same data causing an index corruption. If you are certain that the target DAS server is not running, you can index the data at the time it is restored by using this argument. If this argument is not used while the target DAS server is not running, the data restored from the time the target server is started up is indexed in the usual way.

CARBON_HOME=<EI_HOME>/wso2/analytics ./analytics-backup.sh -restoreRecordStore -enableIndexing -dir /home/user/backup

The above command restores both record store data and indexing related data currently saved in the /home/user/backup directory to the current DAS node, and indexes the data at the time of restoration.

-reindexEventsThis switch will make the tool re-index the data already there in a table. This can be useful in a scenario where the indexing is corrupted for some reason, or if some of the older data is not indexed because it was not mentioned in the schema etc.

CARBON_HOME=<EI_HOME>/wso2/analytics ./analytics-backup.sh -reindexEvents -tables "person" -tenantId -1234

The above command reindexes the data for the given tables (person) listed under the tables tag. 

 

-migrateTableSchemaV30To31This option migrates the analytics tables metadata from v3.0.x to v3.1.0+

CARBON_HOME=<EI_HOME>/wso2/analytics ./analytics-backup.sh -migrateTableSchemaV30To31

-tables <table list>

This argument is used to specify the list of event tables that should be backed up or restored.

If you do not use this argument to back up data from one or more specific tables, all the available event tables will be backed up.

CARBON_HOME=<EI_HOME>/wso2/analytics /analytics-backup.sh -backupRecordStore -tables Table1,Table2,Table3 -dir /home/user/backup

The above command backs up the data in the Table1, Table2, and Table3 event tables to the  /home/user/backup  directory.

CARBON_HOME=<EI_HOME>/wso2/analytics ./analytics-backup.sh -restoreRecordStore -tables Table1,Table2,Table3 -dir /home/user/backup

The above command restores the record store data of Table1 , Table2, Table3 event tables that are currently saved in the /home/user/backup directory to the current DAS node.

-tenantId <tenant id (default is super tenant)>

This argument is used to select the tenant ID(s) of which the events should be backed up.

CARBON_HOME=<EI_HOME>/wso2/analytics ./analytics-backup.sh -backupRecordStore -tenantId abc -dir /home/user/backup

The above command backs up all the event tables of the abc tenant from the DAS record store.

-timeFrom <yy-mm-dd-hh:mm:ss>

This argument specifies the starting time (inclusive) when defining the time period that should be considered when backing up/restoring events.

This argument should be used together with the -timeto argument.

CARBON_HOME=<EI_HOME>/wso2/analytics ./analytics-backup.sh -backupRecordStore -timeFrom 15-10-11-12:40:00 -timeTo 15-10-15-17:00:00 -dir /home/user/backup

The above command backs up all the data in the DAS record store created between 12.45PM on 11th October 2015 to 5.00PM on 15th October 2015. The data is backed up in the /home/user/backup directory.

-timeTo <yy-mm-dd-hh:mm:ss>

This argument specifies the ending time (inclusive) when defining the time period that should be considered when backing up/restoring events.

This argument should be used together with the -timefrom argument.

CARBON_HOME=<EI_HOME>/wso2/analytics ./analytics-backup.sh -backupRecordStore -timefrom 15-10-11-12-40-00 -timeto 15-10-15-17-00-00 -dir /home/user/backup

The above command backs up all the data in the DAS record store created between 12.45PM on 11th October 2015 to 5.00PM on 15th October 2015. The data is backed up in the /home/user/backup directory.

All the arguments described in the above table are displayed in your console when you run the CARBON_HOME=<EI_HOME>\wso2\analytics <EI_HOME>\wso2\analytics\bin\analytics-backup.bat --run or the CARBON_HOME=<EI_HOME>/wso2/analytics <EI_HOME>/wso2/analytics/bin/analytics-backup.sh without adding any argument.

Sample commands

Backing up data
CARBON_HOME=<EI_HOME>/wso2/analytics ./analytics-backup.sh -backupRecordStore -tables Table1,Table2,Table3 -dir /home/user/backup 

The above command backs up the records of Table1, Table2, and Table3 event tables as well as the related indexing information in the /home/user/backup directory. Only the data entered between 8.00 AM on 11th August 2015 and 10.30 PM on 15th October 2015 are selected to be backed up.

Restoring data
CARBON_HOME=<EI_HOME>/wso2/analytics ./analytics-backup.sh -restoreRecordStore -dir /home/user/backup

The above command restores records of Table1, Table2, and Table3 event tables as well as the related indexing information from the /home/user/backup directory . Only data entered between 9.00 - 10.00 AM on 11th August 2015 are selected to be restored.

CARBON_HOME=<EI_HOME>/wso2/analytics ./analytics-backup.sh -restoreRecordStore -dir /home/user/backup
com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links' is unknown.