mongodb启动失败[转]

news/2024/7/7 18:54:17

现象:
查看日志的内容如下
Tue Jan  4 09:51:37 MongoDB starting : pid=2794 port=27017 dbpath=/var/lib/mongodb 32-bit

** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
**       see http://blog.mongodb.org/post/137788967/32-bit-limitations

Tue Jan  4 09:51:37 db version v1.6.5, pdfile version 4.5
Tue Jan  4 09:51:37 git version: 0eb017e9b2828155a67c5612183337b89e12e291
Tue Jan  4 09:51:37 sys info: Linux domU-12-31-39-01-70-B4 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:39:36 EST 2008 i686 BOOST_LIB_VERSION=1_37
**************
old lock file: /var/lib/mongodb/mongod.lock.  probably means unclean shutdown
recommend removing file and running –repair
see: http://dochub.mongodb.org/core/repair for more information
*************
Tue Jan  4 09:51:37 exception in initAndListen std::exception: old lock file, terminating
Tue Jan  4 09:51:37 dbexit:

Tue Jan  4 09:51:37 shutdown: going to close listening sockets…
Tue Jan  4 09:51:37 shutdown: going to flush oplog…
Tue Jan  4 09:51:37 shutdown: going to close sockets…
Tue Jan  4 09:51:37 shutdown: waiting for fs preallocator…
Tue Jan  4 09:51:37 shutdown: closing all files…
Tue Jan  4 09:51:37     closeAllFiles() finished

Tue Jan  4 09:51:37 dbexit: really exiting now

解决办法:
sudo rm /****/***/mongodb/mongodb.log
sudo rm /***/***/mongodb/mongod.lock
sudo /app/tools/mongodb/bin/mongod –repair –dbpath /app/mongodb/data –repairpath /tmp/mongodb


现象:
Sat Jan 29 12:35:35 MongoDB starting : pid=8298 port=27017 dbpath=/var/lib/mongodb 32-bit** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
**       see http://blog.mongodb.org/post/137788967/32-bit-limitations

Sat Jan 29 12:35:35 db version v1.6.5, pdfile version 4.5
Sat Jan 29 12:35:35 git version: 0eb017e9b2828155a67c5612183337b89e12e291
Sat Jan 29 12:35:35 sys info: Linux domU-12-31-39-01-70-B4 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:39:36 EST 2008 i686 BOOST_LIB_VERSION=1_37
Sat Jan 29 12:35:35 exception in initAndListen std::exception: Unable to create / open lock file for lockfilepath: /var/lib/mongodb/mongod.lock errno:13 Permission denied, terminating
Sat Jan 29 12:35:35 dbexit:

Sat Jan 29 12:35:35 shutdown: going to close listening sockets…
Sat Jan 29 12:35:35 shutdown: going to flush oplog…
Sat Jan 29 12:35:35 shutdown: going to close sockets…
Sat Jan 29 12:35:35 shutdown: waiting for fs preallocator…
Sat Jan 29 12:35:35 shutdown: closing all files…
Sat Jan 29 12:35:35     closeAllFiles() finished

Sat Jan 29 12:35:35 shutdown: removing fs lock…
Sat Jan 29 12:35:35 couldn’t remove fs lock errno:9 Bad file descriptor
Sat Jan 29 12:35:35 dbexit: really exiting now

解决方法:

  • Manually remove the lockfile: sudo rm /var/lib/mongodb/mongod.lock
  • Run the repair script: sudo -u mongodb /usr/bin/mongod -f /etc/mongodb.conf --repair.
    • You must run this command as the mongodb user. If you run it as root, then root will own files in /var/lib/mongodb/ that are necessary to run the mongodb daemon and therefore when the daemon trys to run later as the mongodb user, it won’t have permissions to start. In that case you’ll get this error: Unable to create / open lock file for lockfilepath: /var/lib/mongodb/mongod.lock errno:13 Permission denied, terminating.
    • On Ubuntu, you must specify the configuration file /etc/mongodb.conf using the -f flag. Otherwise it will look for the data files in the wrong place and you will see the following error: dbpath (/data/db/) does not exist, terminating.
  • Now you can start your MongoDB server with sudo start mongodb and verify it is running with sudo status mongodb and by trying to connect to it with mongo test.

http://www.niftyadmin.cn/n/3649138.html

相关文章

Android的各种Drawable讲解

Android把可绘制的对象抽象为Drawable,不同的图形图像资源就代表着不同的drawable类型。Android FrameWork提供了一些具体的Drawable实现,通常在代码中都不会直接接触Drawable的实现类。在实际的开发过程中,会把使用到的资源都放置在res/draw…

使用黑盒测试在 Go 中重写 Bash 脚本

目录 前言: 开始 准备工作 描述行为:Bats 简介 行为描述:陷阱 描述行为:设计测试 重写:让我们开始用go吧! 重构和更新:实现胜利 结论 前言: 使用黑盒测试在Go中重写Bash脚本…

Ormlite的工具使用

配置 compile com.j256.ormlite:ormlite-android:5.0 使用 常用注解 DatabaseTable(tableName "t_user") 指定实体和表的一一对应关系 DatabaseField() 指定属性与表中列的一一对应关系 常用配置说明: 主键:id true 自增主键:gen…

如何在Ubuntu 18.04上使用Ansible使用LAMP安装和设置WordPress

介绍 (Introduction) Server automation now plays an essential role in systems administration, due to the disposable nature of modern application environments. Configuration management tools such as Ansible are typically used to streamline the process of aut…

Windows文本框星号密码查看器

Windows文本框星号密码查看器本人2002的学习作品作者:成晓旭1、 设计原理:注册一个系统级鼠标挂钩,通过监测系统鼠标所在Windows窗口来获取密码,成功获取密码之后,通过发送自定义的Windows系统消息,到宿主…

Celery 链接RabbitMQ报错CRITICAL/MainProcess] Frequent restarts detected: RestartFreqExceeded('5 in 1s',)

为了别人,也是为了将来自己忘了,备忘一个问题 在实现Celery链接RabbitMQ的时候,感觉万事具备了,却报错: CRITICAL/MainProcess] Frequent restarts detected: RestartFreqExceeded(5 in 1s,) raceback (most recent ca…

简单使用style实现沉浸式状态栏

我之前也写过一个沉浸式的文章&#xff1a;http://blog.csdn.net/qq_24675479/article/details/78557698 今天写一个比较简单点的&#xff1a; 默认情况下的style&#xff1a; <resources><!-- Base application theme. --><style name"AppTheme" p…

ts构建koa_如何使用Koa构建“ Hello World”应用程序

ts构建koa介绍 (Introduction) Express is one of the most popular Node.js frameworks out there. Koa is a new web framework created by the team behind Express. It aims to be a modern and more minimalist version of Express. Some of its characteristics are its …