MongoDB

Results 1 to 3 of 3
  1. #1
    Enthusiast Galadzael is offline
    MemberRank
    Apr 2018 Join Date
    UnityLocation
    40Posts

    MongoDB

    Hey guys, I would like to know what I have to do, so I can access the MongoDB from a remote access, not just from the localhost.

    Thank you!


  2. #2
    Novice HellCoop is offline
    MemberRank
    Apr 2018 Join Date
    4Posts

    Re: MongoDB

    First SSH into your server and enter the mongo shell by typing MONGO For this example, I will set up a user named ian and give that user read & write access to the cool_db database.
    use cool_db

    db.createUser({
    user: 'ian',
    pwd: 'secretPassword',
    roles: [{ role: 'readWrite', db:'cool_db'}]
    })
    Enable auth and open MongoDB access up to all IPs
    Edit your MongoDB config file
    sudo vim /etc/mongod.conf

    Look for the net line and comment out the bindIp line under it, which is currently limiting MongoDB connections to localhost:

    # network interfacesnet: port: 27017# bindIp: 127.0.0.1 <- comment out this line

    Scroll down to the #security: section and add the following line. Make sure to un-comment the security: line.
    security: authorization: 'enabled'


    after open port 2017 and restart mongo daemon.
    profit )))

  3. #3
    Enthusiast Galadzael is offline
    MemberRank
    Apr 2018 Join Date
    UnityLocation
    40Posts

    Re: MongoDB

    Quote Originally Posted by HellCoop View Post
    First SSH into your server and enter the mongo shell by typing MONGO For this example, I will set up a user named ian and give that user read & write access to the cool_db database.
    use cool_db

    db.createUser({
    user: 'ian',
    pwd: 'secretPassword',
    roles: [{ role: 'readWrite', db:'cool_db'}]
    })
    Enable auth and open MongoDB access up to all IPs
    Edit your MongoDB config file
    sudo vim /etc/mongod.conf

    Look for the net line and comment out the bindIp line under it, which is currently limiting MongoDB connections to localhost:

    # network interfacesnet: port: 27017# bindIp: 127.0.0.1 <- comment out this line

    Scroll down to the #security: section and add the following line. Make sure to un-comment the security: line.
    security: authorization: 'enabled'


    after open port 2017 and restart mongo daemon.
    profit )))
    Thank you so much!!



Advertisement