簡體   English   中英

MongoDB無法啟動

[英]MongoDB doesn't start

幾天前,我決定將mongodb用於一個項目。 但我仍然沒有成功。

如果我嘗試使用以下命令啟動mongodb:

  sudo mongod --config=/etc/mongod.conf

這是結果:

  about to fork child process, waiting until server is ready for connections.
  forked process: 4539
  child process started successfully, parent exiting

這是我的mongod.conf:

  # mongod.conf
  systemLog:
     path: "/var/log/mongodb/mongod.log"
     destination: file
     timeStampFormat: iso8601-utc
     logAppend: true
     logRotate: reopen

  net:
     bindIp: 127.0.0.1
     port: 27017
     wireObjectCheck: true
     serviceExecutor: adaptive

  storage:
     dbPath: "/home/juny/nodeBox/data/db"

  processManagement:
     fork: true
     pidFilePath: "/run/mongod.pid"

  security:
     authorization: enabled

  operationProfiling:
     mode: slowOp

如果我嘗試啟動mongod作為服務,終端顯示如下:

   ● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2019-05-27 14:22:31 AST; 8s ago
      Docs: https://docs.mongodb.org/manual
   Process: 4861 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=1/FAILURE)
   Main PID: 4861 (code=exited, status=1/FAILURE)

   May 27 14:22:31 LAPTOP-CJFC94N systemd[1]: Started MongoDB Database Server.
   May 27 14:22:31  mongod[4861]: about to fork child process, waiting until server is ready for connections.
   May 27 14:22:31  mongod[4861]: forked process: 4863
   May 27 14:22:31  systemd[1]: mongod.service: Main process exited, code=exited, status=1/FAILURE
   May 27 14:22:31  systemd[1]: mongod.service: Unit entered failed state.
   May 27 14:22:31  systemd[1]: mongod.service: Failed with result 'exit-code'.

最后,這是我的日志文件中的幾行:

   2019-05-27T18:14:16.257Z I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
   2019-05-27T18:14:16.437Z I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
   2019-05-27T18:14:16.437Z I CONTROL  [initandlisten] 
   2019-05-27T18:14:16.437Z I CONTROL  [initandlisten] 
   2019-05-27T18:14:16.437Z I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
   2019-05-27T18:14:16.437Z I CONTROL  [initandlisten] **        We suggest setting it to 'never'
   2019-05-27T18:14:16.437Z I CONTROL  [initandlisten] 
   2019-05-27T18:14:16.530Z I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/home/juny/nodeBox/data/db/diagnostic.data'
   2019-05-27T18:14:16.531Z I EXECUTOR [initandlisten] No thread count configured for executor. Using number of cores / 2: 2
   2019-05-27T18:14:16.531Z I EXECUTOR [worker-1] Started new database worker thread 1
   2019-05-27T18:14:16.531Z I EXECUTOR [worker-2] Started new database worker thread 2
   2019-05-27T18:14:16.531Z I NETWORK  [initandlisten] waiting for connections on port 27017
   2019-05-27T18:28:02.535Z I NETWORK  [listener] connection accepted from 127.0.0.1:48610 #1 (1 connection now open)
   2019-05-27T18:28:02.535Z I NETWORK  [conn1] Error receiving request from client: ProtocolError: Client sent an HTTP request over a native MongoDB connection. Ending connection from 127.0.0.1:48610 (connection id: 1)
   2019-05-27T18:28:02.535Z I NETWORK  [worker-2] end connection 127.0.0.1:48610 (0 connections now open)
   2019-05-27T18:28:02.585Z I NETWORK  [listener] connection accepted from 127.0.0.1:48612 #2 (1 connection now open)
   2019-05-27T18:28:02.585Z I NETWORK  [conn2] Error receiving request from client: ProtocolError: Client sent an HTTP request over a native MongoDB connection. Ending connection from 127.0.0.1:48612 (connection id: 2)
   2019-05-27T18:28:02.585Z I NETWORK  [worker-1] end connection 127.0.0.1:48612 (0 connections now open)

好的,如果我鍵入以下命令,它可以工作:mongo

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM