Setup MongoDB on Windows Server 2008

mongodb compass
how to download mongodb
service mongodb server failed to start
start mongodb
install mongodb windows server 2016
how to install mongodb on ubuntu
mongodb community
mongodb silent install

I'm new to mongoDB and like it so far, I work local for my dev where I have mongo running as service on Win7. I have it allso running as a service on my VPS on Win server 2008. When I am on the server it works fine but I don't know hos to set it up so I can acces it from outside of the server? Can't find any good documentation on that. Also, I'm having hard time to do backup/restore on the server from my local computer since I can't see it from outside of the server.

I would like to have more information also on the master/slave and hos to set this up properly.

When I run netstat -anb I get

  TCP    127.0.0.1:27017        0.0.0.0:0              LISTENING
 [mongod.exe]
  TCP    127.0.0.1:27017        127.0.0.1:62990        ESTABLISHED
 [mongod.exe]
  TCP    127.0.0.1:28017        0.0.0.0:0              LISTENING

That's all I have for mongod.exe

[Edit]

I tried to reinstall with --bind_ip xxx.x.x.xx and now the xxx.x.x.xx:27017 works but only on the remote server, if I try to access from anywhere it fails.

Also, I turned off the firewall and it does not change anything.

Thanks a lot!

I think I found how to achieve it. First of all, allow the port 27017 on your firewall. Then I installed Mongo as a service using a configuration file. I created the mongos.conf like this:

dbpath = d:\mongo\data
logpath = d:\mongo\logs
noauth = true # use 'true' for options that don't take an argument

I saved it under: d:\mongo\mongos.conf

Then I did this in the command line:

mongod --config d:\mongo\mongos.conf --reinstall

The key is to make sure there is no bind_ip config key in your configuration file. So it will allow mongo to be binded to any ip. You should then be able to go to

http://localhost:27017 and see the following message:

You are trying to access MongoDB on the native driver port. For http diagnostic access, add 1000 to the port number

And you should also be able to go to:

http://192.168.x.x:27017 (your ip) and you should see the same output.

Install MongoDB Community Edition on Windows, Windows 8 / Windows Server 2012; Windows 7 / Windows Server 2008 R2. MongoDB only supports the 64-bit versions of these platforms. See Supported  Run MongoDB Community Edition from the Command Interpreter ¶ Create database directory. ¶. Create the data directory where MongoDB stores data. MongoDB’s default data directory path Start your MongoDB database. ¶. To start MongoDB, run mongod.exe. The --dbpath option points to your database

Try running this command from an admin DOS prompt to open external access to the default MongoDB port 27017:

C:\> netsh.exe advfirewall firewall add rule name="MongoDB (port 27017)"
        dir=in action=allow protocol=TCP localport=27017

Setup MongoDB on Windows Server 2008, I think I found how to achieve it. First of all, allow the port 27017 on your firewall. Then I installed Mongo as a service using a configuration file. Go to the C:\Program Files and locate the \MongoDB\Server directory. You should see the recently installed MongoDB Right-click the folder to see the full path. Select “Copy” to copy it.

If you can't access it remotely it sounds like a firewall issue. By default mongod listens on port 27017. Is that port accessible from the machine you are trying to connect from? This sounds like more or a firewall issue than an issue with mongod. Can you edit your question to provice the command line the mongo service runs as.

A good source for information on replica sets in this article on Kristina Chodorow's blog.

