我們如何導入一個具有500K行以上的表?如果以塊爲單位進行導入將是解決方案,那麼是否有關於將csv數據導入mongodb的教程?Mongoimport csv(> 500K rows/documents)錯誤,通過塊導入csv到mongodb
我試圖導入CSV文件,其中包含2,710,000行,使用以下命令:
mongoimport -d test -c transact --type csv --file transact.csv --headerline
它給出了一個錯誤:
2015-11-02T12:44:35.420-0500 connected to: localhost
2015-11-02T12:44:38.419-0500 [........................] test.transact
11.7 MB/397.5 MB (2.9%)
2015-11-02T12:44:41.414-0500 [#.......................] test.transact
22.1 MB/397.5 MB (5.6%)
2015-11-02T12:44:44.413-0500 [##......................] test.transact
33.8 MB/397.5 MB (8.5%)
2015-11-02T12:44:47.414-0500 [##......................] test.transact
44.0 MB/397.5 MB (11.1%)
2015-11-02T12:44:50.420-0500 [###.....................] test.transact
55.3 MB/397.5 MB (13.9%)
2015-11-02T12:44:53.413-0500 [###.....................] test.transact
66.1 MB/397.5 MB (16.6%)
2015-11-02T12:44:55.962-0500 [####....................] test.transact
73.5 MB/397.5 MB (18.5%)
2015-11-02T12:45:07.501-0500 Failed: read error on entry #500899: line 500900
, column 140: extraneous " in field
2015-11-02T12:45:07.502-0500 imported 500000 documents
爲什麼只有500K可以裝載到MongoDB的? 我在網上看了:
Maximum Number of Documents Per Chunk to Migrate
MongoDB cannot move a chunk if the number of documents in the chunk exceeds either 250000 documents or 1.3 times the number of average sized documents that the maximum chunk size can hold.
來源: https://docs.mongodb.org/manual/reference/limits/
我也正好碰上了開發商的博客誰也遇到了類似的問題:
Seriously? Seriously? MongoDB dies after about 500,000 documents, silently corrupting my data, not issuing any warnings and then refusing to let me even read it? I’ve never seen such broken behaviour in any other piece of software I’ve used. I went back to the channel, seething (I can’t imagine the guys in there were very happy with providing free support to an angry person, but they were helpful nonetheless), and detailed my predicament. Obviously, the solution would be to reformat my server and install a 64-bit OS if I wanted to have more than 500k documents in the database.
來源: http://www.stavros.io/posts/my-experience-with-using-mongodb-for-great-science/
我們如何導入一個超過500K的表格OWS?如果以塊爲單位進行導入將是解決方案,那麼是否有關於將csv數據導入mongodb的教程?