美文网首页
TiDB 测试环境清理脚本

TiDB 测试环境清理脚本

作者: Kassadar | 来源:发表于2019-11-07 16:07 被阅读0次

TiDB 测试环境清理脚本

中控机上建立清理脚本

vi chean.sh
#!/bin/bash
for file in ` ls -al /etc/systemd/system | grep "^-" | awk '{print $9}' `
do
systemctl stop $file
systemctl disable $file
done


for file in ` ps -ef | grep supervise | grep -v auto | awk '{print $2}' `
do
kill -9 $file
done


for file in ` ps -ef | grep -E "mysql|haproxy|java|golang|sysbench|etcd|kube|tidb|pd|tikv|pump|prometheus|drainer|grafana" | grep -v 'grep' | awk '{print $2}' `
do
kill -9 $file
done

使用 ansible-adhoc 推送脚本

ansible -i inventory.ini monitored_servers -m copy -a "src=.../clean.sh dest=/tmp/clean.sh mode=0777"

执行脚本

ansible -i inventory.ini monitored_servers -m shell -a "bash /tmp/clean.sh"

或者去目标服务器上

./tmp/clean.sh

相关文章

网友评论

      本文标题:TiDB 测试环境清理脚本

      本文链接:https://www.haomeiwen.com/subject/naevbctx.html