I am running a bitnami instance of mongodb for our pre-production. The default port for mongo is 27017. But for security reasons i want to change it but it is not possible.
I have tried these things:
changes the port in mongodb.conf and restarted the server. It shows the below error:
connecting to: mongodb:///opt/bitnami/mongodb/tmp/mongodb-27017.sock/ 2018-04-20T12:55:04.373+0530 W NETWORK [thread1] Failed to connect to /opt/bitnami/mongodb/tmp/mongodb-27017.sock:0, in(connect), reason: Connection refused 2018-04-20T12:55:04.373+0530 E QUERY [thread1] Error: couldn't connect to server /opt/bitnami/mongodb/tmp/mongodb-27017.sock:27017, connection attempt failed : connect@src/mongo/shell/mongo.js:237:13 @(connect):1:6 exception: connect failed
I restarted mongod with different port. Still i am not able to do it.
when i switch back to 27017. It comes back to normal.
Any suggestions on how to do it the right way?
netstat -anp|grep mongo
what port mongod uses.