Backing up the Search index using wsadmin commands
Use SearchService administrative commands to define scheduled backup tasks for the Search index.
To use SearchService administrative commands, you must use the wsadmin client. See Starting the wsadmin client for information about how to start the wsadmin command-line tool.
Note: Backups are written to the location specified in the IBM® WebSphere® Application Server environment variable, SEARCH_INDEX_BACKUP_DIR. When backing up the index, ensure that multiple nodes are not sharing the same backup location.
- To back up the Search index, complete the following tasks.
Start the wsadmin client from one of the following directories on the system on which you installed the Deployment Manager:
where app_server_root is the WebSphere Application Server installation directory and dm_profile_root is the Deployment Manager profile directory, typically dmgr01.
You must start the client from this directory or subsequent commands that you enter do not execute correctly.
After the wsadmin command environment has initialized, enter the following command to initialize the Search environment and start the Search script interpreter:
If prompted to specify a service to connect to, type 1 to pick the first node in the list. Most commands can run on any node. If the command writes or reads information to or from a file using a local file path, you must pick the node where the file is stored.
When the command is run successfully, the following message displays:
Search Administration initialized
Use the following commands.
SearchService.addBackupIndexTask(String taskName, String schedule, String startbySchedule) : Defines a new scheduled index backup task.
This command takes the following arguments: - taskName. The name of the task to be added. - schedule. The time at which the scheduled task starts. This argument is a string value that must be specified in Cron format. - startbySchedule. The time given for the task to run before it is automatically canceled. This argument is a string value that must be specified in Cron format. For example: ``` SearchService.addBackupIndexTask("WeeklyIndexBackup", "0 0 2 ? * SAT","0 10 2 ? * SAT") ``` When the command runs successfully, 1 is printed to the wsadmin console. If the command does not run successfully, 0 is printed to the wsadmin console.
SearchService.backupIndexNow() : Backs up the index to the location specified by the IBM WebSphere Application Server variable, SEARCH_INDEX_BACKUP_DIR. There might be a delay before the backup occurs if there are indexing tasks in progress.
This command does not take any arguments. After backing up the Search index using wsadmin commands, consider performing a full backup of the HOMEPAGE database. Note that the Search index has a dependency on data in the HOMEPAGE database.
SearchService.deleteTask(String taskName) : Deletes the specified backup task.
This command takes a single argument: - taskName. The name of the task to be deleted. For example: ``` SearchService.deleteTask("NightlyBackupTask") ```
SearchService.notifyRestore(Boolean isNewIndex) : Brings the database to a consistent state so that crawlers start from the point at which the backup was made.
The notifyRestore command updates index management tables in the HOMEPAGE database so that crawling resume points are reloaded from a restored index, thereby ensuring that all future crawls start from the correct point. The command also purges cached content in the HOMEPAGE database. The notifyRestore command optionally removes all entries from the HOMEPAGE database table that tracks the status of individual files as part of the content extraction process. This table is used by the Search application when indexing the content of file attachments. This command takes a single parameter: - isNewIndex: If set to true, all entries are removed from the database table that is used by the file content extraction process to track the status of individual files. Set this parameter to true when you are restoring a newly-built index. Set the parameter to false when you are restoring an index backup. For example: ``` SearchService.notifyRestore("true") ```
Parent topic:Backing up the Search index