开发者

can't start mongo db

开发者 https://www.devze.com 2023-03-28 05:23 出处:网络
I\'m trying to start mongo db but I\'m ge开发者_运维技巧tting an error Here is the output: k-ps-macbook:~ kp$ mongod

I'm trying to start mongo db but I'm ge开发者_运维技巧tting an error Here is the output:

k-ps-macbook:~ kp$ mongod
mongod --help for help and startup options
Tue Aug 16 15:57:11 [initandlisten] MongoDB starting : pid=4143 port=27017 dbpath=/data/db/ 64-bit 
Tue Aug 16 15:57:11 [initandlisten] db version v1.8.2, pdfile version 4.5
Tue Aug 16 15:57:11 [initandlisten] git version: 433bbaa14aaba6860da15bd4de8edf600f56501b
Tue Aug 16 15:57:11 [initandlisten] build sys 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
Tue Aug 16 15:57:11 [initandlisten] couldn't open /data/db/awesome_blog.ns errno:13 Permission denied
Tue Aug 16 15:57:11 [initandlisten] error couldn't open file /data/db/awesome_blog.ns terminating
Tue Aug 16 15:57:11 dbexit: 
Tue Aug 16 15:57:11 [initandlisten] shutdown: going to close listening sockets...
Tue Aug 16 15:57:11 [initandlisten] shutdown: going to flush diaglog...
Tue Aug 16 15:57:11 [initandlisten] shutdown: going to close sockets...
Tue Aug 16 15:57:11 [initandlisten] shutdown: waiting for fs preallocator...
Tue Aug 16 15:57:11 [initandlisten] shutdown: closing all files...
Tue Aug 16 15:57:11 closeAllFiles() finished
Tue Aug 16 15:57:11 [initandlisten] shutdown: removing fs lock...
Tue Aug 16 15:57:11 dbexit: really exiting now

any help will be appreciated, thanks!


You will need read/write permissions to /data/db/


The error shows up, because you are not logged in as root user. To do that (if you use Debian), run:

sudo mongod 

Or simply:

su root

Then type the password and type

mongod

Then you will get access to the /data/db directory.


I deleted /data/db/mongod.lock to solve the problem.


From the command line, run:

  1. cd ~
  2. ./mongod --repair

If you're still having trouble getting it to run then find the /data directory (it should be inside of ~ or ~/workspace) and cd into it. Once inside, run rm mongod.lock then cd back into ~ and run ./mongod again (see below).

  1. cd ~/data
  2. rm mongod.lock
  3. cd
  4. ./mongod
0

精彩评论

暂无评论...
验证码 换一张
取 消