RTBKit
0.9
Open-source framework to create real-time ad bidding systems.
|
00001 #!/usr/bin/python 00002 import redis 00003 import time 00004 import argparse 00005 import string 00006 import sys 00007 00008 if len(sys.argv < 3): 00009 raise Exception("expected source and target hosts as arguments") 00010 00011 # Copy Keys from one redis database to another 00012 r = redis.Redis(host=sys.argv[1], port=6379) 00013 newR = redis.Redis(host=sys.argv[2], port=6379) 00014 print "Connected to Redis...retrieving keys" 00015 campaigns = r.keys('campaigns:*') 00016 print "retrieved all keys" 00017 for c in campaigns: 00018 print(c) 00019 values = r.hgetall(c) 00020 newR.hmset(c,values) 00021