Connect failed to mongodb shell - mongodb

I have installed mongo, run the shell success in couple of time, then I try to add:
security:
authorization: disabled
because I want to add user Admin to admin db. After that, I can not access the mongo shell, this error show up when run command mongo
MongoDB shell version v3.6.2
connecting to: mongodb://127.0.0.1:27017
2018-02-09T09:34:48.769+0700 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2018-02-09T09:34:48.769+0700 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:251:13
#(connect):1:6
exception: connect failed
And here is few last lines of the log file after disable authorization, even when enable it again, thing doesn't work /var/log/mongodb/mongod.log
2018-02-09T09:33:00.843+0700 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-02-09T09:33:00.843+0700 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2018-02-09T09:33:00.843+0700 I CONTROL [initandlisten]
2018-02-09T09:33:00.847+0700 F CONTROL [initandlisten] ** IMPORTANT: UPGRADE PROBLEM: The data files need to be fully upgraded to version 3.4 before attempting an upgrade to 3.6; see http://dochub.mongodb.org/core/3.6-upgrade-fcv for more details.
2018-02-09T09:33:00.847+0700 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2018-02-09T09:33:00.847+0700 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2018-02-09T09:33:00.847+0700 I REPL [initandlisten] shutdown: removing all drop-pending collections...
2018-02-09T09:33:00.847+0700 I REPL [initandlisten] shutdown: removing checkpointTimestamp collection...
2018-02-09T09:33:00.848+0700 I STORAGE [initandlisten] shutdown: waiting for fs preallocator...
2018-02-09T09:33:00.848+0700 I STORAGE [initandlisten] shutdown: final commit...
2018-02-09T09:33:00.849+0700 I JOURNAL [initandlisten] journalCleanup...
2018-02-09T09:33:00.849+0700 I JOURNAL [initandlisten] removeJournalFiles
2018-02-09T09:33:00.876+0700 I JOURNAL [initandlisten] old journal file /var/lib/mongodb/journal/j._0 will be reused as /var/lib/mongodb/journal/prealloc.0
2018-02-09T09:33:00.899+0700 I JOURNAL [initandlisten] Terminating durability thread ...
2018-02-09T09:33:00.950+0700 I JOURNAL [journal writer] Journal writer thread stopped
2018-02-09T09:33:00.950+0700 I JOURNAL [durability] Durability thread stopped
2018-02-09T09:33:00.950+0700 I STORAGE [initandlisten] shutdown: closing all files...
2018-02-09T09:33:00.953+0700 I STORAGE [initandlisten] closeAllFiles() finished
2018-02-09T09:33:00.953+0700 I STORAGE [initandlisten] shutdown: removing fs lock...
2018-02-09T09:33:00.953+0700 I CONTROL [initandlisten] now exiting
2018-02-09T09:33:00.953+0700 I CONTROL [initandlisten] shutting down with code:62
I tried to run sudo service mongod restart but doesn't work.
So can you give me some advices for this problem, thanks

Is seems that mongod can't start because your system has updated mongodb from version < 3.4 to 3.6 as it stated in the log: The data files need to be fully upgraded to version 3.4 before attempting an upgrade to 3.6
You need to downgrade mongodb to 3.4, then sudo service mongod start to trigger the db migration to 3.4.

I just try to run this command and it works for me brew services start mongodb
Cheers.

Related

MongoDB shutting down with code:12

