aliyun / aliyun-odps-python-sdk

ODPS Python SDK and data analysis framework
http://pyodps.readthedocs.io
Apache License 2.0
434 stars 97 forks source link

odps数据迁移,出现内存溢出,该如何有效解决这个问题? #72

Closed iris-qq closed 6 years ago

iris-qq commented 6 years ago

我在使用python对odps数据进行迁移到ES的时候,由于数据量过大,导致内存溢出。由于数据没有办法分批查询,(odps不能像mysql那样,select * from table limit %s,10000000;)目前也不可能弄一个非常大内存的服务器来跑,所以想问下,有没有什么好的办法解决这个问题。一个表大概5E条数据。领导让我用kafka做一个队列,我没用过,但是感觉队列也是在内存中的,这么做真的能解决问题吗?

qinxuye commented 6 years ago

有 tunnel 接口来读数据,http://pyodps.readthedocs.io/zh_CN/latest/base-tables-zh.html#tunnel

但我觉得这个事可能并不适合用 python 来做,可以考虑比如 datax(这个我不知道能不能导到 ES),或者一些开源的导数据工具,这些 MaxCompute 都有实现相应的 reader。

iris-qq commented 6 years ago

刚看见,确实是用datax解决的。odps有reader和writer,es刚好是有个writer。在es的服务器升级到八核16g的时候,已经差不多了,接下来再升级下配置,应该就能完美解决了。还是要谢谢你哦。小伙子。