模拟进程故障
本文主要介绍如何使用 Chaosd 模拟进程故障。该功能通过使用 kill
的 Golang 接口模拟进程被终止或暂停的场景,支持通过命令行模式或服务模式创建实验。
使用命令行模式创建实验
在创建进程故障实验前,可运行以下命令行查看 Chaosd 支持的进程故障类型:
chaosd attack process -h
输出结果如下所示:
Process attack related commands
Usage:
chaosd attack process [command]
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
Global Flags:
--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 -h
输出结果如下所示:
kill process, default signal 9
Usage:
chaosd attack process kill [flags]
Flags:
-h, --help help for kill
-p, --process string The process name or the process ID
-r, --recover-cmd string The command to be run when recovering experiment
-s, --signal int The signal number to send (default 9)
Global Flags:
--log-level string the log level of chaosd. The value can be 'debug', 'info', 'warn' and 'error'
--uid string the experiment ID