美文网首页
MongoDB Linux下启动失败

MongoDB Linux下启动失败

作者: Dash_chan | 来源:发表于2018-06-02 11:23 被阅读30次

    输入命令

    mongod
    

    抛出异常:

    2018-06-02T03:10:00.342+0000 [initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
    2018-06-02T03:10:00.343+0000 [initandlisten] ERROR:   addr already in use
    

    是端口被占用。找出是什么进程占用了这个端口(话说我新买的服务器啊而且更新过了,mongod 也是新装的。奇了个怪)

    ps aux | grep mongod
    

    输出

    mongodb    676  0.5  4.9 389348 50004 ?        Ssl  Jun01   3:43 /usr/bin/mongod --config /etc/mongodb.conf
    root     30784  0.0  0.1  14516  1020 pts/0    S+   03:12   0:00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn mongod
    

    看到有个 676(什么鬼)???,将此杀掉即可

    kill -9 676
    

    先把我的项目打开,

     gunicorn wsgi -c gunicorn.config.py
    

    重新运行mongod

    mongod
    

    输出

    mongod --help for help and startup options
    2018-06-02T03:15:34.158+0000 [initandlisten] MongoDB starting : pid=30884 port=27017 dbpath=/data/db 64-bit host=192.168.177.128
    2018-06-02T03:15:34.158+0000 [initandlisten] db version v2.6.10
    2018-06-02T03:15:34.158+0000 [initandlisten] git version: nogitversion
    2018-06-02T03:15:34.158+0000 [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
    2018-06-02T03:15:34.158+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
    2018-06-02T03:15:34.158+0000 [initandlisten] allocator: tcmalloc
    2018-06-02T03:15:34.158+0000 [initandlisten] options: {}
    2018-06-02T03:15:34.160+0000 [initandlisten] journal dir=/data/db/journal
    2018-06-02T03:15:34.160+0000 [initandlisten] recover : no journal files present, no recovery needed
    2018-06-02T03:15:34.229+0000 [initandlisten] waiting for connections on port 27017
    2018-06-02T03:15:34.320+0000 [initandlisten] connection accepted from 127.0.0.1:33928 #1 (1 connection now open)
    2018-06-02T03:15:34.322+0000 [initandlisten] connection accepted from 127.0.0.1:33930 #2 (2 connections now open)
    2018-06-02T03:16:34.218+0000 [clientcursormon] mem (MB) res:47 virt:381
    2018-06-02T03:16:34.219+0000 [clientcursormon]  mapped (incl journal view):160
    2018-06-02T03:16:34.219+0000 [clientcursormon]  connections:2
    

    成功!

    相关文章

      网友评论

          本文标题:MongoDB Linux下启动失败

          本文链接:https://www.haomeiwen.com/subject/jqfrsftx.html