Hello I have a problem with my MongoDB it was working just fine and after I restart the server and scrapping something this show up.
When I ran command
$ mongo
It respond with
MongoDB shell version: 3.2.13
connecting to: test
2017-05-29T01:11:42.948+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused
2017-05-29T01:11:42.948+0000 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:229:14
#(connect):1:6
exception: connect failed
I also ran this command
$ mongod
and it have me this error message
2017-05-29T01:17:58.441+0000 I CONTROL [initandlisten] MongoDB starting : pid=2530 port=27017 dbpath=/data/db 64-bit host=something
2017-05-29T01:17:58.441+0000 I CONTROL [initandlisten] db version v3.2.13
2017-05-29T01:17:58.441+0000 I CONTROL [initandlisten] git version: 23899209cad60aaafe114f6aea6cb83025ff51bc
2017-05-29T01:17:58.441+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
2017-05-29T01:17:58.441+0000 I CONTROL [initandlisten] allocator: tcmalloc
2017-05-29T01:17:58.441+0000 I CONTROL [initandlisten] modules: none
2017-05-29T01:17:58.441+0000 I CONTROL [initandlisten] build environment:
2017-05-29T01:17:58.441+0000 I CONTROL [initandlisten] distmod: ubuntu1604
2017-05-29T01:17:58.441+0000 I CONTROL [initandlisten] distarch: x86_64
2017-05-29T01:17:58.441+0000 I CONTROL [initandlisten] target_arch: x86_64
2017-05-29T01:17:58.441+0000 I CONTROL [initandlisten] options: {}
2017-05-29T01:17:58.469+0000 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock errno:1 Operation not permitted
2017-05-29T01:17:58.469+0000 I - [initandlisten] Fatal Assertion 28578
2017-05-29T01:17:58.469+0000 I - [initandlisten]
***aborting after fassert() failure
Then I tried
sudo service mongod start
sudo service mongod status
and it give me this fail error
● mongod.service - High-performance, schema-free document-oriented database
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2017-05-29 01:24:29 UTC; 1min 29s ago
Docs: https://docs.mongodb.org/manual
Process: 3200 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (code=exited, status=100)
Main PID: 3200 (code=exited, status=100)
May 29 01:24:29 something systemd[1]: Started High-performance, schema-free document-oriented database.
May 29 01:24:29 something systemd[1]: mongod.service: Main process exited, code=exited, status=100/n/a
May 29 01:24:29 something systemd[1]: mongod.service: Unit entered failed state.
May 29 01:24:29 something systemd[1]: mongod.service: Failed with result 'exit-code'.
I've tried deleted the socket file and give it a try but didn't work.
Thank you in advanced! :)
I am not sure if this is the correct answer or not. However, it appears to me that
2017-05-29T01:17:58.469+0000 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock errno:1 Operation not permitted
is the main problem. Perhaps you could double check who owns this? also the permission?
It looks like this in my mongo:
Hopefully it helps
rm /var/lib/mongodb/mongod.lock
systemctl restart mongod
systemctl status mongod
Related
I'm try to uninstall mongod but it's give
message of file / package missing
during installation it's show message
of no newly file install ...............
dz-gg-04#dz-gg-04:~$ sudo apt-get install -y mongodb
Reading package lists... Done
Building dependency tree
Reading state information... Done
mongodb is already the newest version (1:3.6.3-0ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 26 not upgraded.
dz-gg-04#dz-gg-04:~$ mongod
2018-10-19T15:25:00.599+0530 I CONTROL [initandlisten] MongoDB starting : pid=4627 port=27017 dbpath=/data/db 64-bit host=dz-gg-04
2018-10-19T15:25:00.599+0530 I CONTROL [initandlisten] db version v3.6.3
2018-10-19T15:25:00.599+0530 I CONTROL [initandlisten] git version: 9586e557d54ef70f9ca4b43c26892cd55257e1a5
2018-10-19T15:25:00.599+0530 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.0g 2 Nov 2017
2018-10-19T15:25:00.599+0530 I CONTROL [initandlisten] allocator: tcmalloc
2018-10-19T15:25:00.599+0530 I CONTROL [initandlisten] modules: none
2018-10-19T15:25:00.599+0530 I CONTROL [initandlisten] build environment:
2018-10-19T15:25:00.599+0530 I CONTROL [initandlisten] distarch: x86_64
2018-10-19T15:25:00.599+0530 I CONTROL [initandlisten] target_arch: x86_64
2018-10-19T15:25:00.599+0530 I CONTROL [initandlisten] options: {}
2018-10-19T15:25:00.600+0530 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory /data/db not found., terminating
2018-10-19T15:25:00.600+0530 I CONTROL [initandlisten] now exiting
2018-10-19T15:25:00.600+0530 I CONTROL [initandlisten] shutting down with code:100
dz-gg-04#dz-gg-04:~$ mongo
MongoDB shell version v3.6.3
connecting to: mongodb://127.0.0.1:27017
2018-10-19T15:26:04.016+0530 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2018-10-19T15:26:04.016+0530 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
dz-gg-04#dz-gg-04:~$ sudo service mongod start
Failed to start mongod.service: Unit mongod.service not found.
dz-gg-04#dz-gg-04:~$ ^C
dz-gg-04#dz-gg-04:~$ ^C
dz-gg-04#dz-gg-04:~$ ^C
dz-gg-04#dz-gg-04:~$ ^C
dz-gg-04#dz-gg-04:~$ ^C
dz-gg-04#dz-gg-04:~$ sudo service mongod start
exception in initAndListen: NonExistentPath: Data directory /data/db not found., terminating
Create the directory /data/db
I am trying to use multiple IP addresses in the bindIp configuration option and after saving the configuration changes, the mongodb server won't start. The same thing is working in MongoDB version 3.4
Here is the configuration settings:
# network interfaces
net:
port: 36784
bindIp: 127.0.0.1,10.0.0.226
Here 10.0.0.226 is the private IP address of the EC2 instance.
The same type of configuration was working in earliers versions of MongoDB more specifically in v3.4
If I use bindIp to 0.0.0.0, then of course it allows remote connections to all the IP addresses.
Once i restart the server, i am getting the following error:
mongod.service - High-performance, schema-free document-oriented database
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2018-06-25 05:36:45 UTC; 15s ago
Docs: https://docs.mongodb.org/manual
Process: 1570 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=48)
Main PID: 1570 (code=exited, status=48)
Jun 25 05:36:45 ip-10-0-1-69 systemd[1]: Stopped High-performance, schema-free document-oriented database.
Jun 25 05:36:45 ip-10-0-1-69 systemd[1]: Started High-performance, schema-free document-oriented database.
Jun 25 05:36:45 ip-10-0-1-69 systemd[1]: mongod.service: Main process exited, code=exited, status=48/n/a
Jun 25 05:36:45 ip-10-0-1-69 systemd[1]: mongod.service: Unit entered failed state.
Jun 25 05:36:45 ip-10-0-1-69 systemd[1]: mongod.service: Failed with result 'exit-code'.
Here is the logs files content:
2018-06-25T05:07:38.842+0000 I CONTROL [initandlisten] now exiting
2018-06-25T05:07:38.842+0000 I CONTROL [initandlisten] shutting down with code:48
2018-06-25T05:13:43.192+0000 I CONTROL [main] ***** SERVER RESTARTED *****
2018-06-25T05:13:43.201+0000 I CONTROL [initandlisten] MongoDB starting : pid=1390 port=36784 dbpath=/var/lib/mongodb 64-bit host=ip-10-0-1-69
2018-06-25T05:13:43.201+0000 I CONTROL [initandlisten] db version v3.6.5
2018-06-25T05:13:43.201+0000 I CONTROL [initandlisten] git version: a20ecd3e3a174162052ff99913bc2ca9a839d618
2018-06-25T05:13:43.201+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
2018-06-25T05:13:43.201+0000 I CONTROL [initandlisten] allocator: tcmalloc
2018-06-25T05:13:43.201+0000 I CONTROL [initandlisten] modules: none
2018-06-25T05:13:43.201+0000 I CONTROL [initandlisten] build environment:
2018-06-25T05:13:43.201+0000 I CONTROL [initandlisten] distmod: ubuntu1604
2018-06-25T05:13:43.201+0000 I CONTROL [initandlisten] distarch: x86_64
2018-06-25T05:13:43.201+0000 I CONTROL [initandlisten] target_arch: x86_64
2018-06-25T05:13:43.201+0000 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1,10.0.0.226", port: 36784 }, processManagement: { timeZoneInfo: "/usr/share/zoneinfo" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2018-06-25T05:13:43.201+0000 E STORAGE [initandlisten] Failed to set up listener: SocketException: Cannot assign requested address
2018-06-25T05:13:43.201+0000 I CONTROL [initandlisten] now exiting
2018-06-25T05:13:43.201+0000 I CONTROL [initandlisten] shutting down with code:48
I have gone through the official docs and could not find any deprecation notices.
what might be the issue?
Thank you
When I understand this line from the log correctly
2018-06-25T05:13:43.201+0000 I CONTROL [initandlisten] MongoDB starting : pid=1390 port=36784 dbpath=/var/lib/mongodb 64-bit host=ip-10-0-1-69
the host's ip is 10.0.1.69 and not 10.0.0.226. That would explain the error.
We've got an emergency situation regarding a production website which had just been released. We just got hit by a heavy DDoS-attack and servers got overloaded by requests. Once the attack had stopped, we've restarted the server with the database and we noticed that the 'WiredTiger.wt' file had just disappeared and that Mongo no longer works. I'm wondering what could we do to restore the database and have Mongo running back, taking into account that the 'WiredTiger.wt' file is missing ?
We've got an instance which has it's MONGO_URL set to another instance where we have the database (here's where the DDoS-attack happened).
Here are some logs that you could check:
When I try on the database server to connect "mongo NAME_OF_DATABASE":
MongoDB shell version: 3.2.11
connecting to: NAME_OF_DATABASE
Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:229:14
#(connect):1:6
exception: connect failed
When I check the logs "mongo log /var/log/mongodb/mongod.log":
2017-04-04T11:05:18.252+0000 I CONTROL [main] ***** SERVER RESTARTED *****
2017-04-04T11:05:18.255+0000 I CONTROL [initandlisten] MongoDB starting : pid=2716 port=27017 dbpath=/var/lib/mongodb 64-bit host=ip-xxx-xxx-xxx-xxx
2017-04-04T11:05:18.256+0000 I CONTROL [initandlisten] db version v3.2.11
2017-04-04T11:05:18.256+0000 I CONTROL [initandlisten] git version: 009580ad490190ba33d1c6253ebd8d91808923e4
2017-04-04T11:05:18.256+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
2017-04-04T11:05:18.256+0000 I CONTROL [initandlisten] allocator: tcmalloc
2017-04-04T11:05:18.256+0000 I CONTROL [initandlisten] modules: none
2017-04-04T11:05:18.256+0000 I CONTROL [initandlisten] build environment:
2017-04-04T11:05:18.256+0000 I CONTROL [initandlisten] distmod: ubuntu1604
2017-04-04T11:05:18.256+0000 I CONTROL [initandlisten] distarch: x86_64
2017-04-04T11:05:18.256+0000 I CONTROL [initandlisten] target_arch: x86_64
2017-04-04T11:05:18.256+0000 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { port: 27017 }, security: { authorization: "enabled" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log", quiet: true } }
2017-04-04T11:05:18.279+0000 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock errno:1 Operation not permitted
2017-04-04T11:05:18.279+0000 I - [initandlisten] Fatal Assertion 28578
2017-04-04T11:05:18.279+0000 I - [initandlisten]
When I run "sudo service mongodb status":
mongodb.service - High-performance, schema-free document-oriented database
Loaded: loaded (/etc/systemd/system/mongodb.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2017-04-04 11:51:06 UTC; 8s ago
Process: 1384 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (code=exited, status=14)
Main PID: 1384 (code=exited, status=14)
Apr 04 11:51:06 ip-172-31-42-103 systemd[1]: Started High-performance, schema-free document-oriented database.
Apr 04 11:51:06 ip-172-31-42-103 systemd[1]: mongodb.service: Main process exited, code=exited, status=14/n/a
Apr 04 11:51:06 ip-172-31-42-103 systemd[1]: mongodb.service: Unit entered failed state.
Apr 04 11:51:06 ip-172-31-42-103 systemd[1]: mongodb.service: Failed with result 'exit-code'.
Thank you!
I setup mongodb on ubuntu 16.04 with:
echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
But I get these error when i try to start the service:
**~$** systemctl start mongodb
Failed to start mongodb.service: Unit mongodb.service is masked.
**~$** systemctl start mongod
Failed to start mongod.service: Unit mongod.service not found.
**~$** sudo service mongod start
Failed to start mongod.service: Unit mongod.service not found.
**~$** mongod
mongod --help for help and startup options
2016-09-04T11:20:59.074+0200 [initandlisten] MongoDB starting : pid=30207 port=27017 dbpath=/data/db 64-bit host=zantes
2016-09-04T11:20:59.074+0200 [initandlisten] db version v2.6.10
2016-09-04T11:20:59.074+0200 [initandlisten] git version: nogitversion
2016-09-04T11:20:59.074+0200 [initandlisten] OpenSSL version: OpenSSL 1.0.2g-fips 1 Mar 2016
2016-09-04T11:20:59.074+0200 [initandlisten] build info: Linux lgw01-12 3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:16:20 UTC 2015 x86_64 BOOST_LIB_VERSION=1_58
2016-09-04T11:20:59.074+0200 [initandlisten] allocator: tcmalloc
2016-09-04T11:20:59.074+0200 [initandlisten] options: {}
2016-09-04T11:20:59.074+0200 [initandlisten] exception in initAndListen: 10296
*********************************************************************
ERROR: dbpath (/data/db) does not exist.
Create this directory or give existing directory in --dbpath.
See http://dochub.mongodb.org/core/startingandstoppingmongo
*********************************************************************
, terminating
2016-09-04T11:20:59.074+0200 [initandlisten] dbexit:
2016-09-04T11:20:59.074+0200 [initandlisten] shutdown: going to close listening sockets...
2016-09-04T11:20:59.074+0200 [initandlisten] shutdown: going to flush diaglog...
2016-09-04T11:20:59.074+0200 [initandlisten] shutdown: going to close sockets...
2016-09-04T11:20:59.074+0200 [initandlisten] shutdown: waiting for fs preallocator...
2016-09-04T11:20:59.074+0200 [initandlisten] shutdown: lock for final commit...
2016-09-04T11:20:59.074+0200 [initandlisten] shutdown: final commit...
2016-09-04T11:20:59.074+0200 [initandlisten] shutdown: closing all files...
2016-09-04T11:20:59.074+0200 [initandlisten] closeAllFiles() finished
2016-09-04T11:20:59.074+0200 [initandlisten] dbexit: really exiting now
But when i check the status is active, please help me. I don't know what I have to do!
**~$** sudo systemctl status mongodb
**●** mongodb.service - An object/document-oriented database
Loaded: loaded (/lib/systemd/system/mongodb.service; enabled; vendor prese
Active: active (running) since dom 2016-09-04 11:01:11 CEST; 20min ago
Docs: man:mongod(1)
Main PID: 27544 (mongod)
CGroup: /system.slice/mongodb.service
└─27544 /usr/bin/mongod --config /etc/mongodb.conf
set 04 11:01:11 zantes systemd[1]: Started An object/document-oriented databa
lines 1-9/9 (END)
I previously worked on c9 but it has so much problems and is slow, I need mongodb for working on my projects
(sorry for my bad englis)
Somewhere in the error message it says "dbpath (/data/db) does not exist". "/data/db" is the default directory in which mongodb stores its data files. You have to create it manually. It seems this path does not exist.
If you want to change this path, either pass --dbpath parameter to mongod or change the dbpath parameter value in mongodb.conf file.
if mongodbversion is >=4 and installed in ubuntu, use mongod instead of mongodb
sudo systemctl status mongod
sudo systemctl start mongod
sudo vi /etc/mongod.conf
otherwise , you will get following error with mongodb command
Failed to restart mongodb.service: Unit mongodb.service is masked.
I've just installed mongodb on ubuntu using these instructions:
https://askubuntu.com/questions/724749/install-mongo-3-2-on-ubuntu-15-10
When I try to start it, I see this error:
me#devbox:/usr/bin$ service mongod start
Failed to start mongod.service: Unit mongod.service is masked.
me#devbox:~$ mongod
2016-04-15T11:24:01.941-0400 I CONTROL [initandlisten] MongoDB starting : pid=4343 port=27017 dbpath=/data/db 64-bit host=mydev
2016-04-15T11:24:01.941-0400 I CONTROL [initandlisten] db version v3.2.5
2016-04-15T11:24:01.941-0400 I CONTROL [initandlisten] git version: 34e65e5383f7ea1726332cb175b73077ec4a1b02
2016-04-15T11:24:01.941-0400 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2d 9 Jul 2015
2016-04-15T11:24:01.941-0400 I CONTROL [initandlisten] allocator: tcmalloc
2016-04-15T11:24:01.941-0400 I CONTROL [initandlisten] modules: none
2016-04-15T11:24:01.941-0400 I CONTROL [initandlisten] build environment:
2016-04-15T11:24:01.941-0400 I CONTROL [initandlisten] distmod: ubuntu1404
2016-04-15T11:24:01.941-0400 I CONTROL [initandlisten] distarch: x86_64
2016-04-15T11:24:01.941-0400 I CONTROL [initandlisten] target_arch: x86_64
2016-04-15T11:24:01.941-0400 I CONTROL [initandlisten] options: {}
2016-04-15T11:24:02.031-0400 I STORAGE [initandlisten] exception in initAndListen: 98 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
2016-04-15T11:24:02.031-0400 I CONTROL [initandlisten] dbexit: rc: 100
When i try to check status, it says this:
me#devbox:~$ service mongod status
● mongod.service
Loaded: masked (/lib/systemd/system/mongod.service; masked; vendor preset: enabled)
Active: inactive (dead)
And when I try to start command line it says this:
me#devbox:/usr/bin$ mongo
MongoDB shell version: 3.2.5
connecting to: test
2016-04-15T11:32:11.828-0400 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2016-04-15T11:32:11.828-0400 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:229:14
#(connect):1:6
exception: connect failed
Not sure how to get this started