尝试启动mongodb时出错 [英] Error trying to start mongodb

查看:435
本文介绍了尝试启动mongodb时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,当尝试启动mongodb,下面我告诉你的错误:

  xxx @ xxx [/ var / lib / mongo]#/etc/init.d/mongod start 
启动mongod:所有输出到:/var/log/mongo/mongod.log
[FAILED]



查看mongod.log我收到以下通知:

  ***** SERVER RESTARTED ***** 


Thu Mar 21 12:10:20.860 [initandlisten] MongoDB starting:pid = 19148 port = 27017 dbpath = / var / lib / mongo 64位主机= srv1.canoa.net
Thu Mar 21 12:10:20.860 [initandlisten] db版本v2.4.0
Thu Mar 21 12:10 :20.860 [initandlisten] git版本:ce2d666c04b4a80af58e8bbb3388b0680e8cfeb6
Thu Mar 21 12:10:20.860 [initandlisten] build info:Linux ip-10-2-29-40 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION = 1_49
Thu Mar 21 12:10:20.861 [initandlisten] allocator:tcmalloc
Thu Mar 21 12:10:20.861 [initandlisten]选项:{config:/etc/mongod.conf,dbpath:/ var / lib / mongo,logappend:true,logpath:/var/log/mongo/mongod.log,pidfilepath: var / run / mongodb / mongod.pid}
Thu Mar 21 12:10:20.861 [initandlisten] initAndListen中的异常:10309无法创建/打开锁文件:/var/lib/mongo/mongod.lock errno :13 Permission denied是一个mongod实例已经运行?,终止
Thu Mar 21 12:10:20.861 dbexit:
Thu Mar 21 12:10:20.861 [initandlisten] shutdown:关闭侦听套接字。 ..
Thu Mar 21 12:10:20.861 [initandlisten] shutdown:going to flush diaglog ...
Thu Mar 21 12:10:20.861 [initandlisten] shutdown:关闭套接字...
Thu Mar 21 12:10:20.861 [initandlisten] shutdown:等待fs preallocator ...
Thu Mar 21 12:10:20.861 [initandlisten] shutdown:lock for final commit ...
Thu Mar 21 12:10:20.861 [initandlisten] shutdown:final commit ...
Thu Mar 21 12:10:20.861 [initandlisten] shutdown:关闭所有文件...
Thu Mar 21 12:10:20.861 [initandlisten] closeAllFiles()完成
Thu Mar 21 12:10:20.861 [initandlisten] shutdown:removed fs lock ...
Thu Mar 21 12:10:20.861 [initandlisten]不能删除fs lock errno:9错误的文件描述符
Thu Mar 21 12:10:20.861 dbexit:真正退出

让我注意的东西是:



Thu Mar 21 12:10:20.861 [initandlisten] exception in initAndListen:10309无法创建/打开锁文件:/var/lib/mongo/mongod.lock errno:13权限被拒绝是一个mongod实例已经运行?,终止



/ var / lib / mongo中的文件夹和文件具有0755权限。



如果任何人都能告诉我一种方法,

解决方案

我解决了错误,这是因为我只有 mongod 用户分配给 / var / lib / mongo ,但不是其中的文件,以下命令解析了此部分: chown -R mongod :mongod / var / lib / mongo



然后只需要用户修改数据库 code>使用以下命令: sudo -u mongod mongod -f /etc/mongod.conf --repair ,我终于成功启动了数据库。



我希望这对其他人有帮助。



谢谢大家的回答。

I have a problem when try to start mongodb, below I show you the error:

    xxx@xxx [/var/lib/mongo]# /etc/init.d/mongod start
    Starting mongod: all output going to: /var/log/mongo/mongod.log
                                                           [FAILED]

Seeing on mongod.log I get the following notifications:

***** SERVER RESTARTED *****


Thu Mar 21 12:10:20.860 [initandlisten] MongoDB starting : pid=19148 port=27017 dbpath=/var/lib/mongo 64-bit host=srv1.canoa.net
Thu Mar 21 12:10:20.860 [initandlisten] db version v2.4.0
Thu Mar 21 12:10:20.860 [initandlisten] git version: ce2d666c04b4a80af58e8bbb3388b0680e8cfeb6
Thu Mar 21 12:10:20.860 [initandlisten] build info: Linux ip-10-2-29-40 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_49
Thu Mar 21 12:10:20.861 [initandlisten] allocator: tcmalloc
Thu Mar 21 12:10:20.861 [initandlisten] options: { config: "/etc/mongod.conf", dbpath: "/var/lib/mongo", logappend: "true", logpath: "/var/log/mongo/mongod.log", pidfilepath: "/var/run/mongodb/mongod.pid" }
Thu Mar 21 12:10:20.861 [initandlisten] exception in initAndListen: 10309 Unable to create/open lock file: /var/lib/mongo/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
Thu Mar 21 12:10:20.861 dbexit:
Thu Mar 21 12:10:20.861 [initandlisten] shutdown: going to close listening sockets...
Thu Mar 21 12:10:20.861 [initandlisten] shutdown: going to flush diaglog...
Thu Mar 21 12:10:20.861 [initandlisten] shutdown: going to close sockets...
Thu Mar 21 12:10:20.861 [initandlisten] shutdown: waiting for fs preallocator...
Thu Mar 21 12:10:20.861 [initandlisten] shutdown: lock for final commit...
Thu Mar 21 12:10:20.861 [initandlisten] shutdown: final commit...
Thu Mar 21 12:10:20.861 [initandlisten] shutdown: closing all files...
Thu Mar 21 12:10:20.861 [initandlisten] closeAllFiles() finished
Thu Mar 21 12:10:20.861 [initandlisten] shutdown: removing fs lock...
Thu Mar 21 12:10:20.861 [initandlisten] couldn't remove fs lock errno:9 Bad file descriptor
Thu Mar 21 12:10:20.861 dbexit: really exiting now

Something that gets my attention is this:

Thu Mar 21 12:10:20.861 [initandlisten] exception in initAndListen: 10309 Unable to create/open lock file: /var/lib/mongo/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating

The folder and files inside /var/lib/mongo has 0755 permission.

If anyone can tell me a way to do this, I'd be grateful.

解决方案

I solved the error, it was because I only had mongod user assigned to the /var/lib/mongo but not the files within, the following command resolved this part: chown -R mongod:mongod /var/lib/mongo.

Then only had to repair the database with the user mongod with the following command: sudo -u mongod mongod -f /etc/mongod.conf --repair, I finally started the database successfully.

I hope this will be helpful to other.

Thank you all for your answers.

这篇关于尝试启动mongodb时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