I have saved my data yesterday, but when I tried to open my MongoDB via command Prompt and fire the command mongod its throwing out the following messages
>C:\mongodb\bin>mongod
>2018-07-20T16:21:25.350+0530 I CONTROL [main] Automatically disabling TLS 1.0, >to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
>2018-07-20T16:21:25.842+0530 I CONTROL [initandlisten] MongoDB starting : >pid=13544 port=27017 dbpath=C:\data\db\ 64-bit host=DESKTOP-4H7RM2O
>2018-07-20T16:21:25.842+0530 I CONTROL [initandlisten] targetMinOS: Windows >7/Windows Server 2008 R2
>2018-07-20T16:21:25.843+0530 I CONTROL [initandlisten] db version v4.0.0
>2018-07-20T16:21:25.843+0530 I CONTROL [initandlisten] git version: >3b07af3d4f471ae89e8186d33bbb1d5259597d51
>2018-07-20T16:21:25.843+0530 I CONTROL [initandlisten] allocator: tcmalloc
>2018-07-20T16:21:25.843+0530 I CONTROL [initandlisten] modules: none
>2018-07-20T16:21:25.843+0530 I CONTROL [initandlisten] build environment:
>2018-07-20T16:21:25.843+0530 I CONTROL [initandlisten] distmod: 2008plus->ssl
>2018-07-20T16:21:25.843+0530 I CONTROL [initandlisten] distarch: x86_64
>2018-07-20T16:21:25.843+0530 I CONTROL [initandlisten] target_arch: x86_64
>2018-07-20T16:21:25.844+0530 I CONTROL [initandlisten] options: {}
>2018-07-20T16:21:25.844+0530 I STORAGE [initandlisten] exception in >initAndListen: NonExistentPath: Data directory C:\data\db\ not found., >terminating
>2018-07-20T16:21:25.844+0530 I CONTROL [initandlisten] now exiting
>2018-07-20T16:21:25.844+0530 I CONTROL [initandlisten] shutting down with >code:100
>
**Here is the command Prompt output when I fire mongo command**
<C:\mongodb\bin>mongo
<MongoDB shell version v4.0.0
<connecting to: mongodb://127.0.0.1:27017
<2018-07-20T16:28:01.594+0530 E QUERY [js] Error: couldn't connect to server <127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to <127.0.0.1:27017 :: caused by :: No connection could be made because the target <machine actively refused it. :
<connect#src/mongo/shell/mongo.js:251:13
<#(connect):1:6
<exception: connect failed
**This is my log file which is showing error =shutting down with code:12 **
>2018-07-20T15:43:37.425+0530 I CONTROL [initandlisten] ** WARNING: Access >control is not enabled for the database.
>2018-07-20T15:43:37.425+0530 I CONTROL [initandlisten] ** Read and >write access to data and configuration is unrestricted.
>2018-07-20T15:43:37.425+0530 I CONTROL [initandlisten]
>2018-07-20T15:43:37.425+0530 I CONTROL [initandlisten] ** WARNING: This server >is bound to localhost.
>2018-07-20T15:43:37.425+0530 I CONTROL [initandlisten] ** Remote >systems will be unable to connect to this server.
>2018-07-20T15:43:37.425+0530 I CONTROL [initandlisten] ** Start the >server with --bind_ip <address> to specify which IP
>2018-07-20T15:43:37.425+0530 I CONTROL [initandlisten] ** addresses it >should serve responses from, or with --bind_ip_all to
>2018-07-20T15:43:37.426+0530 I CONTROL [initandlisten] ** bind to all >interfaces. If this behavior is desired, start the
>2018-07-20T15:43:37.426+0530 I CONTROL [initandlisten] ** server with >--bind_ip 127.0.0.1 to disable this warning.
>2018-07-20T15:43:37.426+0530 I CONTROL [initandlisten]
>2018-07-20T15:43:40.388+0530 I FTDC [initandlisten] Initializing full-time >diagnostic data capture with directory 'C:/mongodb/data/db/diagnostic.data'
>2018-07-20T15:43:40.499+0530 I NETWORK [initandlisten] waiting for connections >on port 27017
>2018-07-20T15:45:42.106+0530 I CONTROL [thread1] Ctrl-C signal
>2018-07-20T15:45:42.106+0530 I CONTROL [consoleTerminate] got CTRL_C_EVENT, >will terminate after current cmd ends
>2018-07-20T15:45:42.106+0530 I NETWORK [consoleTerminate] shutdown: going to >close listening sockets...
>2018-07-20T15:45:42.325+0530 I CONTROL [consoleTerminate] Shutting down free >monitoring
>2018-07-20T15:45:42.326+0530 I FTDC [consoleTerminate] Shutting down full->time diagnostic data capture
>2018-07-20T15:45:42.334+0530 I STORAGE [consoleTerminate] WiredTigerKVEngine >shutting down
>2018-07-20T15:45:45.543+0530 I STORAGE [consoleTerminate] shutdown: removing fs >lock...
>2018-07-20T15:45:45.543+0530 I CONTROL [consoleTerminate] now exiting
>2018-07-20T15:45:45.543+0530 I CONTROL [consoleTerminate] shutting down with >code:12
I have ensured that my data path is correct but unable to solve this problem.
Try below:
Mac: Documents/mongodb/bin/mongod --dbpath Documents/data/db/
Window: "C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe" --dbpath d:\test\mongodb\data
You just need to set db path.
You can set storage db path to the config file: Check this
And check this for window installation.
If you're using Linux just give increased permission to the storage file and restart mongodb it will work. Default storage file will be var/lib/mongodb. To give increased permissions use : chmod 777 mongod.

Mongod error (installed with homebrew)

