Backup and Restore
Overview on Backup and Restore
To recover from corrupted Omnitive Search components, a backup needs to be done. The backup can be planned and done. There are three main components that can be backed up:
Application
Database
Search Index
1. Backup and Restore Application
“Application backup” in this module and “Upgrade Omnitive Search packages” in Maintaining Omnitive Search Server are closely linked. You can understand the high-level concept of the process here and refer to the details steps in “Upgrade Omnitive Search packages” in Maintaining Omnitive Search Server,
Application backup can be performed by copying war packages file to a backup repository. Deployed war packages can be found in Application and Administration Server the following path:
Tomcat webapps folder
Application restore can be done replacing war packages of Application and Administration Server hosted in the following path:
Tomcat webapps folder
2. Backup and Restore Database
The MySQL Database procedure executes a complete backup for the isearch schemas and data is shown in the following backup command: - Access MySQL folder from command line on Database Server (or wherever your mysql.exe is located)
mysqldump -h localhost --user=isearch --password=<password> --databases isearch --skip-extended-insert > isearch-dump-<YYYYMMdd>.sql
This backup file (isearch-dump-<YYYYMMdd>.sql) will enable Omnitive Search data recovery in case of data loss. In order to recover the isearch system schemas and data from a previous backup file (e.g. isearch-dump-YYYYMMdd.sql) is required the following command:
mysql -h localhost -u isearch -p isearch < isearch-dump-<YYYYMMdd>.sql
3. Backup and Restore Index
Elasticsearch allows to create file snapshot of indexes at any given time. Those files can be used to restore the elasticsearch index in case of failure.
In order to create snapshots files, you need to register a snapshot repository for elasticsearch.
In elasticsearch.yml add: path.repo: d:/Taiger/backups/index-backup
Restart elasticsearch, then the folder will be automatically created
Register snapshot repository from command line on the Database Server
curl.exe -XPUT "http://localhost:9200/_snapshot/isearch-backup" -H "Content-Type: application/json" -d"{ \"type\": \"fs\", \"settings\": { \"location\": \"d:/Taiger/backups/indexbackup\", \"compress\": true } }"
After registering a snapshot repository, you can create a script to create a snapshot to get daily backups of indexes. Create a script file called elastic-backup.bat with the following script:
@echo off ECHO "Starting elasticsearch snapshot" curl.exe -XPUT "http://localhost:9200/_snapshot/isearch-backup/snapshot_YYYYmmdd" -H "Content-Type: application/json" -d "{ \"indices\": \"isearch-v1\", \"ignode_unavailable\": \"true\", \"include_global_state\": false }" echo "...snapshot finished "
Once you have an index snapshot, when there is index corruption, you can restore from the backup. You cannot restore an open existing index. Run this command with the index name to delete an index:
curl -X DELETE "localhost:9200/<indexname>?pretty
The following command restores a previously stored snapshot into the elasticsearch index.
curl -XPOST "http://localhost:9200/_snapshot/isearch-backup/snapshot_YYYYmmdd/_restore"
Last updated