Unable to connect to mongo on remote server

前端 未结 5 1732
闹比i
闹比i 2021-02-05 10:17

I have installed mongo on machine1(Ubuntu 14.04.3 LTS server) in my local network. I have also opened the port 27017 as mentioned in this guide using f

5条回答
  •  终归单人心
    2021-02-05 10:56

    make sure that mongodb daemon is running, and listening on 0.0.0.0, but not 127.0.0.1 port

    for example, for my local mongodb, it has this config:

    [vodolaz095@steel ~]$ cat /etc/mongod.conf 
    ##
    ### Basic Defaults
    ##
    
    # Comma separated list of ip addresses to listen on (all local ips by default)
    bind_ip = 127.0.0.1
    
    # Specify port number (27017 by default)
    #port = 27017
    

    for mongodb server to listen for remote connections, you can change

    # Comma separated list of ip addresses to listen on (all local ips by default)
    bind_ip = 0.0.0.0
    

提交回复
热议问题