Search and Recover Experiments of Chaosd
You can search experiments by conditions and recover the experiments corresponding to specified UIDs using Chaosd. This document describes how to search and recover experiments of Chaosd, and provides releated examples.
This section introduces how to use command-line mode and service mode to find experiments of Chaosd.
By running the following command, you can view the configurations supported by the command:
Configuration description
Example
./chaosd search --kind network --status destroyed --limit 1
By running this command, you can search the experiments of the kind of network
in the status of destroyed
(indicating that the experiment has been recovered).
After running the command, only one row of data is output in the result:
--------------------------------------- --------- -------- ----------- --------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1f6c1253-522a-43d9-83f8-42607102b3b9 network delay destroyed 2021-11-02T15:14:07+08:00 {"schedule":"","duration":"","action":"delay","kind":"network","uid":"1f6c1253-522a-43d9-83f8-42607102b3b9","latency":"2s","jitter":"0ms","correlation":"0","device":"eth0","ip-address":"220.181.38.251","ip-protocol":"all"}
Example
The result is as follows:
Recover experiments of Chaosd
After creating an experiment, if you want to withdraw the impact caused by the experiment, you can use the recovery feature of experiments.
You can recover an experiment by using Chaosd recover UID.
The following example shows how to recover an experiment using the command-line mode.
Create a CPU stress experiment using Chaosd:
chaosd attack stress cpu --workers 2 --load 10
Save the experiment UID for later use.
When you do not need to simulate the CPU stress scenario anymore, use the
recover
command to recover the experiment corresponding to the UID:chaosd recover 4f33b2d4-aee6-43ca-9c43-0f12867e5c9c
You can recover an experiment by sending a DELETE
HTTP request to the /api/attack/{uid}
path of Chaosd service.
The following example shows how to recover an experiment using the service mode.
- Send a
POST
HTTP request to the Chaosd service to create a CPU stress experiment: