#coding=utf-8
import happybase
port = xxxxxx
host = xxxxxx
class HbaseConPool(object):
'''hbase连接池'''
def __init__(self):
'''
Constructor
'''
self.pool = happybase.ConnectionPool(size=20,host=xxx,port=xxx,timeout=60000*2)
def __new__(cls,*args,**kwargs):
'''
'''
if not hasattr(cls,'_inst'):
cls._inst=super(HbaseConPool,cls).__new__(cls,*args,**kwargs)
return cls._inst
# def createHbaseConPool(self):
# pool = happybase.ConnectionPool(5,host=constant.HBASE_HOST,port=constant.HBASE_PORT)
def get_conn(self):
'''从hbase连接池中获得一个hbase链接'''
import happybase
port = xxxxxx
host = xxxxxx
class HbaseConPool(object):
'''hbase连接池'''
def __init__(self):
'''
Constructor
'''
self.pool = happybase.ConnectionPool(size=20,host=xxx,port=xxx,timeout=60000*2)
def __new__(cls,*args,**kwargs):
'''
'''
if not hasattr(cls,'_inst'):
cls._inst=super(HbaseConPool,cls).__new__(cls,*args,**kwargs)
return cls._inst
# def createHbaseConPool(self):
# pool = happybase.ConnectionPool(5,host=constant.HBASE_HOST,port=constant.HBASE_PORT)
def get_conn(self):
'''从hbase连接池中获得一个hbase链接'''