【问题标题】:how to get lot size of data from hbase by happybase at the same time?如何通过happybase同时从hbase获取大量数据?
【发布时间】:2017-01-11 09:06:51
【问题描述】:

我正在尝试像这样从 hbase 获取数据:

key = pd.read_sql('select key from table',hive_engine)
table = connection.table('games_ut')

res = {}
n = 0
for key in table.key:
    res[str(key)] = table.row(b'{key}'.format(key=key))
    n += 1
    if n % 100000 == 0:
        print(str(n) + " has been read,need a sleep!")
        sleep(0.5)

sleep(0.5) 表示休息。 如您所见,代码运行良好但速度太慢,给集群带来了很大压力。因为密钥长度超过 4000 万。

所以,我想知道有什么方法可以同时获取数据批量大小。我尝试使用 table.rows(),但失败了..... 我是新手,真的如何通过循环同时生成批量数据。

【问题讨论】:

  • 没有分析就不清楚什么是慢的。例如,在 dict 中存储这么多数据也可能很慢。

标签: python loops for-loop hbase happybase


【解决方案1】:

经过我的尝试......我知道该怎么做了。

只需使用行并将列表作为键传递...

【讨论】:

    猜你喜欢
    • 2017-10-23
    • 1970-01-01
    • 2017-12-12
    • 2015-11-27
    • 1970-01-01
    • 1970-01-01
    • 2016-10-30
    • 1970-01-01
    • 2013-03-11
    相关资源
    最近更新 更多