本文介绍了为什么我无法启动 mongodb 服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试启动 mongodb 服务器,但它立即存在.是因为它试图使用已经在使用的端口吗?我该如何正确运行它?谢谢.

I try to start mongodb server, but it exists immediatly. Is it because it tried to use a port already in use? How shall I run it correctly? Thanks.

我使用的是 Ubuntu 14.04,并按照 mongodb 网站上的指南安装了 mongodb.

I am on Ubuntu 14.04, and installed mongodb following the guideline in mongodb website.

$ mongod
2016-08-04T11:06:39.947-0400 I CONTROL  [initandlisten] MongoDB starting : pid=15947 port=27017 dbpath=/data/db 64-bit host=ocean
2016-08-04T11:06:39.947-0400 I CONTROL  [initandlisten] db version v3.2.8
2016-08-04T11:06:39.951-0400 I CONTROL  [initandlisten] git version: ed70e33130c977bda0024c125b56d159573dbaf0
2016-08-04T11:06:39.952-0400 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2016-08-04T11:06:39.952-0400 I CONTROL  [initandlisten] allocator: tcmalloc
2016-08-04T11:06:39.952-0400 I CONTROL  [initandlisten] modules: none
2016-08-04T11:06:39.952-0400 I CONTROL  [initandlisten] build environment:
2016-08-04T11:06:39.952-0400 I CONTROL  [initandlisten]     distmod: ubuntu1404
2016-08-04T11:06:39.952-0400 I CONTROL  [initandlisten]     distarch: x86_64
2016-08-04T11:06:39.953-0400 I CONTROL  [initandlisten]     target_arch: x86_64
2016-08-04T11:06:39.953-0400 I CONTROL  [initandlisten] options: {}
2016-08-04T11:06:40.015-0400 E NETWORK  [initandlisten] listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
2016-08-04T11:06:40.016-0400 E NETWORK  [initandlisten]   addr already in use
2016-08-04T11:06:40.016-0400 E STORAGE  [initandlisten] Failed to set up sockets during startup.
2016-08-04T11:06:40.016-0400 I CONTROL  [initandlisten] dbexit:  rc: 48

推荐答案

它告诉你 Address already in use for socket: 0.0.0.0:27017.

使用 mongod --port 27018 尝试另一个端口.

Try on another port with mongod --port 27018.

要在 ubuntu 上杀死使用端口 27017 的进程,您可以使用 lsof -i :27017 找到该进程的 PID 然后 kill -9 PID>.

To kill process that uses port 27017 on ubuntu you can use lsof -i :27017 to find PID of that process and then kill -9 <PID>.

这篇关于为什么我无法启动 mongodb 服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 01:30