我通过自制软件在Mac上安装了mongodb。然后我试着通过mongodb启动它。失败。然后我按mongod --dbpath /data/db
开始。然后它永远等待。如何启动mongodb?
2015-08-22T16:08:52.619+0100 I CONTROL [initandlisten] build info: Darwin mimac 14.4.0 Darwin Kernel Version 14.4.0: Thu May 28 11:35:04 PDT 2015; root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
2015-08-22T16:08:52.619+0100 I CONTROL [initandlisten] allocator: system
2015-08-22T16:08:52.619+0100 I CONTROL [initandlisten] options: { storage: { dbPath: "/data/db/" } }
2015-08-22T16:08:52.628+0100 I NETWORK [initandlisten] waiting for connections on port 27017
答案 0 :(得分:1)
要自动启动mongodb
,您可以使用命令:
ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist;
答案 1 :(得分:1)
有正在运行的服务器后,您可以:
mongoimport -d database_name -c collection_name< filename.json
mongoimport可以导入json,csv和tsv文件。