I have installed mongodb with
brew install mongodb
Created folder
mkdir -p /data/db
Handle permissions
sudo chown -R `id -un` /data/db
Run
mongod
Error log
2018-01-06T14:28:51.450+0100 I CONTROL [initandlisten] MongoDB starting : pid=6120 port=27017 dbpath=/data/db 64-bit host=Zigas-MBP-2
2018-01-06T14:28:51.451+0100 I CONTROL [initandlisten] db version v3.6.1
2018-01-06T14:28:51.451+0100 I CONTROL [initandlisten] git version: 025d4f4fe61efd1fb6f0005be20cb45a004093d1
2018-01-06T14:28:51.451+0100 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2n 7 Dec 2017
2018-01-06T14:28:51.451+0100 I CONTROL [initandlisten] allocator: system
2018-01-06T14:28:51.451+0100 I CONTROL [initandlisten] modules: none
2018-01-06T14:28:51.451+0100 I CONTROL [initandlisten] build environment:
2018-01-06T14:28:51.451+0100 I CONTROL [initandlisten] distarch: x86_64
2018-01-06T14:28:51.451+0100 I CONTROL [initandlisten] target_arch: x86_64
2018-01-06T14:28:51.451+0100 I CONTROL [initandlisten] options: {}
2018-01-06T14:28:51.452+0100 I - [initandlisten] Detected data files in /data/db created by the 'mmapv1' storage engine, so setting the active storage engine to 'mmapv1'.
2018-01-06T14:28:51.470+0100 I JOURNAL [initandlisten] journal dir=/data/db/journal
2018-01-06T14:28:51.471+0100 I JOURNAL [initandlisten] recover : no journal files present, no recovery needed
2018-01-06T14:28:51.494+0100 I JOURNAL [durability] Durability thread started
2018-01-06T14:28:51.494+0100 I JOURNAL [journal writer] Journal writer thread started
2018-01-06T14:28:51.495+0100 I CONTROL [initandlisten]
2018-01-06T14:28:51.495+0100 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-01-06T14:28:51.495+0100 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2018-01-06T14:28:51.495+0100 I CONTROL [initandlisten]
2018-01-06T14:28:51.495+0100 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
2018-01-06T14:28:51.495+0100 I CONTROL [initandlisten] ** Remote systems will be unable toconnect to this server.
2018-01-06T14:28:51.495+0100 I CONTROL [initandlisten] ** Start the server with --bind_ip <address> to specify which IP
2018-01-06T14:28:51.495+0100 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
2018-01-06T14:28:51.495+0100 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
2018-01-06T14:28:51.495+0100 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
2018-01-06T14:28:51.495+0100 I CONTROL [initandlisten]
2018-01-06T14:28:51.762+0100 F CONTROL [initandlisten] ** IMPORTANT: UPGRADE PROBLEM: The data files need to be fully upgraded to version 3.4 before attempting an upgrade to 3.6; see http://dochub.mongodb.org/core/3.6-upgrade-fcv for more details.
2018-01-06T14:28:51.762+0100 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2018-01-06T14:28:51.763+0100 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2018-01-06T14:28:51.763+0100 I REPL [initandlisten] shutdown: removing all drop-pending collections...
2018-01-06T14:28:51.763+0100 I REPL [initandlisten] shutdown: removing checkpointTimestamp collection...
2018-01-06T14:28:51.763+0100 I STORAGE [initandlisten] shutdown: waiting for fs preallocator...
2018-01-06T14:28:51.763+0100 I STORAGE [initandlisten] shutdown: final commit...
2018-01-06T14:28:51.770+0100 I JOURNAL [initandlisten] journalCleanup...
2018-01-06T14:28:51.770+0100 I JOURNAL [initandlisten] removeJournalFiles
2018-01-06T14:28:51.770+0100 I JOURNAL [initandlisten] old journal file will be removed: /data/db/journal/j._0
2018-01-06T14:28:51.771+0100 I JOURNAL [initandlisten] Terminating durability thread ...
2018-01-06T14:28:51.870+0100 I JOURNAL [journal writer] Journal writer thread stopped
2018-01-06T14:28:51.870+0100 I JOURNAL [durability] Durability thread stopped
2018-01-06T14:28:51.870+0100 I STORAGE [initandlisten] shutdown: closing all files...
2018-01-06T14:28:51.883+0100 I STORAGE [initandlisten] closeAllFiles() finished
2018-01-06T14:28:51.883+0100 I STORAGE [initandlisten] shutdown: removing fs lock...
2018-01-06T14:28:51.883+0100 I CONTROL [initandlisten] now exiting
2018-01-06T14:28:51.883+0100 I CONTROL [initandlisten] shutting down with code:62
Any help would be apprichiated.
2018-01-06T14:28:51.762+0100 F CONTROL [initandlisten] ** IMPORTANT: UPGRADE PROBLEM: The data files need to be fully upgraded to version 3.4 before attempting an upgrade to 3.6; see http://dochub.mongodb.org/core/3.6-upgrade-fcv for more details.
This is the fault error in your log.
So I guess you have some 3.4 data in your /data/db.
If you want a clean installation, just remove the contents of /data/db and restart mongod
or
Get a 3.4 mongod
Ref: https://docs.mongodb.com/manual/release-notes/3.6-upgrade-standalone/
The error is telling you that you have mongo 3.4 data inside /data/db but you have version 3.6 of Mongo installed.
To fix this you can use one of the options listed below...
Remove the contents of /data/db and restart mongod. This should probably be backed up or you'll lose your data.
Install mongodb 3.4 you can check if you previously installed it using brew list --versions mongodb then if a 3.4.* version comes up, 3.4.10 for example use brew switch mongodb 3.4.10 to move back to that version. If you never had the version installed see this answer to install the older version Homebrew install specific version of formula?
Use #2 to move back to 3.4 then go into mongo shell using mongo and run db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } ). Exit the mongo shell and use the brew switch command to switch back to 3.6.

