Attempting to start a MongoDB database server is resulting in an error where the server fails to start. To address this, I have executed the mkdir -p data/db
command in the project directory.
The command I am running is:
mongod --dbpath=data/ --port 27017
The output I am receiving is as follows:
2017-01-02T12:07:27.754-0800 I CONTROL [initandlisten] MongoDB is starting: pid=22640 port=27017 dbpath=data/ 64-bit host=Eriks-MacBook-Pro.local
2017-01-02T12:07:27.754-0800 I CONTROL [initandlisten] db version v3.4.0
2017-01-02T12:07:27.754-0800 I CONTROL [initandlisten] git version: f4240c60f005be757399042dc12f6addbc3170c1
2017-01-02T12:07:27.754-0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2j 26 Sep 2016
2017-01-02T12:07:27.754-0800 I CONTROL [initandlisten] allocator: system
2017-01-02T12:07:27.754-0800 I CONTROL [initandlisten] modules: none
2017-01-02T12:07:27.754-0800 I CONTROL [initandlisten] build environment:
2017-01-02T12:07:27.754-0800 I CONTROL [initandlisten] distarch: x86_64
2017-01-02T12:07:27.754-0800 I CONTROL [initandlisten] target_arch: x86_64
2017-01-02T12:07:27.754-0800 I CONTROL [initandlisten] options: { net: { port: 27017 }, storage: { dbPath: "data/" } }
2017-01-02T12:07:27.755-0800 E NETWORK [initandlisten] listen(): bind() failed Address already in use for socket: 0.0.0.0:27017
2017-01-02T12:07:27.755-0800 E NETWORK [initandlisten] addr already in use
2017-01-02T12:07:27.755-0800 E NETWORK [initandlisten] Failed to set up sockets during startup.
2017-01-02T12:07:27.755-0800 E STORAGE [initandlisten] Failed to set up listener: InternalError: Failed to set up sockets
2017-01-02T12:07:27.755-0800 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2017-01-02T12:07:27.755-0800 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2017-01-02T12:07:27.755-0800 I CONTROL [initandlisten] now exiting
2017-01-02T12:07:27.755-0800 I CONTROL [initandlisten] shutting down with code:48