Install and Use MongoDB on Windows Server 2016, Select Windows Server 2008 R2 64-bit and later with SSL support x64 as the version. Then click DOWNLOAD (msi). Install MongoDB on Windows Server 2016. Downloading the 64-bit is recommended. Again, MongoDB distribution for Windows 64-bit ships with two flavors. one for Newer OS, Windows server 2008 and Windows 7, Server 2012 (download link Big

MongoDB Server Installation On Windows · Schibsted-Tech-Polska , MongoDB for Windows Server 2008 R2 edition (i.e. 2008R2) only runs on Windows Server 2008 R2, Windows 7 64-bit, and newer versions of  Start MongoDB Community Edition from the Command Interpreter ¶ Create database directory. ¶. Create the data directory where MongoDB stores data. MongoDB’s default data directory path Start your MongoDB database. ¶. To start MongoDB, run mongod.exe. The --dbpath option points to your database

In the mongod.cfg (at C:\Program Files\MongoDB\Server\4.0\bin), just update:

# network interfaces
net:
  port: 27017
#  bindIp: 127.0.0.1
  bindIp: 0.0.0.0

let the mongo db bing to 0.0.0.0 i.e. all interfaces and not only 127.0.0.1. Then it will allow connections to all interfaces.

Installation Process Of MongoDB On Windows, MongoDB Install - How To Install MongoDB On Windows? is suggested to choose to install on Windows Vista or Windows 7 or on Windows Server 2008 R2​. You can use the command below for running mongodb as a windows service. "C:\mongodb\bin\mongod" --bind_ip yourIPadress --logpath "C:\data\dbConf\mongodb.log" --logappend --dbpath "C:\data\db" --port yourPortNumber --serviceName "YourServiceName" --serviceDisplayName "YourServiceName" --install.

How to Install MongoDB on Windows System?, Windows 7/Server 2008 R2; Windows 8/2012 R2 and later. Let's check the Official MongoDB downloads section to download the MongoDB  The MongoDB Connector for BI and associated utilities are compatible only with MongoDB server version 3.2 or greater. To set up MongoDB Connector for BI with a business intelligence tool such as Tableau, follow the steps on this page.

How to install MongoDB on Windows, MongoDB for Windows Server 2008 R2 edition. This version of MongoDB runs only on Window Server 2008 R2, Window7 64 bit, and the newer version of  Download MongoDB’s community or enterprise versions here. Plus, do more with downloads for MongoDB Compass, Ops Manager, Charts and BI Connector.

How to Setup, Install , Run and Start MongoDB on Windows-64 bit, MongoDB for Windows 64-bit - runs only on Windows Server 2008 R2, Windows 7 64-bit, and newer versions of Windows. This build takes  Windows: Install MongoDB Community Edition on Windows: MongoDB Enterprise Edition Installation Tutorials Windows 7 / Server 2008 R2

Comments
  • Your problem is firewall related. Have you tried portscanning with nmap or telneting to those ports from the remote machine?
  • Thanks again Justin for the help! I get a could not open connection to the host on port 27017 : connection failde...
  • even if i turned off the firewall? is it the same than adding the exception with the firewall window?
  • it tells me that netsh.exe is not a valid Win32 application
  • Yes, running netsh is the same as opening a port through the GUI. Maybe there's something else blocking port 27017, a router? Or maybe you local machine blocking outbound connections?
  • It's not local machine since we try on an other server and it works, seems like the hosting service is blocking it. I opened a support ticket but did not get any reply yet, anyway thaks for the help!
  • Hi Justin, I already have port 27017 exception for the windows firewall, with TCP protocol. On localhost:27017 on the server I can see that it works but not from the outside. Mongo run as service using Mongo DB. It works fine when staying on the local server but I can't access it from the outside.
  • Is there a hardware firewall between your mongo server and the machine you are trying to access it from? Run nmap from the machine you are trying to remotely connect to your server from and see if the port is filtered. Also, what is the full command line that mongo is running with? Are you using --bind_ip? Finallyuse netstat to ensure that mongo is listening on on 0.0.0.0:27017
  • I run mongod.exe as a service like in this post : deltasdevelopers.com/post/… without the --bind_ip, do you think it could be why it's not working? When I run netstat I get nothing on port 27017.
  • That article is a bit out of date. Look at the one I wrote. justaprogrammer.net/2010/09/30/mongodb-as-a-windows-service.
  • about one year later and I'm facing the problem right now, my client wants to change for a share hosting so I need to access the DB from a different server, I updated the question with more info.