MongoDB Issues on Yosemite

I typed in two commands, mongo and mongod and get the following results. Not sure how to fix this
mahtabalam$ mongo
MongoDB shell version: 3.0.6
connecting to: test
2015-09-19T18:59:35.315-0400 W NETWORK Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused
2015-09-19T18:59:35.316-0400 E QUERY Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed
at connect (src/mongo/shell/mongo.js:179:14)
at (connect):1:6 at src/mongo/shell/mongo.js:179
exception: connect failed
mahtabalam$ mongod
2015-09-19T19:00:47.133-0400 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock errno:13 Permission denied
2015-09-19T19:00:47.134-0400 I - [initandlisten] Fatal Assertion 28578
2015-09-19T19:00:47.134-0400 I - [initandlisten]
***aborting after fassert() failure
Update 1:
After trying sudo mongod --dbpath="Users/mahtabalam/Sites/mongo/data/db and then pressing ctrl + c on my macbook pro, and then re-entering mongod has yielded the following:
2015-09-19T21:54:49.819-0400 I JOURNAL [initandlisten] journal dir=/data/db/journal
2015-09-19T21:54:49.820-0400 I JOURNAL [initandlisten] recover : no journal files present, no recovery needed
2015-09-19T21:54:49.836-0400 I JOURNAL [durability] Durability thread started
2015-09-19T21:54:49.836-0400 I CONTROL [initandlisten] MongoDB starting : pid=28979 port=27017 dbpath=/data/db 64-bit host=Mahtabs-MacBook-Pro.local
2015-09-19T21:54:49.836-0400 I JOURNAL [journal writer] Journal writer thread started
2015-09-19T21:54:49.836-0400 I CONTROL [initandlisten]
2015-09-19T21:54:49.836-0400 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2015-09-19T21:54:49.837-0400 I CONTROL [initandlisten] db version v3.0.6
2015-09-19T21:54:49.837-0400 I CONTROL [initandlisten] git version: nogitversion
2015-09-19T21:54:49.837-0400 I CONTROL [initandlisten] build info: Darwin yosemitevm.local 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
2015-09-19T21:54:49.837-0400 I CONTROL [initandlisten] allocator: system
2015-09-19T21:54:49.837-0400 I CONTROL [initandlisten] options: {}
2015-09-19T21:54:49.850-0400 I NETWORK [initandlisten] waiting for connections on port 27017
mongod command starts the DB server & it expects an argument dbpath so the full command would be sudo mongod --dbath="dblocation/data/db" where /data/db is mandatory to start the server.
Whereas mongo opens a mongo db shell where you can execute your db statements

Failed to connect to Mongo db

