The analytics data backup / restore tool can be used to backup 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 where the persisted events are saved. This |
The above command backs up all the tables in the DAS record store to the |
-backupFileSystem | To backup the file system where data relating to the indexing of events. |
The above command backs up indexing information relating to all the tables in DAS to the |
-dir <directory> | Directory used as the target when backing up the record store/file system, or as the source when restoring already backed up record store/file system. The directly should 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 |
-restoreFileSystem | To restore a file system. Before you use this command, the file system you want to restore should be already backed up. |
The above command restores indexing related data currently saved in the |
-enableIndexing |
Indexing is by default disabled in the data restoration step, this is because, if the target DAS server is already running, then that server will also index the same data, and will lead to index corruption. So if we are sure if the DAS server is not up, we can chose to index the data right at the time of restoring the data, by enabling this setting. Even in default setting, after the data is restored, when the DAS server is started up, it will anyway index the new data in the usual way. | |
-reindexEvents | This switch will make the tool re-index the data already there in a table. This can be useful in a scenario such as, an index getting corrupted for some reason, or some of the older data was not index since it was not mentioned in the schema etc.. | |
-tables <table list> | This argument is used to specify the list of event tables that should be backed up or restored. |
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 |
-disableStaging | This argument is used to disable staging. Staging involves including the indication whether the data is indexed or not when backing up/restoring the DAS record store. This task incurs a greater system overhead. Therefore, it is allowed to disable staging when the number of records being backed up/restored is high. Backing up and restoring the file system via -backupFileSystem and - restoreFileSystem allows you to preserve the indexing which would enable searches to be carried out on restored data. |
The above command backs up all the event tables in the DAS record store. Indications of whether data is indexed or not are removed before backing up the records. |
| 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.
Searching restored data
In order to enable searching for persisted data, WSO2 indexes events using Apache Lucene (for more information, see Configuring Lucene Indexes). The persisted data is saved in the record store and the information relating to the indices of that data is stored in the file system. Therefore, if you want to carry out searches once you restore backed up data, you need to restore both the record store and the file system. If you restore only the record store it will not be possible to carry out searches for the restored data using the Data Explorer. For more information on searching using the Data Explorer, see Searching Data by Categories.