Monday, May 30, 2011

Solved: REST is not enabled

When you open the MongoDB web console (typically running on your local machine on port 28017) and you select for example the commands link (http://localhost:28017/_commands) you might run into a error page stating "REST is not enabled. use --rest to turn on."

Reason for this is that you started the database without the --rest option. To do this you can start the database from your MongoDB bin directory like "./mongod --rest". This will solve the issue. It is however not explaining what --rest is doing.

According to Wikipedia REST is nothing more than Representational State Transfer (REST) is a style of software architecture for distributed hypermedia systems such as the World Wide Web. The term Representational State Transfer was introduced and defined in 2000 by Roy Fielding in his doctoral dissertation.Fielding is one of the principal authors of the Hypertext Transfer Protocol (HTTP) specification versions 1.0 and 1.1. Conforming to the REST constraints is referred to as being ‘RESTful’.

When adding the --rest when starting MongoDB will enable you to do a lot more and interact in more ways to your MongoDB database from your webinterface. This however means that also other people can connect and do more than without the --rest option. For this reason it is good to take into consideration if you want the --rest option activated and if so how you want to secure access to it. You can for example think about having a firewall rule (local or in your network) which states that only certain machines can access the web interface port.

3 comments:

Anonymous said...

It didn't work for me. I did mongod --rest, then mongo, then I did localhost:28017/ and click some options, it gave the same results.

Anonymous said...

Me too,. : o(

Anonymous said...

Worked for me ! thanks alot man !