Skip to content

Instantly share code, notes, and snippets.

View sennajox's full-sized avatar

Sennajox sennajox

  • Shanghai, China
View GitHub Profile
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 / sync_demo.sh
Last active August 29, 2015 14:22
同步任务的示例脚本
#!/bin/bash
#
# 该脚本简单封装了UFile客户端工具filemgr的增量上传功能
#
if [ $# -lt 2 ];then
echo "usage:$0 bucket syncdir [prefix]"
exit 1
fi
@sennajox
sennajox / zkMonitor.sh
Last active October 10, 2015 12:18
A script for monitor zkserver
#!/bin/bash
log="./zookeeper.out"
if [ -f "$log" ]; then
# unit(MB)
size=`du -sm "$log" | grep "$log" | awk '{print $1}'`
limit=300
# split log
if [ $size -gt $limit ]; then
newlog="zookeeper-`date +%Y%m%d%H%M%S`.log"
@sennajox
sennajox / run_all_fio.sh
Last active October 11, 2015 03:48
a script that run with differnt iodepth, it should work with my run_fio.sh
#!/bin/bash
if [ $# -lt 2 ]; then
echo "usage:$0 dev prefix"
exit 1
fi
dev="$1"
if [ "$dev" = "" ];then
@sennajox
sennajox / t_disk.sh
Created October 29, 2012 05:25
a simple script for testing disk...
#!/bin/bash
if [ $# -lt 1 ]; then
echo "usage:$0 dev"
exit
fi
dev="$1"
echo "it will rw the dev:$dev, are you sure?[Y/n]"
read cmd
@sennajox
sennajox / test_db.py
Created November 16, 2012 05:58
A python script for press testing mysql
#!/usr/bin/env python2
import sys, os
import random
import time
import MySQLdb
if __name__ == "__main__":
@sennajox
sennajox / gen_list.py
Created November 18, 2012 04:11
Create a simple list containing random strings
#!/usr/bin/env python
import sys, os
import string
import random
def id_generator(size=6, chars=string.ascii_uppercase):
return ''.join(random.choice(chars) for x in range(size))
if __name__ == "__main__":
@sennajox
sennajox / update_nproc.sh
Last active December 14, 2015 15:28
A simple script to update the nproc of the specified process
#!/bin/bash
if [ $# -lt 1 ];then
echo "usage:$0 pid [nproc=1024000]"
exit 1
fi
pid=$1
if [ $# -ge 2 ];then
nproc="$2ll"
@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)
#!/bin/bash
if [ $# -lt 2 ];then
echo "usage:$0 deleted_list existed_list"
exit 1
fi
deleted_list=$1
existed_list=$2
@sennajox
sennajox / straceall.sh
Created October 22, 2013 18:09
A simple script to strace a group of processes
#!/bin/bash
if [ $# -lt 1 ];then
echo "usage:$0 process_name"
exit 1
fi
process_name="$1"
function straceall()