MongoDB 没有从 ubuntu 16.04 开始

标签 mongodb ubuntu ubuntu-16.04 systemctl

我在 ubuntu 16.04 上设置了 mongodb:

echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org

但是当我尝试启动服务时出现这些错误:
**~$** systemctl start mongodb
Failed to start mongodb.service: Unit mongodb.service is masked.

**~$** systemctl start mongod
Failed to start mongod.service: Unit mongod.service not found.

**~$** sudo service mongod start
Failed to start mongod.service: Unit mongod.service not found.

**~$** mongod
mongod --help for help and startup options
2016-09-04T11:20:59.074+0200 [initandlisten] MongoDB starting : pid=30207 port=27017 dbpath=/data/db 64-bit host=zantes
2016-09-04T11:20:59.074+0200 [initandlisten] db version v2.6.10
2016-09-04T11:20:59.074+0200 [initandlisten] git version: nogitversion
2016-09-04T11:20:59.074+0200 [initandlisten] OpenSSL version: OpenSSL 1.0.2g-fips  1 Mar 2016
2016-09-04T11:20:59.074+0200 [initandlisten] build info: Linux lgw01-12 3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:16:20 UTC 2015 x86_64 BOOST_LIB_VERSION=1_58
2016-09-04T11:20:59.074+0200 [initandlisten] allocator: tcmalloc
2016-09-04T11:20:59.074+0200 [initandlisten] options: {}
2016-09-04T11:20:59.074+0200 [initandlisten] exception in initAndListen: 10296 
*********************************************************************
 ERROR: dbpath (/data/db) does not exist.
 Create this directory or give existing directory in --dbpath.
 See http://dochub.mongodb.org/core/startingandstoppingmongo
*********************************************************************
, terminating
2016-09-04T11:20:59.074+0200 [initandlisten] dbexit: 
2016-09-04T11:20:59.074+0200 [initandlisten] shutdown: going to close listening sockets...
2016-09-04T11:20:59.074+0200 [initandlisten] shutdown: going to flush diaglog...
2016-09-04T11:20:59.074+0200 [initandlisten] shutdown: going to close sockets...
2016-09-04T11:20:59.074+0200 [initandlisten] shutdown: waiting for fs preallocator...
2016-09-04T11:20:59.074+0200 [initandlisten] shutdown: lock for final commit...
2016-09-04T11:20:59.074+0200 [initandlisten] shutdown: final commit...
2016-09-04T11:20:59.074+0200 [initandlisten] shutdown: closing all files...
2016-09-04T11:20:59.074+0200 [initandlisten] closeAllFiles() finished
2016-09-04T11:20:59.074+0200 [initandlisten] dbexit: really exiting now

但是当我检查状态是否处于事件状态时,请帮助我。我不知道我该怎么办!
**~$** sudo systemctl status mongodb
**●** mongodb.service - An object/document-oriented database
   Loaded: loaded (/lib/systemd/system/mongodb.service; enabled; vendor prese
   Active: active (running) since dom 2016-09-04 11:01:11 CEST; 20min ago
     Docs: man:mongod(1)
 Main PID: 27544 (mongod)
   CGroup: /system.slice/mongodb.service
           └─27544 /usr/bin/mongod --config /etc/mongodb.conf

set 04 11:01:11 zantes systemd[1]: Started An object/document-oriented databa
lines 1-9/9 (END)

我以前在 c9 上工作过,但它有很多问题而且速度很慢,我需要 mongodb 来处理我的项目
(对不起我的英语不好)

最佳答案

错误消息中的某处显示“dbpath (/data/db) 不存在”。 “/data/db”是 mongodb 存储其数据文件的默认目录。您必须手动创建它。这条路似乎不存在。

如果要更改此路径,请将 --dbpath 参数传递给 mongod 或更改 mongodb.conf 文件中的 dbpath 参数值。

关于MongoDB 没有从 ubuntu 16.04 开始,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39315453/

相关文章:

linux - 卸载软件包 Ubuntu

node.js - 如何在 Ubuntu 16.04 上安装 NodeJS 6.1.0

ubuntu 16.04.1 LTS 在启动 android 模拟器时崩溃

javascript - MongoDB:String ID 的 $lt 比较等同于 ObjectID 比较吗?

string - 在查找时转换 MongoDB 数据

c# - 我如何编写 linq 来比较年月 f

Ubuntu 16.04 虚拟盒蓝牙

ubuntu - q 解释器不记忆 Ubuntu 16.04 上的历史

javascript - mongodb 服务器端 javascript 实际上是客户端?

ubuntu - 可靠的 : How to handle first login forced password change and push an ssh-key