【问题标题】:how to push data into mongodb using sparkfun phant?如何使用 sparkfun phant 将数据推送到 mongodb?
【发布时间】:2015-11-10 07:28:52
【问题描述】:

我是 phant 新手,使用 mongodb 找不到关于 phant 的合适文档。因为我有很多数据并且会发生内存溢出。最后我陷入了以下错误:

    HTTP output: { [Error: EMFILE, open 'phant_streams/4d16/83403f7611e5810d57f88174fbef/stream.csv']
  errno: -24,
  code: 'EMFILE',
  path: 'phant_streams/4d16/83403f7611e5810d57f88174fbef/stream.csv' }
events.js:87
      throw Error('Uncaught, unspecified "error" event.');
            ^
Error: Uncaught, unspecified "error" event.
    at Error (native)
    at Function.emit (events.js:87:13)
    at Function.<anonymous> (/usr/lib/node_modules/phant/node_modules/phant-manager-http/index.js:237:12)
    at PhantMeta.<anonymous> (/usr/lib/node_modules/phant/node_modules/phant-meta-nedb/lib/phant-meta-nedb.js:243:14)
    at callback (/usr/lib/node_modules/phant/node_modules/phant-meta-nedb/node_modules/nedb/lib/executor.js:30:17)
    at /usr/lib/node_modules/phant/node_modules/phant-meta-nedb/node_modules/nedb/lib/datastore.js:536:25
    at /usr/lib/node_modules/phant/node_modules/phant-meta-nedb/node_modules/nedb/lib/persistence.js:201:12
    at fs.js:1077:21
    at FSReqWrap.oncomplete (fs.js:95:15)

除了有时还会出现以下错误:

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory

这就是为什么我想使用 mongodb 来防止这个错误。我对此进行了搜索,最后找到了 mongodb 的 sparckfun 库: https://github.com/sparkfun/phant-stream-mongodb

我安装了这个,但什么也没发生,因为数据仍然没有串入 mongo。 那么,我将如何将 phant 数据存储到 mongodb 中?

【问题讨论】:

    标签: node.js mongodb node.js-stream


    【解决方案1】:

    我遇到了同样的问题,特别是尝试在 Heroku 上部署我自己的 Phant 实例(因为我想绕过 Sparkfun 的 50Mb 限制)。在尝试了一些 mongodb 和 mongoose 库的版本之后,我成功地分叉并修改了他们的存储库,以便您可以在本地运行它或直接部署在 heroku 上(只要确保您提供了 MongoLab 附加组件)。在这里查看我的叉子:https://github.com/davidlago/phant

    希望这会有所帮助!

    【讨论】:

      猜你喜欢
      • 2015-02-09
      • 2020-11-16
      • 1970-01-01
      • 2017-09-19
      • 1970-01-01
      • 1970-01-01
      • 2019-04-30
      • 2021-10-17
      相关资源
      最近更新 更多