Python tule转dict
[root@virtdb55 py]# vi tuledict.pyimport MySQLdb as mdbimport os,time,sysimport commands as coimport datetimeuser = 'root'password = '123456'servername='192.168.2.55'con_1 = mdb.connect(servername,'root','123456','mysql');cur_1 = con_1.cursor()cur_1.execute("select id,user,host,db,...
pt-online-schema-change在线DDL
操作的表必须有主键否则会出错误加字段:pt-online-schema-change -u root -h 127.0.0.1 -p 123456 --alter='add column address varchar(20) ' --execute D=test,t=t4 加索引: pt-online-schema-change -u root -h 127.0.0.1 -p 123456 --alter='add key idx_address(address)' --execu...
性能监控小工具
atop:http://www.atoptool.nl/downloadatop.phpwget http://www.atoptool.nl/download/atop-2.2-3.sysv.x86_64.rpmrpm -ivh atop-2.2-3.sysv.x86_64.rpm
oracle 11.2.0.4安装 vncserver ?
oracle 11.2.0.4安装 vncserveryum whatprovides "*/xhost"xorg-x11-server-utils-7.7-14.el6.x86_64 : X.Org X11 X server utilitiesRepo : baseMatched from:Filename : /usr/bin/xhostyum install xorg-x11-server-utils-7.7-14.el6.x86_64 -yyum install xorg-x11-...
linux根据命令查找包
yum whatprovides "*/xhost"xorg-x11-server-utils-7.7-14.el6.x86_64 : X.Org X11 X server utilitiesRepo : baseMatched from:Filename : /usr/bin/xhostyum install xorg-x11-server-utils-7.7-14.el6.x86_64 -y
Oracle11.2.0.4 Linux 64bit FTP下载地址
Oracle11GU4介质FTP下载地址Oracle11.2.0.4 Linux 64bit FTP下载地址server:ftp://104.236.52.210/p13390677_112040_Linux-x86-64_1of7.zip ftp://104.236.52.210/p13390677_112040_Linux-x86-64_2of7.zipclient:ftp://104.236.52.210/p13390677_112040_Linux-x86-64_3of7.zip...
yum 下载rpm包
yum -y install --downloadonly --downloaddir=/tmp python-psutil.x86_64
Pycharm使用
快捷键:Ctrl + Alt + I 自动缩进行Ctrl + Shift + NumPad- 收缩所有的代码块TAB Shift+TAB 缩进/取消缩进所选择的行Ctrl + Alt + L 代码格式化
Python 给list加序号并转成字典
给list 加序号,转成字典 ls3 =['a','b','c','d','e','f']d = dict(enumerate(ls3))print d
Python 查找字符串方法2
#!/bin/env python#-*- coding:utf-8 -*-# multiple searches of a string for a substring# using s.find(sub[ ,start[, end]])text = "create table t11 (id int,name varchar(20),age int,status varchar(10),sary int unsigned)"search = 'int'start = 0while True: index = text.find(s...
Python 查找字符串方法1
#!/bin/env python#-*- coding:utf-8 -*-import retext = "create table t11 (id int,name varchar(20),age int,status varchar(10),sary int unsigned)"regex = re.compile(r'\w*int\w*')result = regex.findall(text)print len(result)for i in range(len(result)): print result[i]print regex...
vi使用
行首:0行尾:shift+4
Python threading多线程
[root@virtdb56 ~]# vi mythread.py#!/usr/bin/env python#-*- coding: UTF-8 -*-import pymongoimport threadingimport sysimport randomimport MySQLdb as mdbimport os,time,sysimport commands as coimport datetimedef myinsert(i, num_of_op): for row in range(0,int(num_of_o...
Python multiprocessing 多进程
[root@virtdb56 ~]# more mutiprocessmysql.py #!/usr/bin/env python#-*- coding: UTF-8 -*-import MySQLdb as mdbfrom multiprocessing import Pool,Processimport threadingcon_2 = mdb.connect('192.168.2.52','root','123456','test');cur_2 = con_2.cursor()def myinsert(i): ...
YCSB测试工具应用之Mongo压力测试
YCSB测试工具应用之Mongo压力测试https://github.com/brianfrankcooper/YCSB/tree/master/mongodb安装javayum install java-devel安装mavenwget http://ftp.heanet.ie/mirrors/www.apache.org/dist/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gztar xzf apache-maven-*-bin.tar.gz -C /usr/loca...
批量杀进程的shell脚本
批量杀进程的shell脚本ps -ef | grep processname | grep username | grep -v grep | awk {'print $2'} | xargs kill -9
twemproxy redis简单测试
twemproxy分布式中间件:安装:yum install automake libtool -ygit clone git://github.com/twitter/twemproxy.git cd twemproxy autoreconf -fvi ./configure --enable-debug=log make src/nutcracker -h 3.配置cp ./conf/nutcracker.yml /etc/[root@virtdb54 s...
监控redis性能
监控redis性能http://www.cnblogs.com/mushroom/p/4738170.htmlredis-cli -h 192.168.2.59 -p 6000 -a 123456 info | grep -e "connected_clients" -e "blocked_clients" -e "used_memory_human" -e "used_memory_peak_human" -e "rejected_connections" -e "evicted_keys" -e "instantaneous" -e "used_cpu_sys" -e "u...
Redis 3.2 主从复制及sentinel自动切换
redis 主从复制及高可用redis编译安装:wget http://download.redis.io/releases/redis-3.2.1.tar.gztar zxvf redis-3.2.1.tar.gzcd /soft/redis-3.2.1make && make install[root@node1 src]# which redis-cli创建目录master:mkdir -p /opt/redis/node6000/data mkdir -p /opt/redis/node6000/log...
Redis缓存应用、分片应用测试
数据类型:如果只用string类型,则相当于memcachedstring类型及操作set name chenhaoget namesetnx name chenhao设置KEY有效期setex name 10 chenhao为KEY加子串setrange name 8 wzgchen@gmail.com一次设置多个 key 的值mset name chen wan xiao 获取 key 对应的 string 值 get na...