My problem is similar to other inputs and suggestions on this site, but none has helped me. After installing MongoDB, has not started because the database is not running.
First try to run mongo and I answered this:
Mac-Pro-de-User: ~ user $ mongo
MongoDB shell version: 2.6.4
connecting to: test
2014-10-28T10: 47: 08713-0700 warning: Failed to connect to 127.0.0.1:27017, reason: errno: 61 Connection refused
2014-10-28T10: 47: 08713-0700 Error: could not connect to server 127.0.0.1:27017 (127.0.0.1) Attempt connection failed at src / mongo / shell / mongo.js: 146
exception: connect failed
Then try to check the mongod and I answered this:
Mac-Pro-de-User: ~ user $ mongod
mongod --help for help and startup options
2014-10-28T10: 59: 34485-0700 [initandlisten] MongoDB starting: pid = 926 port = 27017 dbpath = / data / db host = 64-bit Mac-Pro-de-Ernesto.local
2014-10-28T10: 59: 34485-0700 [initandlisten]
2014-10-28T10: 59: 34485-0700 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, Should be at Least 1000
2014-10-28T10: 59: 34485-0700 [initandlisten] db version v2.6.4
2014-10-28T10: 59: 34485-0700 [initandlisten] git version: 3a830be0eb92d772aa855ebb711ac91d658ee910
2014-10-28T10: 59: 34485-0700 [initandlisten] Build info: Darwin bs-osx108-4 12.5.0 Darwin Kernel Version 12.5.0: Sun Sep 29 13:33:47 PDT 2013; root: xnu-2050.48.12 ~ 1 / x86_64 RELEASE_X86_64 BOOST_LIB_VERSION = 1_49
2014-10-28T10: 59: 34485-0700 [initandlisten] allocator: system
2014-10-28T10: 59: 34485-0700 [initandlisten] options: {}
2014-10-28T10: 59: 34486-0700 [initandlisten] journal dir = / data / db / journal
2014-10-28T10: 59: 34486-0700 [initandlisten] recover: no journal files present, no recovery needed
2014-10-28T10: 59: 34500-0700 [FileAllocator] allocating new datafile /data/db/local.ns, filling zeroes With ...
2014-10-28T10: 59: 34500-0700 [FileAllocator] creating directory / data / db / _tmp
2014-10-28T10: 59: 34512-0700 [FileAllocator] done allocating datafile /data/db/local.ns, size: 16MB, took 0.011 secs
2014-10-28T10: 59: 34726-0700 [FileAllocator] allocating new datafile /data/db/local.0, filling zeroes With ...
2014-10-28T10: 59: 35398-0700 [FileAllocator] done allocating datafile /data/db/local.0, size: 64MB, took 0.671 secs
2014-10-28T10: 59: 35695-0700 [initandlisten] build index on: local.startup_log properties: {v: 1, key: {_id: 1}, name: "_id_" ns "local.startup_log"}
2014-10-28T10: 59: 35695-0700 [initandlisten] index added to empty collection
2014-10-28T10: 59: 35695-0700 [initandlisten] Local command $ cmd command. Create {create: "startup_log" size: 10485760, capped: true} ntoreturn: 1 KeyUpdates: 0 numYields: 0 reslen: 37 1194ms
2014-10-28T10: 59: 35695-0700 [initandlisten] waiting for connections on port 27017
2014-10-28T11: 00: 34516-0700 [clientcursormon] mem (MB) res: 33 virt: 2653
2014-10-28T11: 00: 34516-0700 [clientcursormon] mapped (incl journal view): 160
2014-10-28T11: 00: 34516-0700 [clientcursormon] connections: 0
Then try again to connect and spend some time, and again says the same:
2014-10-28T11: 05: 34589-0700 [clientcursormon] mem (MB) res: 33 virt: 2653
2014-10-28T11: 05: 34589-0700 [clientcursormon] mapped (incl journal view): 160
2014-10-28T11: 05: 34589-0700 [clientcursormon] connections: 0
And so on. If you can help would greatly appreciate it.
PS: There is already the / data / db with 777 permissions, and I'm using OSX Mavericks 10.9.5
Then restart the server, and see if it connects. Means that NO mongod instance is running at the given host 127.0. 0.1 and port 27017. Yes the solution is to start mongod.
Ensure Your MongoDB Instance is Running Compass must connect to a running MongoDB instance. Make sure you have installed MongoDB and have a running mongod process. You should also check that the port where your MongoDB instance is running matches the port you provide in the Compass connect dialog.
If you have created a user and are having trouble authenticating, try the following: Check that you are using the correct username and password for your database user, and that you are connecting to the correct database deployment. Check that you are specifying the correct authSource database in your connection string.
To connect to your local MongoDB, you set Hostname to localhost and Port to 27017 . These values are the default for all local MongoDB connections (unless you changed them). Press connect, and you should see the databases in your local MongoDB.
Just try this command.
sudo chown mongodb /tmp/mongodb-27017.sock
And
sudo service mongod restart
Fixed!
The reason was the dbpath variable in /etc/mongodb.conf. Previously, I was using mongodb 1.8, where the default value for dbpath was /data/db. The upstart job mongodb(which comes with mongodb-10gen package) invokes the mongod with --config /etc/mongodb.conf option.
As a solution, I only had to change the owner of the /data/db directory recursively.
Like this: Go to "/data" location in the terminal and then type
sudo chown -R <username>:foldername
For example:
sudo chown -R raja db/
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