MongoDB shell version: 3.0.6 connecting to: test Server has startup warnings: 2017-01-26T17:25:54.657+0800 I CONTROL [initandlisten] 2017-01-26T17:25:54.657+0800 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
經過終端ulimit -a顯示,指的是 -n openfile選項mongodb
$mongoimport --db test --collection restaurants --drop --file ~/downloads/primer-dataset.json
2017-01-26T17:27:11.882+0800 [........................] test.restaurants 0.0 B/11.3 MB (0.0%)
2017-01-26T17:27:12.409+0800 Failed: error connecting to db server: no reachable servers
2017-01-26T17:27:12.409+0800 imported 0 documents
$ mongorestore dump --host=127.0.0.1
2017-01-26T17:27:42.124+0800 building a list of dbs and collections to restore from dump dir
2017-01-26T17:27:42.125+0800 Failed: error scanning filesystem: error reading root dump folder: open dump: no such file or directory
$ mongoimport --host=127.0.0.1 --db test --collection restaurants --drop --file ~/downloads/primer-dataset.json
2017-01-26T17:32:44.206+0800 connected to: 127.0.0.1
2017-01-26T17:32:44.207+0800 dropping: test.restaurants
2017-01-26T17:32:45.572+0800 imported 25359 documents
百思不得其解,按照官網代碼敲出來的,不過沒用。加上--host=127.0.0.1來讓mongodb知道host是本機。網上說3.0.7之後不會有這個問題,但顯然我遇到了。 shell