Mongodb

在 Fedora 28 上安裝 mongodb 時出現連接錯誤

  • June 29, 2019

我一直在嘗試安裝 Mongodb,但它一直在中途失敗。下載完成後,安裝失敗並出現連接錯誤:

MongoDB shell version v3.6.3
connecting to: mongodb://127.0.0.1:27017
2018-08-17T12:26:33.340+0200 W NETWORK  [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2018-08-17T12:26:33.340+0200 E QUERY    [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:251:13
@(connect):1:6
exception: connect failed

我嘗試過

的:1.更改埠:

mongo --port 4332

但仍然無法連接:

MongoDB shell version v3.6.3
connecting to: mongodb://127.0.0.1:4332/
2018-08-17T12:32:55.743+0200 W NETWORK  [thread1] Failed to connect to 127.0.0.1:4332, in(checking socket for error after poll), reason: Connection refused
2018-08-17T12:32:55.743+0200 E QUERY    [thread1] Error: couldn't connect to server 127.0.0.1:4332, connection attempt failed :
connect@src/mongo/shell/mongo.js:251:13
@(connect):1:6
exception: connect failed
  1. 重新安裝數據庫顯示為已完成,但我仍然無法啟動它。查看螢幕截圖

安裝 mongodb 時顯示錯誤的圖像

  1. 檢查/etc/mongo*or中的任何配置文件/var/lib/:沒有。

事實證明,Fedora 將 mongo 和 mongod 視為兩個獨立的包。在大多數發行版上,您可以將這兩個服務安裝在一個包中,但在 Fedora 上,您必須單獨安裝它們。

sudo dnf install mongodb mongodb-server

然後您可以使用 啟動服務mongod

引用自:https://dba.stackexchange.com/questions/215174