6

I am using felixge/node-mysql module to interact with MySQL database from node.js. I have met the problem when inserting large amounts of data to database in one INSERT request.

Although here there is description of how to add 500,000 records to database using large INSERT-queries, my script fails with the following error with much more small amounts of data:

{ [Error: write EPIPE] code: 'EPIPE', errno: 'EPIPE', syscall:
'write', fatal: true }

I think that this bug is somehow linked with the issue #359 in mysql-node's github Load data infile fails with EPIPE for large files, which is not assigned to someone yet for the last 5 months since creation.

So the what is practical size of queries which are guaranteed to be delivered?

4

2 回答 2

6

我刚才遇到了这个问题,结果发现我正在与之交谈的 Mysql 服务器(它在 Amazon RDS 上)的max_allowed_packet选项设置得非常低。增加这为我解决了这个问题。

mysql通过在命令行上运行(非常长的)查询并搜索我得到的错误消息,我得到了我需要的线索。然后我从这里获得了关于增加 Amazon RDS 选项的说明:http: //dev.n0ise.net/2012/10/amazon-rds-error-2006-hy000-at-line-xxx-mysql-server-has-走了/

另请参阅此 SO 答案以查看该选项在您的特定数据库上设置的内容:https ://stackoverflow.com/a/5688506/496046

于 2014-01-20T21:54:47.153 回答
2

我也遇到过这个问题。

我试过这个库:https ://github.com/sidorares/node-mysql2

它是 felixge 的 mysql 驱动程序的替代品,我没有看到使用它的 EPIPE 错误。

于 2013-05-31T17:49:13.057 回答