Is there a web server running in mongo?

Phalguni Mukherjee picture Phalguni Mukherjee · Sep 26, 2013 · Viewed 11.7k times · Source

When I start the config server I can see the following line in the logger:

[websvr] admin web console waiting for connections on port 27017

So, I wonder if mongo use a web server for maintaining config data?

Answer

WiredPrairie picture WiredPrairie · Sep 26, 2013

(All of this assumes you're using the current version of MongoDB, 2.4 or higher)

No, MongoDB does not use a Web server in any way for configuration or administration (as documented here). There is a minimal web server for some other purposes however.

Configuration is done through configuration files or the command line when MongoDB is started.

There is a basic, optionally configured, web page that contains some statistics that may of interest to administrators documented here and called the Http Console. If enabled, it's available by default at http://localhost:28017. It can be disabled via the nohttpinterface option documented here. Also, there is a not recommended for production REST api that can be used for some test and development tasks.

As an example, I just confirmed that the nohttpinterface setting was not set to true in a configuration file (I have a custom port in this example as I have another MongoDB instance already running)

verbose=true
port=25017

I then started MongoDB. In the log file, this was present:

Thu Sep 26 11:11:06.645 [websvr] admin web console waiting for connections on port 26017
Thu Sep 26 11:11:06.645 [initandlisten] waiting for connections on port 25017

Then, I added the nohttpinterface option to the configuration file:

verbose=true
port=25017
nohttpinterface=true

After restarting MongoDB, I could not access the Http Console. The web server was not started (there was no reference to the websvr in the log this time).

Thu Sep 26 11:11:34.028 [initandlisten] waiting for connections on port 25017

Oops! Google Chrome could not connect to localhost:26017