我需要學習node.js和mongodb,它需要我使用我的mac osx,所以我是shell命令行界面的新手。mongodb安裝失敗
問題:當我按照mongodb網站上的指示並安裝了mongodb並嘗試運行時,出現以下錯誤消息。任何想法出了什麼問題?
我所做的:
brew install mongodb
sudo mkdir -p /data/db
sudo chmod 0755 /data/db
sudo chown mongod:mongod /data/db
錯誤:chown: mongod: Invalid argument
我所做的下一步:
mongod
錯誤:
Mon Nov 21 18:55:08 [initandlisten] MongoDB starting : pid=28304 port=27017 dbpath=/data/db/ 64-bit host=MacBook-Air.local
Mon Nov 21 18:55:08 [initandlisten] db version v2.0.1, pdfile version 4.5
Mon Nov 21 18:55:08 [initandlisten] git version: 3a5cf0e2134a830d38d2d1aae7e88cac31bdd684
Mon Nov 21 18:55:08 [initandlisten] build info: Darwin erh2.10gen.cc 9.6.0 Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008; root:xnu-1228.9.59~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_40
Mon Nov 21 18:55:08 [initandlisten] options: {}
Mon Nov 21 18:55:08 [initandlisten] exception in initAndListen: 10309 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
Mon Nov 21 18:55:08 dbexit:
Mon Nov 21 18:55:08 [initandlisten] shutdown: going to close listening sockets...
Mon Nov 21 18:55:08 [initandlisten] shutdown: going to flush diaglog...
Mon Nov 21 18:55:08 [initandlisten] shutdown: going to close sockets...
Mon Nov 21 18:55:08 [initandlisten] shutdown: waiting for fs preallocator...
Mon Nov 21 18:55:08 [initandlisten] shutdown: lock for final commit...
Mon Nov 21 18:55:08 [initandlisten] shutdown: final commit...
Mon Nov 21 18:55:08 [initandlisten] shutdown: closing all files...
Mon Nov 21 18:55:08 [initandlisten] closeAllFiles() finished
Mon Nov 21 18:55:08 [initandlisten] shutdown: removing fs lock...
Mon Nov 21 18:55:08 [initandlisten] couldn't remove fs lock errno:9 Bad file descriptor
Mon Nov 21 18:55:08 dbexit: really exiting now
做一個ls -ld /data/db
給出:
drwxr-xr-x 2 root wheel 68 Nov 21 18:46 /data/db