Clearing data from a deployment
This section describes an example of the process to clear the data from your deployment in a Docker environment.
Clearing the data from a deployment includes the following high-level steps:
- Removing the Liberty containers
- Clearing the search index
- Creating and running a delete query
- Removing the collection properties
- Clearing data from the Information Store
- Remove all of the data in the Information Store
- Running the Liberty containers
The examples/pre-prod/walkthroughs/change-management/clearDataWalkthrough.sh
script is a worked example that demonstrates how to clear the data from the Information Store in a containerized environment.
Note: Before you complete this walkthrough, reset your environment to the base configuration. For more information, see Resetting your environment.
Removing the Liberty containers
Before you clear the data from a deployment, you remove the Liberty containers. To remove the containers, run the following docker commands:
docker stop liberty1 liberty2
docker rm liberty1 liberty2
See the Removing the Liberty containers
section of the walkthrough script.
Clearing the search index
Creating and running a delete query
To clear the search index, run a Solr delete query against your indexes via the Solr API.
You can run the delete query by using a curl command. In Solr, data is stored as documents.
You must remove every document from each collection in your deployment.
The run_solr_client_command
client function is used to run the curl commands that remove the documents from each collection.
For more information about the function, see run_solr_client_command.
The following curl command removes every document from a the main_index
:
curl -u "${SOLR_ADMIN_DIGEST_USERNAME}:${SOLR_ADMIN_DIGEST_PASSWORD}" --cacert /run/secrets/CA.cer "${SOLR1_BASE_URL}/solr/main_index/update?commit=true" -H Content-Type:"text/xml" --data-binary "<delete><query>*:*</query></delete>"
See the Clearing the search index
section of the walkthrough script.
For more information about command parsing, see Command parsing
Removing the collection properties
The run_solr_client_command
client function is used to remove the file from ZooKeeper.
For more information about the function, see run_solr_client_command.
The following zkcli
call removes the collection properties for the main_index
.
zkcli.sh -zkhost "${ZK_HOST}" -cmd clear "/collections/main_index/collectionprops.json"
See the Clearing the search index
section of the walkthrough script.
The collection properties must be removed for any main, match, or chart collections.
The collectionprops.json
file is recreated when the i2 Analyze application is started.
Clearing data from the Information Store
See the Clearing the Information Store database
section of the walkthrough script.
The run_sql_server_command_as_dba
client function is used to run the clearInfoStoreData.sh
tool to remove the data from the Information Store.
Running the Liberty containers
The run_liberty
server function runs a Liberty container. For more information about running a Liberty container, see Liberty.
See the Running the Liberty containers
section of the walkthrough script.
Note: You must run both Liberty containers.
The wait_for_i2_analyze_service_to_be_live
common function ensures that Liberty is running.