接到call,磁盘报警了,发现是大量dml操作导致N多binlog产生,所以需要清除已经sync过的binlog日志,12组nodes MySQL DB,每组2台Master-Master,需要批量清除过期的binlog释放磁盘空间。
方案,总共24台db,一台台进去清理肯定不行,得需要写一个脚本,进行批量操作,方案思路大概如下
1, 建立双master列表masterlist; 一个master一行。
2,远程获取master db上面的binlog位置以及对应master的master主机名(也许是ip地址)
3,拿到binlog位置以及master主机名,然后ssh远程清理掉远程master上面的binlog
4, 采用shell for循环操作step 2以及step 3。
clearbinlog.sh脚本如下
for masterdb in `cat master.db.full`;do
#1 echo get the binlog position infomation
str_log_files=`ssh $masterdb "/opt/mysql/product/5.5.25a/bin/mysql -uroot --password="" -e \"show slave status\G;\" |grep -i master_Log_File "`
echo $str_log_files;
log_file=`echo $str_log_files | awk '{print $2}'`;
echo $log_file;
#2 echo get the master ip address or master hostname
db01tmp=`ssh $masterdb " /opt/mysql/product/5.5.25a/bin/mysql -uroot --password="" -e \"show slave status\G;\" |grep -i Master_Host "`;
db01=`echo $db01tmp | awk '{print $2}'`
#3 begin to clear the old binlog
ssh $db01 "/opt/mysql/product/5.5.25a/bin/mysql -uroot --password="" -e \"purge master logs to '$log_file';\""
#4 check the disk space for master
ssh $db01 "df -h"
echo " "
echo " -- -- -- ";
done;
OK,run sh脚本
shclearbinlog.sh 就可以开始清理所有db的binlog了。
最后再次check disk space,执行check_disk.sh脚本,脚本内容如下:
for masterdb in `master.db.full`;do
ssh $masterdb "df -h" |grep -i mysqldatadir;
done;
执行sh check_disk.sh开始check
分享到:
相关推荐
表空间PREFETCHSIZE的设置,EXTENTSIZE的关系,缓冲池的监控,页清除程序的多少。 临时表空间页面大小与其他表空间页面大小的设置,临时表空间与缓冲池的设置。 example:db2icrt db2 -s ese -p d:\db2 -u ...
masternodes.online刮板刮刮masternodes.online并逐行筛选以找到好的硬币作为masternode支持。用法# Install depsnpm installnode scrape.js MIN_WORTH MIN_ROI执照MIT许可证: :
python库,解压后可用。 资源全名:workflow_nodes-0.3.0-py3-none-any.whl
Chapter 2: The Data Nodes Part II: Installation and Configuration Chapter 3: System Planning Chapter 4: Configuration Chapter 5: Installation Chapter 6: Replication Part III: Daily Tasks and ...
python库,解压后可用。 资源全名:terra_bonobo_nodes-0.3.7-py3-none-any.whl
资源来自pypi官网。 资源全名:terra_bonobo_nodes-0.3.7-py3-none-any.whl
k8s初始化时,安装kube-flannel之后,master节点还是NotReady,所缺少的flannel文件
Nodes 一个GraphQL JVM 客户端- Java, Kotlin, Scala等
-opts=" -L 8080:127.0.0.1:8080"获取调试信息: $ bosh -d cockroachdb run-errand report-health$ bosh -d cockroachdb run-errand report-vars$ bosh -d cockroachdb run-errand report-nodes-local# or ...
无线传感器网络随机分布节点,形成拓扑结构
blender animation_nodes_v2_3_macOS_py39
html dom 操作 php 代码 文档 可运行 [Updates - add some ability to insert and create nodes.] [1: add ability to search the "noise" array] [PHP Simple HTML Dom version 1.5 released.]
The first one is called *Vertex Cover Optimization*it divided the graph into two parts a vertex cover and the rest part.we need to ...and simultaneously compute the spread of the rest part of nodes....
NX二次开发——批量修改程序的刀轴 1、获取程序组内所有程序 2、创建轴对象 3、设置程序的刀轴类型和刀轴矢量 UF_PARAM_TLAXIS_TYPE UF_PARAM_TLAXIS_VECTOR UF_UI_ONT_ask_selected_nodes UF_NCGROUP_ask_member_...
- Fixed : Issue with Selected node count after removing nodes Update : TAdvToolBar v6.3.3.2 ----------------------------- - Improved : Automatic Office 2016 color detection Update : TAdvSpreadGrid ...
接受白嫖,有需要的同学请私信博主,7*24h在线! Node是一个Javascript运行环境(runtime)。 Node对一些特殊用例进行了优化,提供了替代的API,使得V8在非浏览器环境下运行得更好。
Set Nodeindex = TreeView.Nodes.Add("父2", tvwChild, "子3", "三个桥村") Nodeindex.Sorted = True Set Nodeindex = TreeView.Nodes.Add("父2", tvwChild, "子4", "木卡姆村") Nodeindex.Sorted = True ...
决策树(DecisionTree):一种树形结构,其中每个内部节点表示一个属性上的判断,每个叶节点代表最终的判断。 三、实验内容 机器学习实验教材《Python机器学习基础教程》第二章的2.3.5节。 注意:忽略mglearn.plots...
mldonkey需要的nodes.dat