Skip to content

Instantly share code, notes, and snippets.

View sennajox's full-sized avatar

Sennajox sennajox

  • Shanghai, China
View GitHub Profile
@sennajox
sennajox / roll.py
Created December 19, 2016 03:27
roll
View roll.py
#!/usr/bin/env python2
# coding=utf8
import sys, os
import random
import time
if __name__ == "__main__":
curtime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
@sennajox
sennajox / sync_demo.sh
Last active August 29, 2015 14:22
同步任务的示例脚本
View sync_demo.sh
#!/bin/bash
#
# 该脚本简单封装了UFile客户端工具filemgr的增量上传功能
#
if [ $# -lt 2 ];then
echo "usage:$0 bucket syncdir [prefix]"
exit 1
fi
@sennajox
sennajox / scan_port.sh
Created August 19, 2014 06:29
Scan port with nmap, use 11211(memcached) and 6379(redis) as example
View scan_port.sh
#!/bin/bash
if [ $# -lt 1 ];then
echo "usage:$0 iplist"
exit 1
fi
iplist=$1
i=0
@sennajox
sennajox / slow_log_dump.py
Last active October 12, 2017 05:59
Convert the slowlog from table into logfile
View slow_log_dump.py
#!/usr/bin/env python2
"""
Queries the slowlog database table and outputs it in
the normal MySQL slow log text format.
Run this script by:
python /path/to/slow_log_dump.py dbip dbport dbusr dbpwd [start_time] [end_time] > /path/to/slow_log_dump.log
Then you can run the normal mysqldumpslow parser on the output file (slow_log_dump.log)
View MegaCli常用命令
1. raid
1.1 查看物理卷信息
/opt/MegaRAID/MegaCli/MegaCli64 -pdlist -aall
1.2 查看逻辑卷+物理卷
/opt/MegaRAID/MegaCli/MegaCli64 -ldpdinfo -aall
1.2.1 查看逻辑卷
/opt/MegaRAID/MegaCli/MegaCli64 -ldinfo -lall -aall
View mha搭建步骤
1. 建立DB节点
(其中2台为master,另一台为slave);
以master1作为主库
master1特殊配置:
# custom
server-id = 1001
log_bin = mysql-bin
log_bin_index = mysql-bin.index
log-slave-updates
@sennajox
sennajox / tbdba-restore-mysqldump.pl
Created November 7, 2013 14:10
A copy of tbdba-restore-mysqldump.pl
View tbdba-restore-mysqldump.pl
#!/usr/bin/perl
# First written by orczhou.com orchzou@gmail.com
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 2 of the License.
# How faster it is:
# $ls -lh backup.sql.gz
# -rw-r--r-- 1 mysql dba 14G Nov 21 04:49 backup.sql.gz
@sennajox
sennajox / straceall.sh
Created October 22, 2013 18:09
A simple script to strace a group of processes
View straceall.sh
#!/bin/bash
if [ $# -lt 1 ];then
echo "usage:$0 process_name"
exit 1
fi
process_name="$1"
function straceall()
@sennajox
sennajox / Methods of disk io performance testing
Last active March 5, 2023 11:38
Methods of disk io performance testing
View Methods of disk io performance testing
测试磁盘IO性能的几种方法
在磁盘测试中最关心的几个指标分别为:iops(每秒执行的IO次数)、bw(带宽,每秒的吞吐量)、lat(每次IO操作的延迟)。
当每次IO操作的block较小时,如512bytes/4k/8k等,测试的主要是iops。
当每次IO操作的block较大时,如256k/512k/1M等,测试的主要是bw。
1. 最简单的dd
dd是linux自带的磁盘读写工具,可用于测试顺序读写。
一般而言,磁盘读写有两种方式:BufferIO、DirectIO,DirectIO可以更好的了解纯磁盘读写的性能。
1.1 dd测试DirectIO
@sennajox
sennajox / delete_filter.sh
Created April 19, 2013 11:16
A simple script for checking whether the deleted files still in existed_list(mayby recover)
View delete_filter.sh
#!/bin/bash
if [ $# -lt 2 ];then
echo "usage:$0 deleted_list existed_list"
exit 1
fi
deleted_list=$1
existed_list=$2