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...
Mysql 5.7 memcached plugin
mysql 5.7 memcached plugin通过在mysql进行写,memcached可以直接读取,适合在memcached加速读应用,不过限制多https://yq.aliyun.com/articles/8282mysql5.7 memcachedyum install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm -yyum install libaio-devel ...
Memcached学习、应用
C/S架构,纯内存,集群之间无关,C语言2000行代码,高效,libevent数据清理:memcached当内存达到设定值时,会用LRU算法删除过期数据设定数据过期内存机制:内存分配:slab allocator,原先的malloc,采用Free来回收,易出现内存碎片预先分配大小内存块chunk,再把相同尺寸的chunk分成组(slab class),这些内存块...
Oracle全库导出
expdp \"/ as sysdba\" dumpfile =oafull.dmp full=y logfile=oafull.log directory=dir_dump2 job_name=my_job
实时统计PG连接数
more listpg.sh #!/bin/bashi=1while(( $i<61 ))do send=`date '+%Y-%m-%d %H:%M:%S'` conn=`ps -ef |grep postgres |wc -l` echo $send $conn >> /tmp/pgconn.log let "i++" sleep 10done
实时统计ORACLE连接数
more conn.sh #!/bin/bashwhile truedo send=`date '+%Y-%m-%d %H:%M:%S'` conn=`ps -ef |grep LOCAL=NO |wc -l` echo $send $conn >> /tmp/oraconn.log sleep 10done
通过触发器分发同步数据
通过触发器分发同步数据create table tab(id int not null primary key,name varchar(20),age int,address varchar(200));create table tab0(id int not null primary key,name varchar(20),age int,address varchar(200));create table tab1(id int not null primary key,name varchar(20),age int,address varchar(2...
Mysql技术小疑问
1.复制过滤问题: --replicate-do-db=db_name:USE prices; UPDATE sales.january SET amount=amount+1000;Statement-based replication:对于基于语句级的复制(或mixed级别),replicate_do_db这个参数指的是默认的数据库,即当前使用的数据库(use database),在默认数据库下更新replicate_do_db指定的数据...