Skip to content

Instantly share code, notes, and snippets.

@idning
idning / gist:b23c4d4fe76da5b00ae3
Created April 29, 2015 06:09
test_codis_mem.py
import threading
import os
import time
import commands
import redis
class RedisServer(threading.Thread):
def __init__(self, binary = 'redis-server', port = 7777):
threading.Thread.__init__(self)
self.binary = binary
@idning
idning / gist:03f43b6789f14e1fe878
Last active August 29, 2015 14:20
test_codis_mig.py
import threading
import os
import time
import commands
import redis
class RedisServer(threading.Thread):
def __init__(self, binary = 'redis-server', port = 7777):
threading.Thread.__init__(self)
self.binary = binary
@idning
idning / gist:11279924
Created April 25, 2014 06:49
mongodb-pre-split
#3. Pre-Splitting
# export_size > 64K(records) and no data in dest collection
chunksize = self.args.chunksize # default 64K items (for 64MBytes chunksize)
maxshardkey = self.args.maxshardkey
if not(self.pre_src_count > chunksize and self.pre_to_count == 0):
logging.info('we will not pre-split !')
return
logging.info('we will pre-split by chunksize: %d, maxshardkey is: %d' % (chunksize, maxshardkey))
import os
import logging
import pybcs
#设置日志级别
pybcs.init_logging(logging.INFO)
AK = os.environ['AK'] #请改为你的AK