Backing Up or Restoring Analytics Data
The analytics data backup / restore tool can be used to back up the already existing record store and file system of a DAS 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:Â Â
<PRODUCT_HOME>\bin\analytics-backup.bat --run
On Linux/Solaris/Mac OS:
<PRODUCT_HOME>/bin/analytics-backup.sh
The following table describes the arguments that are used with the backup script mentioned above.
Argument | Purpose | Examples |
---|---|---|
-backupRecordStore | To backup the record store wherethepersisted events are saved. |
The above command backs up all the tables in the DAS record store to the |
-dir <directory> | Directoryused as the target when backing up the record store/file system, or as the source when restoring already backed up record store/file system. Thedirectlyshould be specified in every command issued to backup or restore data. |
The above argument in all the other examples specifies the |
-restoreRecordStore | To restore a record store. Before you use this command, the record store you want to restore should be already backed up. |
The above command restores record store data currently saved in the |
-deleteTables | Deletes the specified table list. You need to specify the table list to be deleted using the Once you perform a |
|
-purge | Allows data purging for a given time range. | ./analytics-backup.sh -purge -table "tempTable" -tenantId -1234 |
-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. |
The above command restores both record store data and indexing related data currently saved in the |
-reindexEvents | This switch will make the tool re-index the data already thereina table. This can be useful in a scenario where an 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.. |
The above command reindexes the data for the given tables (person) listed under the tables tag.  |
-migrateTableSchemaV30To31 | This option migrates the analytics tables metadata from v3.0.x to v3.1.0+ | ./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. |
The above command backs up the data of
The above command restores record store data of  |
| This argument is used to select the tenant ID(s) of which the events should be backed up. |
The above command backs up all the event tables of the |
| 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 |
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 |
| 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 |
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 |
All the arguments described in the above table are displayed in your console when you run the <PRODUCT_HOME>\bin\analytics-backup.bat --run
or the <PRODUCT_HOME>/bin/analytics-backup.sh
without adding any argument.
Sample commands
Backing up data
./analytics-backup.sh -backupRecordStore -tables Table1,Table2,Table3 -dir /home/user/backup
The above command backs up the records of the Table1
, Table2
, Â 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
./analytics-backup.sh -restoreRecordStore -dir /home/user/backup
The above command restores records of the Table1
, Table2
, 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.