Basically I'm trying to change the default port of mongodb
by changing the port in mongod.conf
file . Then I'm starting the db by mongod --fork --logpath /var/log/mongod.log
command . The db is being started in the background but the problem is it's still running on the port 27017
.
mongod.conf:
net:
port: 15031
bindIp: 192.168.1.7
Add the parament mongod -f /etc/mongod.conf
to specify the configuration file.
net:
port: 15031
Configuration file is written in YAML You have to use SPACE characters instead of TAB characters for indentation.
Or pass the --port argument when you start mongod
mongod --port 15031
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.