Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 575
WEIWEI LIN Avatar asked Dec 03 '25 15:12

WEIWEI LIN


2 Answers

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
like image 142
Eftekhari Avatar answered Dec 05 '25 05:12

Eftekhari


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
like image 35
Khay Avatar answered Dec 05 '25 03:12

Khay



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!