WEIWEI LIN
WEIWEI LIN

Reputation: 31

MongoDB WARNING: --rest is specified without --httpinterface

I'm trying to set up MongoDB. I followed the tutorial on YouTube, but when I type in:

$ mongod
    --directoryperdb
    --dbpath C:/mongodb/data/db
    --logpath C:/mongodb/log/mongodb.log
    --logappend
    --rest

It didn't respond

all output going to: C:/mongodb/log/mongodb.log

instead display:

WARNING: --rest is specified without --httpinterface

How can I solve this?

Upvotes: 3

Views: 5138

Answers (4)

Eftekhari
Eftekhari

Reputation: 1021

Create a folder with the name config in your mongodb directory and a file with the name mongodb.conf in the newly created folder >> (so you should have this arrangement of path) >> C:\mongodb\config\mongodb.conf

add this to the file mongodb.conf

dbpath = C:\mongodb\data
port = 27017
logpath = C:\mongodb\logs
rest = true 
httpinterface = true

run this line of code in CMD

mongod --config C:\mongodb\config\mongodb.conf --install

Upvotes: 2

Daniel Egan
Daniel Egan

Reputation: 454

All that error means is that you added the --rest attribute without adding the --httpinterface attribute. It does not matter if you added it inline or in a config file.

In your config file just put:

rest = true
httpinterface = true

and this warning will not come up on the command line. It is just telling you that since you did not put it, mongod is starting the --httpinterface for you. That being said, this should not be done on production because it is not secure.

Upvotes: 1

MasoodRehman
MasoodRehman

Reputation: 715

File mongodb.conf

#This is example config file for MongoDB
dbpath = C:\mongodb\data
port = 27017
logpath = C:\mongodb\logs\mongo.log
rest = true 
httpinterface = true

CMD

mongod --config C:\mongodb\config\mongodb.conf --install

Upvotes: 0

Khay
Khay

Reputation: 1570

In your mongodb.conf file, add this line

rest = true

You can read the manual here.

If you don't have mongodb.conf file, create one in your mongodb folder. Here is the sample snippet for the config file. In my case, let's say create at C:\mongodb\config\mongodb.conf.

#This is example config file for MongoDB
dbpath = C:\mongodb\data
port = 27017
logpath = C:\mongodb\logs\mongo.log

And then open command prompt, and you can use either one of following

mongod -f C:\mongodb\config\mongodb.conf

or

mongod --config C:\mongodb\config\mongodb.conf

Upvotes: 1

Related Questions