Backing up and restoring Elasticsearch server data
Elasticsearch servers store all data used in TrueSight Vulnerability Management. Backing up data in Elasticsearch servers should be part of the regular maintenance of a TrueSight Vulnerability Management deployment.
An automatic backup procedure is described below. In the procedure, you must configure some values that specify where data is stored and how often a backup should occur.
In rare situations, you might need to restore Elasticsearch server data that was previously archived. A restore procedure is described below.
This topic contains the following sections:
Before you begin
Ensure that you have downloaded the Stack Manager tool (TSVM<versionNo>-SM-LIN64.zip) from EPD.
To back up Elasticsearch data
This backup capability can store a snapshot of the data in the Elasticsearch server to a local or remote repository.
This procedure requires you to modify two configuration files.
If you have installed multiple instances of the Vulnerability Management server, you must ensure that each instance has an identical backup configuration.
- On the application server, configure the bmc-config.json file, as follows:
- Open bmc-config.json for editing.
Typically, this file resides at <TSVM_INSTALL_DIR>/application/app/vulnerability-management-portal/data/configuration. In the file, search for the term ElasticSearchConfigManager. The section that includes that term appears as follows
"com.bmc.dcaportal.index.service.core.ElasticSearchConfigManager" : {
"indexsearch.enabled" : "true",
"cluster.name" : "dca-index",
"loader.maxBSAPageSize" : 1000,
"aggregation.precision.count" : 500,
"vulnerability.management.circuit.breaker" : 1500000,
"circuit.breaker.threshold" : 95,
"loader.threadPoolSize" : 5,
"purge.interval" : 10,
"index.backup.path" : "",
"index.backup.timeinterval" : 1440
},Provide the following values, as necessary:
Option
Explanation
index.backup.path
Provides the path to local or remote location where data should be stored. Be sure you have correct permissions for the location you specify.
For example, you might enter:"index.backup.path" : "opt/bmc/truesight/INDEX_BACKUP",
index.backup.timeinterval
Specifies how often a backup of the Elasticsearch server data should occur. The value you enter is in minutes. By default, a backup occurs every 24 hours.
- Save bmc-config.json.
- Open bmc-config.json for editing.
- On the Elasticsearch server, configure the elasticsearch.yml file.
- Open elasticsearch.yml for editing.
Typically, this file resides at <ES_INSTALL_DIR>/elasticsearch/infra-ext/es/DCAIndexService/config. Insert the following entry anywhere in the file:
path.repo: <Path_to_backup_directory>For example, you might enter:
path.repo: opt/bmc/truesight/INDEX_BACKUP
The value you enter must match the value of index.backup.path that you specified in the bmc-config.json file.- Save elasticsearch.yml.
- Open elasticsearch.yml for editing.
On the application server, from the command prompt, navigate to the TSVM<versionNo>-SM-LIN64/truesight-sm directory and restart the TrueSight Vulnerability Management services:
python truesight-sm.py stop --deployment application
python truesight-sm.py start --deployment applicationOn the Elasticsearch server, from the command prompt, navigate to the TSVM<versionNo>-SM-LIN64/truesight-sm directory, and restart the Elasticsearch (DCA Index) service:
python truesight-sm.py stop --deployment elasticsearch
python truesight-sm.py start --deployment elasticsearch- Repeat this procedure for each instance of the TrueSight Vulnerability Management server.
To restore Elasticsearch server data
Restoring Elasticsearch server data requires you to install a plugin that provides a web-based front end to the Elasticsearch server. After the plugin is installed, there are two possible restore procedures:
Installing the plugin for the web-based front end
- If your installation of TrueSight Vulnerability Management does not have Internet access, perform these preliminary steps. If your site does have Internet access, skip to step 2.
- Using a host that does have Internet access, visit https://github.com/mobz and download elasticsearch-head.zip.
- Move the downloaded file to a directory within your installation.
On the application server, from the command prompt, navigate to the TSVM<versionNo>-SM-LIN64/truesight-sm directory and stop the TrueSight Vulnerability Management services:
python truesight-sm.py stop --deployment applicationOn the Elasticsearch server, from the command prompt, navigate to the TSVM<versionNo>-SM-LIN64/truesight-sm directory and make sure that the Elasticsearch (DCA Index) service is running by checking its status:
python truesight-sm.py status --deployment elasticsearch- Navigate to the following directory: <ES_INSTALL_DIR>/elasticsearch/infra-ext/es/DCAIndexService/bin.
- Enter one of the following commands:
- If you have Internet access:
plugin -install mobz/elasticsearch-head - If you do not have Internet access:
plugin --url file:<local_directory>/elasticsearch-head.zip --install mobz/elasticsearch-head
where <local_directory> is the location where you placed the downloaded ZIP file in step 1.
- If you have Internet access:
On the application server, from the command prompt, navigate to the TSVM<versionNo>-SM-LIN64/truesight-sm directory and restart the TrueSight Vulnerability Management services:
python truesight-sm.py stop --deployment application
python truesight-sm.py start --deployment application
Restoring the most recent snapshot
On the application server, from the command prompt, navigate to the TSVM<versionNo>-SM-LIN64/truesight-sm directory and stop the TrueSight Vulnerability Management application services.
python truesight-sm.py stop --deployment applicationOn the Elasticearch server, from the command prompt, navigate to the TSVM<versionNo>-SM-LIN64/truesight-sm and make sure that the Elasticsearch (DCA Index) service is running by checking its status:
python truesight-sm.py status --deployment elasticsearch- Start the plugin for the Elasticsearch server:
- If you have Internet access, use the following URL: <hostNameElasticsearchServer>:<httpPortNo>/_plugin/head
For example, enter tsvmserver.mycompany.com:9200/_plugin/head If you do not have Internet access, use the following URL: http://localhost:9200/_plugin/head/
- If you have Internet access, use the following URL: <hostNameElasticsearchServer>:<httpPortNo>/_plugin/head
- If it is not already selected, click the Any Request tab.
- Stop all indices in the Elasticsearch server, as follows:
- In the Query section, enter _all/_close.
- From the drop-down menu at right, select POST.
- Click Request.
- Restore the latest snapshot.
- In the Query section, enter _snapshot/dca-index-repository/dca-index-snapshot/_restore.
- From the drop-down menu at right, select POST.
- Click Request.
On the application server, from the command prompt, navigate to the TSVM<versionNo>-SM-LIN64/truesight-sm directory and restart the TrueSight Vulnerability Management services:
python truesight-sm.py stop --deployment application
python truesight-sm.py start --deployment applicationOn the Elasticsearch server, from the command prompt, navigate to the TSVM<versionNo>-SM-LIN64/truesight-sm directory and restart the Elasticsearch (DCA Index) service:
python truesight-sm.py stop --deployment elasticsearch
python truesight-sm.py start --deployment elasticsearch- Confirm that all vulnerability management asset and vulnerability data is available.
Restoring the most recent snapshot to a corrupted data folder
In situations where the Elasticsearch's data folder (<TSVM_INSTALL_DIR>/elasticsearch/infra-ext/es/DCAIndexService) has become corrupted, you must perform a restore procedure like the one described above but you must also run a command to manually create a repository for metadata.
On the application server, from the command prompt, navigate to the TSVM<versionNo>-SM-LIN64/truesight-sm directory and stop the TrueSight Vulnerability Management services:
python truesight-sm.py stop --deployment applicationOn the Elasticsearch server, from the command prompt, navigate to the TSVM<versionNo>-SM-LIN64/truesight-sm directory and make sure that the Elasticsearch (DCA Index) service is running by checking its status:
python truesight-sm.py status --deployment elasticsearch- Start the plugin for the Elasticsearch server:
- If you have Internet access, use the following URL: <hostNameElasticsearchServer>:<httpPort>/_plugin/head
For example, enter tsvmserver.mycompany.com:9200/_plugin/head If you do not have Internet access, use the following URL: http://localhost:9200/_plugin/head/
- If you have Internet access, use the following URL: <hostNameElasticsearchServer>:<httpPort>/_plugin/head
- If it is not already selected, click the Any Request tab.
- Stop all indices in the Elasticsearch server, as follows:
- In the Query section, enter _all/_close.
- From the drop-down menu at right, select POST.
- Click Request.
- Create a repository for metadata to replace the corrupted repository.
In the Query section, enter the following:
_snapshot/dca-index-repository
{
"type": "fs",
"settings": {
"location": "<Snapshot location>"
}
}- From the drop-down menu at right, select PUT.
For example, the web-based front end would look something like this: - Click Request.
- Restore the latest snapshot.
- In the Query section, enter _snapshot/dca-index-repository/dca-index-snapshot/_restore.
- From the drop-down menu at right, select POST.
- Click Request.
On the application server, from the command prompt, navigate to the TSVM<versionNo>-SM-LIN64/truesight-sm directory and restart the TrueSight Vulnerability Management services:
python truesight-sm.py stop --deployment application
python truesight-sm.py start --deployment applicationOn the Elasticsearch server, from the command prompt, navigate to the TSVM<versionNo>-SM-LIN64/truesight-sm directory and restart the Elasticsearch (DCA Index) service:
python truesight-sm.py stop --deployment elasticsearch
python truesight-sm.py start --deployment elasticsearch- Confirm that all vulnerability management asset and vulnerability data is available.