I've installed MongoDB and I've found some unlogical things and I hope someone will answer me:
When I execute "mongodb" I get the following errors:
2016-06-23T22:58:39.302+0000 I CONTROL [initandlisten] MongoDB starting : pid=7221 port=27017 dbpath=/data/db 64-bit host=debian
2016-06-23T22:58:39.302+0000 I CONTROL [initandlisten] db version v3.2.7
2016-06-23T22:58:39.302+0000 I CONTROL [initandlisten] git version:
4249c1d2b5999ebbf1fdf3bc0e0e3b3ff5c0aaf2
2016-06-23T22:58:39.302+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1t 3 May 2016
2016-06-23T22:58:39.302+0000 I CONTROL [initandlisten] allocator: tcmalloc
2016-06-23T22:58:39.302+0000 I CONTROL [initandlisten] modules: none
2016-06-23T22:58:39.302+0000 I CONTROL [initandlisten] build environment:
2016-06-23T22:58:39.302+0000 I CONTROL [initandlisten] distmod: debian71
2016-06-23T22:58:39.303+0000 I CONTROL [initandlisten] distarch: x86_64
2016-06-23T22:58:39.303+0000 I CONTROL [initandlisten] target_arch: x86_64
2016-06-23T22:58:39.303+0000 I CONTROL [initandlisten] options: {}
2016-06-23T22:58:39.325+0000 E NETWORK [initandlisten] listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
2016-06-23T22:58:39.325+0000 E NETWORK [initandlisten] addr already in use
2016-06-23T22:58:39.325+0000 E STORAGE [initandlisten] Failed to set up sockets during startup.
2016-06-23T22:58:39.325+0000 I CONTROL [initandlisten] dbexit: rc: 48
What is the difference between two terminal commands: mongo as a first, and mongodb as a second?
MongoDB is great because my project is schema-less but it's always a horrible experience to configure it, create roles, authorization etc.
Thanks.
netstat -n | grep 27017
to check if process is running and kill -9 $(lsof -ti:27017)'
To use any database service, you have to start the database Server and same is the case with mongodb, the command mongod
is used to start the MongoDB Server on your local machine or server.
In your question you have asked for the command mongodb
that's not correct you need to run command mongod
, 'b' is not the part of this command.
mongod
, it starts your mongodb server on default
port 27017.mongo
to enter
into the mongo shell and perform your database operations.The difference between the both commands is that
mongod
starts the mongodb server andmongo
allows you to enter into mongo shell to perform further database operations.
Also, when you install mongodb, you have an option to install it as a service. Installing mongodb as a service starts the mongodb server in background when you boot your system.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With