启动ubuntu 16.04时出现mongo db错误

时间:2017-04-06 02:00:57

标签: mongodb ubuntu

这是我启动mongodb后得到的错误。我有/ data / db目录设置。有什么建议?谢谢。

root@ubuntu-512mb-sfo1-01:/data# mongod
mongod --help for help and startup options
2017-04-06T01:49:24.295+0000 [initandlisten] MongoDB starting : pid=9631 port=27017 dbpath=/data/db 64-bit host=ubuntu-512mb-sfo1-01
2017-04-06T01:49:24.296+0000 [initandlisten] db version v2.6.10
2017-04-06T01:49:24.296+0000 [initandlisten] git version: nogitversion
2017-04-06T01:49:24.296+0000 [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2017-04-06T01:49:24.296+0000 [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
2017-04-06T01:49:24.296+0000 [initandlisten] allocator: tcmalloc
2017-04-06T01:49:24.296+0000 [initandlisten] options: {}
2017-04-06T01:49:24.299+0000 [initandlisten] journal dir=/data/db/journal
2017-04-06T01:49:24.299+0000 [initandlisten] recover : no journal files present, no recovery needed
2017-04-06T01:49:24.427+0000 [initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
2017-04-06T01:49:24.428+0000 [initandlisten] ERROR:   addr already in use
2017-04-06T01:49:24.443+0000 [initandlisten] now exiting
2017-04-06T01:49:24.443+0000 [initandlisten] dbexit: 
2017-04-06T01:49:24.443+0000 [initandlisten] shutdown: going to close listening sockets...
2017-04-06T01:49:24.443+0000 [initandlisten] shutdown: going to flush diaglog...
2017-04-06T01:49:24.443+0000 [initandlisten] shutdown: going to close sockets...
2017-04-06T01:49:24.444+0000 [initandlisten] shutdown: waiting for fs preallocator...
2017-04-06T01:49:24.444+0000 [initandlisten] shutdown: lock for final commit...
2017-04-06T01:49:24.444+0000 [initandlisten] shutdown: final commit...
2017-04-06T01:49:24.446+0000 [initandlisten] shutdown: closing all files...
2017-04-06T01:49:24.448+0000 [initandlisten] closeAllFiles() finished
2017-04-06T01:49:24.448+0000 [initandlisten] journalCleanup...
2017-04-06T01:49:24.448+0000 [initandlisten] removeJournalFiles
2017-04-06T01:49:24.449+0000 [initandlisten] shutdown: removing fs lock...
2017-04-06T01:49:24.449+0000 [initandlisten] dbexit: really exiting now

1 个答案:

答案 0 :(得分:0)

根据您的日志,某些内容已经在mongod默认端口27017中运行。只需停止并试一试。

使用以下命令获取进程的PID

{
  "value": [
    {
      "id": 1,
      "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/fabrikam-fiber-tfvc/_apis/test/Plans/1/Suites/1/Points/1",
      "assignedTo": {
        "id": "d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
        "displayName": "Jamal Hartnett"
      },
      "configuration": {
        "id": "2",
        "name": "Windows 8"
      },
      "lastTestRun": {
        "id": "28"
      },
      "lastResult": {
        "id": "100000"
      },
      "outcome": "Passed",
      "state": "Completed",
      "testCase": {
        "id": "39",
        "url": null,
        "webUrl": null
      },
      "workItemProperties": [
        {
          "workItem": {
            "key": "Microsoft.VSTS.TCM.AutomationStatus",
            "value": "Not Automated"
          }
        }
      ]
    }
  ],
  "count": 1
}

复制PID并执行以下

sudo netstat -tulnp | grep 27017