I am using AWS with EC2 and EBS. The system did work and added a mounted EBS drive. Then I mapped the drive to /data and added /data/db before changing mongod.conf for the new data folder. Now mongo will not start. I get the following when I enter mongo from the ubuntu command line.
2015-04-14T10:49:21.292+0000 W NETWORK Failed to connect to
127.0.0.1:27017, reason: errno:111 Connection refused
2015-04-14T10:49:21.294+0000 E QUERY Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed
at connect (src/mongo/shell/mongo.js:179:14)
at (connect):1:6 at src/mongo/shell/mongo.js:179
exception: connect failed
If I use mongod to try and get something running, it just hangs as follows:
2015-04-14T10:57:14.147+0000 I JOURNAL [initandlisten] journal dir=/data/db/journal
2015-04-14T10:57:14.148+0000 I JOURNAL [initandlisten] recover : no journal files present, no recovery needed
2015-04-14T10:57:14.153+0000 I JOURNAL [durability] Durability thread started
2015-04-14T10:57:14.153+0000 I JOURNAL [journal writer] Journal writer thread started
2015-04-14T10:57:14.156+0000 I CONTROL [initandlisten] MongoDB starting : pid=1977 port=27017 dbpath=/data/db 64-bit host=ip-10-167-179-237
2015-04-14T10:57:14.156+0000 I CONTROL [initandlisten]
2015-04-14T10:57:14.156+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2015-04-14T10:57:14.156+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2015-04-14T10:57:14.156+0000 I CONTROL [initandlisten]
2015-04-14T10:57:14.156+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2015-04-14T10:57:14.156+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2015-04-14T10:57:14.156+0000 I CONTROL [initandlisten]
2015-04-14T10:57:14.156+0000 I CONTROL [initandlisten] db version v3.0.1
2015-04-14T10:57:14.156+0000 I CONTROL [initandlisten] git version: 534b5a3f9d10f00cd27737fbcd951032248b5952
2015-04-14T10:57:14.156+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2015-04-14T10:57:14.156+0000 I CONTROL [initandlisten] build info: Linux ip-10-167-176-91 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2015-04-14T10:57:14.156+0000 I CONTROL [initandlisten] allocator: tcmalloc
2015-04-14T10:57:14.156+0000 I CONTROL [initandlisten] options: {}
2015-04-14T10:57:14.198+0000 I NETWORK [initandlisten] waiting for connections on port 27017
I tried removing the mongod.lock file and it just returns. The log seems to have no new entries at all. The system did work before changing conf and that was the only change by adding /data and the new EBS. I have the latest version of mongo and ubuntu.
OK, I solved this by using
sudo service mongod start
Then I used the command
mongo
That opened up the interface to the database.
I found some references to starting mongo an to the message I had.

ubuntu install mongodb error :Failed to connect to 127.0.0.1:27017

I use sudo mongod --repair
win#win-VirtualBox:/var/lib/mongodb$sudo mongod --repair
2014-09-02T22:57:35.759+0800 [initandlisten] MongoDB starting : pid=28790 port=27017 dbpath=/data/db 64-bit host=winsome-VirtualBox
2014-09-02T22:57:35.760+0800 [initandlisten] db version v2.6.4
2014-09-02T22:57:35.761+0800 [initandlisten] git version: 3a830be0eb92d772aa855ebb711ac91d658ee910
2014-09-02T22:57:35.761+0800 [initandlisten] build info: Linux build7.nj1.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2014-09-02T22:57:35.762+0800 [initandlisten] allocator: tcmalloc
2014-09-02T22:57:35.762+0800 [initandlisten] options: { repair: true }
2014-09-02T22:57:35.776+0800 [initandlisten] finished checking dbs
2014-09-02T22:57:35.776+0800 [initandlisten] dbexit:
2014-09-02T22:57:35.777+0800 [initandlisten] shutdown: going to close listening sockets...
2014-09-02T22:57:35.777+0800 [initandlisten] shutdown: going to flush diaglog...
2014-09-02T22:57:35.778+0800 [initandlisten] shutdown: going to close sockets...
2014-09-02T22:57:35.778+0800 [initandlisten] shutdown: waiting for fs preallocator...
2014-09-02T22:57:35.779+0800 [initandlisten] shutdown: closing all files...
2014-09-02T22:57:35.779+0800 [initandlisten] closeAllFiles() finished
2014-09-02T22:57:35.780+0800 [initandlisten] shutdown: removing fs lock...
2014-09-02T22:57:35.780+0800 [initandlisten] dbexit: really exiting now
win#win-VirtualBox:/var/lib/mongodb$ sudo service mongod start
mongod start/running, process 28806
But still can't connect to mongodb
win#win-VirtualBox:/var/lib/mongodb$ mongo
MongoDB shell version: 2.6.4
connecting to: test
2014-09-02T22:58:07.395+0800 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2014-09-02T22:58:07.396+0800 Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146
exception: connect failed
Can someone tell me how to fix it ? or how to install mongodb correctly?
Thanks
When you typed in the mongod command, did you also give it a path? This is usually the issue. You don't have to bother with the conf file. simply type
mongod --dbpath="put your path to where you want it to save the working area for your database here!! without these silly quotations marks I may also add!"
example: mongod --dbpath=C:/Users/Kyle-3/Desktop/DEV/dangerzonearea/test/mongodb
That is my path and don't forget if on windows to flip the slashes forward if you copied it from the or it won't work!