Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mongodb Mongod在ubuntu 16.04上崩溃_Mongodb_Ubuntu - Fatal编程技术网

Mongodb Mongod在ubuntu 16.04上崩溃

Mongodb Mongod在ubuntu 16.04上崩溃,mongodb,ubuntu,Mongodb,Ubuntu,我正在开发一个由mongodb支持的应用程序。无论是从shell还是从应用程序以编程方式与db服务器交互,都可以正常工作。问题是,只有当我以root用户身份运行服务器时,它才能工作。否则就不行了。在windows上工作时,我没有这个问题。我使用的是ubuntu 16.04 首先,是db路径,我更改了配置文件。然后它告诉我它无法创建锁文件,我更改了权限(我不确定这是否是一个好的做法),现在我出现了以下错误: Detected data files in /data/db created by th

我正在开发一个由mongodb支持的应用程序。无论是从shell还是从应用程序以编程方式与db服务器交互,都可以正常工作。问题是,只有当我以root用户身份运行服务器时,它才能工作。否则就不行了。在windows上工作时,我没有这个问题。我使用的是ubuntu 16.04

首先,是db路径,我更改了配置文件。然后它告诉我它无法创建锁文件,我更改了权限(我不确定这是否是一个好的做法),现在我出现了以下错误:

Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2017-04-29T21:22:44.897+0100 I STORAGE  [initandlisten] 
2017-04-29T21:22:44.897+0100 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2017-04-29T21:22:44.897+0100 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2017-04-29T21:22:44.897+0100 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=413M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2017-04-29T21:22:44.922+0100 E STORAGE  [initandlisten] WiredTiger error (1) [1493497364:922160][28430:0x7f168c50dcc0], file:WiredTiger.wt, connection: /data/db/WiredTiger.wt: handle-open: open: Operation not permitted
2017-04-29T21:22:44.924+0100 I -        [initandlisten] Assertion: 28595:1: Operation not permitted src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 267
2017-04-29T21:22:44.924+0100 I STORAGE  [initandlisten] exception in initAndListen: 28595 1: Operation not permitted, terminating
另外,当我尝试将其作为服务运行时,
service mongod start
,它会抛出一个错误,即没有这样的服务文件。我在/etc/systemd/system目录中创建了一个mongod.service文件,但它仍然给出相同的错误,没有这样的文件

以下是
systemctl status mongod
的结果:

mongod.service - MongoDB Database Service
   Loaded: loaded (/etc/systemd/system/mongod.service; enabled; vendor preset: enabled)
   Active: inactive (dead) (Result: exit-code) since ح 2017-04-30 00:15:00 WEST; 14h ago
  Process: 958 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=100)
 Main PID: 958 (code=exited, status=100)

أبر 30 00:15:00 archer09 systemd[1]: mongod.service: Main process exited, code=exited, status=100/n/a
أبر 30 00:15:00 archer09 systemd[1]: mongod.service: Unit entered failed state.
أبر 30 00:15:00 archer09 systemd[1]: mongod.service: Failed with result 'exit-code'.
أبر 30 00:15:00 archer09 systemd[1]: mongod.service: Service hold-off time over, scheduling restart.
أبر 30 00:15:00 archer09 systemd[1]: Stopped MongoDB Database Service.
أبر 30 00:15:00 archer09 systemd[1]: mongod.service: Start request repeated too quickly.
أبر 30 00:15:00 archer09 systemd[1]: Failed to start MongoDB Database Service.
我也有同样的问题

sudo systemctl start mongod
在我的环境中似乎不起作用

试试
sudo服务mongod start
它解决了我这边的问题

使用sudo systemctl status mongod

给我

mongod.service - High-performance, schema-free document-oriented database
   Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2018-01-24 13:01:38 UTC; 44min ago
     Docs: https://docs.mongodb.org/manual
 Main PID: 23900 (mongod)
    Tasks: 25
   Memory: 143.9M
      CPU: 8.935s
   CGroup: /system.slice/mongod.service
           └─23900 /usr/bin/mongod --config /etc/mongod.conf