运维笔记

mac2022-07-05  31

nginx 是利用回调机制来处理进程的

select 是通过轮询进行查询

epoll  模型  是通过回调机制

 

运维脚本实例

1.通过这种方式把mysql的警告信息去掉

import subprocess command="/data/mysql/percona5.7/bin/mysql -uroot -psdd -e 'show slave status\G'|grep Seconds|awk '{print $2}'" res=subprocess.Popen(command,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE) print(res.stdout.read().decode('utf-8'))

 2.第二种方式

import paramiko ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(hostname='192.168.40.230', port=22, username='root', password='m***') command="/data/mysql/percona5.7/bin/mysql -uroot -pdddd -e 'show slave status\G'|grep Seconds|awk '{print $2}'" stdin, stdout, stderr = ssh.exec_command(command) result = stdout.read() result_err = stderr.read() print(result.decode('utf-8'))

 

转载于:https://www.cnblogs.com/sunkedong/p/7859937.html

相关资源:MySQL DBA运维笔记 超详细
最新回复(0)