Exemplo n.º 1
0
def main():
	mysql_init()
	connect2gearman()
	connect2redis(host="127.0.0.1")
	RecvLog.recv_redis_log()
#	collect_log()
	pass
Exemplo n.º 2
0
def redis_logs2sqlList():
	mysql_init()
	myredis.connect2redis(host='127.0.0.1')
	while True:
		sql_str = myredis.redis_q.get('BiglogSqlList')
		sql_dic = json.loads(sql_str)
		sql = sql_dic['sql']
		args = sql_dic['args']
		biglog_mysql.mysql_instance.insert_many_log(sql,args)
Exemplo n.º 3
0
def redis_worker():
	myredis.connect2redis(host='127.0.0.1')
	mysql_init()
	while True:
		db_name = myredis.redis_q.get('BiglogDomainDB')
		DomainDB.db_exists(db_name)
Exemplo n.º 4
0
	db_name = json.loads(job.data)
#	print db_name['db_name']
	if not DomainDB.db_exists(db_name):
#		print "[ERROR GEARMAN %s]: [moudle:log_db] [create %s failured]"% (time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())),db_name)
		return "False"
	return "True"

"""read from gearman and create database"""
def gearman_worker():
	try :
		new_worker = CustomGearmanWorker(['127.0.0.1'])
	except Exception,e:
		print "[ERROR GEARMAN]: %s"% (time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())))
		print "%s\n"%(str(e))
		sys.exit(1)

	mysql_init()
	new_worker.register_task("BigLogDomain",create_db)
	new_worker.work()

def redis_worker():
	myredis.connect2redis(host='127.0.0.1')
	mysql_init()
	while True:
		db_name = myredis.redis_q.get('BiglogDomainDB')
		DomainDB.db_exists(db_name)

if __name__ == '__main__':
	redis_worker()
#	gearman_worker()
Exemplo n.º 5
0
def redis_logs2sql():
	mysql_init()
	myredis.connect2redis(host='127.0.0.1')
	while True:
		sql_cmd = myredis.redis_q.get('BiglogSql')
		biglog_mysql.mysql_instance.insert_log(sql_cmd)