模拟进程故障
本文主要介绍如何使用 Chaosd 模拟进程故障。该功能通过使用 的 Golang 接口模拟进程被终止或暂停的场景,支持通过命令行模式创建实验。
在创建进程故障实验前,可运行以下命令行查看 Chaosd 支持的进程故障类型:
Process attack related commands
Usage:
Available Commands:
kill kill process, default signal 9
stop stop process, this action will stop the process with SIGSTOP
Flags:
-h, --help help for process
--log-level string the log level of chaosd, the value can be 'debug', 'info', 'warn' and 'error'
Use "chaosd attack process [command] --help" for more information about a command.
目前 Chaosd 支持模拟进程被终止或暂停的故障。
模拟进程被终止命令
输出结果如下所示:
模拟进程被终止相关配置说明
模拟进程被终止示例
chaosd attack process kill -p python
模拟进程被暂停
模拟进程被暂停命令
输出结果如下所示:
stop process, this action will stop the process with SIGSTOP
Usage:
chaosd attack process stop [flags]
Flags:
-h, --help help for stop
-p, --process string The process name or the process ID
Global Flags:
模拟进程被暂停相关配置说明
配置项 | 配置缩写 | 说明 | 值 |
---|---|---|---|
process | p | 需要暂停的进程的名字或者进程的标识符 | string 类型,默认为 |
模拟进程被暂停示例
chaosd attack process stop -p python
输出结果如下所示: