复制代码 代码如下:
#!/bin/bash
# p1 the slave mysql db server
db03=$1
echo $dbserver;
ster_Log_File=`ssh $db03 " mysql -uxx -pxx --ssl-ca=/opt/mysql/ssl/ca-cert.pem --s
sl-cert=/opt/mysql/ssl/server-cert.pem --ssl-key=/opt/mysql/ssl/server-key.pem -e /"show slave status/G;/" |grep -i master_Log_File
"`;
# echo ##### 获取binlog信息
log_file=`echo $ster_Log_File | awk '{print $2}'`;
db01tmp=`ssh $db03 " mysql -uxx -pxx --ssl-ca=/opt/mysql/ssl/ca-cert.pem --s
sl-cert=/opt/mysql/ssl/server-cert.pem --ssl-key=/opt/mysql/ssl/server-key.pem -e /"show slave status/G;/" |grep -i Master_Host
"`;
复制代码 代码如下:
# 获取master主机名或者ip地址
db01=`echo $db01tmp | awk '{print $2}'`
# 开始清理binlog日志信息
复制代码 代码如下:
ssh $db01 " mysql -uxxx -pxx --ssl-ca=/opt/mysql/ssl/ca-cert.pem --ssl-cert=/op
t/mysql/ssl/server-cert.pem --ssl-key=/opt/mysql/ssl/server-key.pem -e /"purge master logs to '$log_file';/" "
# check master上面的binlog信息
复制代码 代码如下:
ssh $db01 " df -h /mysql/binlog ";
复制代码 代码如下:
<STRONG><SPAN></SPAN></STRONG>
新闻热点
疑难解答