Hello, I'm on Fedora 25 and I can't use Mongodb, it crash on start. Here is the messages I get : $ mongo or # mongo MongoDB shell version: 3.2.8 connecting to: test 2017-02-28T16:59:23.077+0100 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused 2017-02-28T16:59:23.077+0100 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 $ mongod or # mongod 2017-02-28T16:58:52.467+0100 I CONTROL [initandlisten] MongoDB starting : pid=10825 port=27017 dbpath=/data/db 64-bit host=hp 2017-02-28T16:58:52.468+0100 I CONTROL [initandlisten] db version v3.2.8 2017-02-28T16:58:52.468+0100 I CONTROL [initandlisten] git version: ed70e33130c977bda0024c125b56d159573dbaf0 2017-02-28T16:58:52.468+0100 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2k-fips 26 Jan 2017 2017-02-28T16:58:52.468+0100 I CONTROL [initandlisten] allocator: tcmalloc 2017-02-28T16:58:52.468+0100 I CONTROL [initandlisten] modules: none 2017-02-28T16:58:52.468+0100 I CONTROL [initandlisten] build environment: 2017-02-28T16:58:52.468+0100 I CONTROL [initandlisten] distarch: x86_64 2017-02-28T16:58:52.468+0100 I CONTROL [initandlisten] target_arch: x86_64 2017-02-28T16:58:52.468+0100 I CONTROL [initandlisten] options: {} 2017-02-28T16:58:52.513+0100 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating 2017-02-28T16:58:52.513+0100 I CONTROL [initandlisten] dbexit: rc: 100 If I use "# mongod --dbpath /var/lib/mongodb/", mongod start Thanks.
Here is the output of: $ sudo systemctl start mongod Job for mongod.service failed because the control process exited with error code. See "systemctl status mongod.service" and "journalctl -xe" for details. $ journalctl -xe -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit mongod.service has begun starting up. févr. 28 21:20:07 hp mongod[6091]: about to fork child process, waiting until se févr. 28 21:20:07 hp mongod[6091]: forked process: 6093 févr. 28 21:20:07 hp mongod[6091]: ERROR: child process failed, exited with erro févr. 28 21:20:07 hp audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=429 févr. 28 21:20:07 hp systemd[1]: mongod.service: Control process exited, code=ex févr. 28 21:20:07 hp systemd[1]: Failed to start High-performance, schema-free d -- Subject: Unit mongod.service has failed -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit mongod.service has failed. -- -- The result is failed. févr. 28 21:20:07 hp systemd[1]: mongod.service: Unit entered failed state. févr. 28 21:20:07 hp systemd[1]: mongod.service: Failed with result 'exit-code'. févr. 28 21:20:07 hp audit[6088]: USER_END pid=6088 uid=0 auid=1000 ses=3 msg='o févr. 28 21:20:07 hp audit[6088]: CRED_DISP pid=6088 uid=0 auid=1000 ses=3 msg=' févr. 28 21:20:07 hp sudo[6088]: pam_unix(sudo:session): session closed for user févr. 28 21:20:18 hp gnome-shell[1620]: gsignal.c:2641: instance '0x556426c13b60 lines 1783-1805/1805 (END) $ systemctl status mongod.service ● mongod.service - High-performance, schema-free document-oriented database Loaded: loaded (/usr/lib/systemd/system/mongod.service; disabled; vendor pres Active: failed (Result: exit-code) since mar. 2017-02-28 21:20:07 CET; 5min a Process: 6091 ExecStart=/usr/bin/mongod $OPTIONS run (code=exited, status=100) févr. 28 21:20:07 hp systemd[1]: Starting High-performance, schema-free document févr. 28 21:20:07 hp mongod[6091]: about to fork child process, waiting until se févr. 28 21:20:07 hp mongod[6091]: forked process: 6093 févr. 28 21:20:07 hp systemd[1]: mongod.service: Control process exited, code=ex févr. 28 21:20:07 hp systemd[1]: Failed to start High-performance, schema-free d févr. 28 21:20:07 hp systemd[1]: mongod.service: Unit entered failed state. févr. 28 21:20:07 hp systemd[1]: mongod.service: Failed with result 'exit-code'.
Please provide also content of /var/log/mongodb/mongod.log. Also try to remove content of /var/lib/mongodb/ and start mongod service again. If mongod is run from command line by root user, then systemd unit don't have permissions to remove/rewrite files in /var/lib/mongodb/, so it crashes.
Created attachment 1258604 [details] mongo log
I removed the content of /var/lib/mongodb/ (but not the directory itself) but it's the same.
Thank for the log. Unfortunately I am not possible to reproduce this issue. It is working for me with fresh F25 installation. Could you provide please some instructions how to reproduce this?
Do you somehow configured IPv6 support?
It's a "fresh" install, I mean I installed it a week ago. Indeed, I disabled ipv6 with "ipv6.disable=1" in grub (I need that to avoid gmail working slowly in evolution).
I re-enabled the ipv6 (removed "ipv6.disable=1" from grub /etc/default/grub) and it work ! Gmail in evolution seem to work well too now too with ipv6 enabled ! Thanks ! That said is it normal that it work with $ systemctrl start mongod but not with $ mongod or $ sudo mongod ? With $ mongod and $ sudo mongod there is these errors. [jeremy@hp ~] $ mongod 2017-03-01T19:39:45.364+0100 I CONTROL [initandlisten] MongoDB starting : pid=2766 port=27017 dbpath=/data/db 64-bit host=hp 2017-03-01T19:39:45.364+0100 I CONTROL [initandlisten] db version v3.2.8 2017-03-01T19:39:45.364+0100 I CONTROL [initandlisten] git version: ed70e33130c977bda0024c125b56d159573dbaf0 2017-03-01T19:39:45.364+0100 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2k-fips 26 Jan 2017 2017-03-01T19:39:45.364+0100 I CONTROL [initandlisten] allocator: tcmalloc 2017-03-01T19:39:45.364+0100 I CONTROL [initandlisten] modules: none 2017-03-01T19:39:45.364+0100 I CONTROL [initandlisten] build environment: 2017-03-01T19:39:45.364+0100 I CONTROL [initandlisten] distarch: x86_64 2017-03-01T19:39:45.364+0100 I CONTROL [initandlisten] target_arch: x86_64 2017-03-01T19:39:45.364+0100 I CONTROL [initandlisten] options: {} 2017-03-01T19:39:45.409+0100 E NETWORK [initandlisten] listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017 2017-03-01T19:39:45.409+0100 E NETWORK [initandlisten] addr already in use 2017-03-01T19:39:45.409+0100 E STORAGE [initandlisten] Failed to set up sockets during startup. 2017-03-01T19:39:45.409+0100 I CONTROL [initandlisten] dbexit: rc: 48 [jeremy@hp ~] $ sudo mongod [sudo] password for jeremy: 2017-03-01T19:39:57.024+0100 I CONTROL [initandlisten] MongoDB starting : pid=2781 port=27017 dbpath=/data/db 64-bit host=hp 2017-03-01T19:39:57.024+0100 I CONTROL [initandlisten] db version v3.2.8 2017-03-01T19:39:57.024+0100 I CONTROL [initandlisten] git version: ed70e33130c977bda0024c125b56d159573dbaf0 2017-03-01T19:39:57.024+0100 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2k-fips 26 Jan 2017 2017-03-01T19:39:57.024+0100 I CONTROL [initandlisten] allocator: tcmalloc 2017-03-01T19:39:57.024+0100 I CONTROL [initandlisten] modules: none 2017-03-01T19:39:57.024+0100 I CONTROL [initandlisten] build environment: 2017-03-01T19:39:57.024+0100 I CONTROL [initandlisten] distarch: x86_64 2017-03-01T19:39:57.024+0100 I CONTROL [initandlisten] target_arch: x86_64 2017-03-01T19:39:57.024+0100 I CONTROL [initandlisten] options: {} 2017-03-01T19:39:57.067+0100 E NETWORK [initandlisten] listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017 2017-03-01T19:39:57.067+0100 E NETWORK [initandlisten] addr already in use 2017-03-01T19:39:57.067+0100 E STORAGE [initandlisten] Failed to set up sockets during startup. 2017-03-01T19:39:57.067+0100 I CONTROL [initandlisten] dbexit: rc: 48
(In reply to jeremy9856 from comment #8) > That said is it normal that it work with $ systemctrl start mongod but not > with $ mongod or $ sudo mongod ? Difference is that systemd service use /etc/mongod.conf and there is IPv6 support enabled by default. Simple running mongod does not have this specified. So have it working with systemd service and disabled IPv6, you have to edit config file: disable IPv6 and remove ::1 listened address. > With $ mongod and $ sudo mongod there is these errors. > > [jeremy@hp ~] $ mongod > 2017-03-01T19:39:45.364+0100 I CONTROL [initandlisten] MongoDB starting : > pid=2766 port=27017 dbpath=/data/db 64-bit host=hp > 2017-03-01T19:39:45.364+0100 I CONTROL [initandlisten] db version v3.2.8 > 2017-03-01T19:39:45.364+0100 I CONTROL [initandlisten] git version: > ed70e33130c977bda0024c125b56d159573dbaf0 > 2017-03-01T19:39:45.364+0100 I CONTROL [initandlisten] OpenSSL version: > OpenSSL 1.0.2k-fips 26 Jan 2017 > 2017-03-01T19:39:45.364+0100 I CONTROL [initandlisten] allocator: tcmalloc > 2017-03-01T19:39:45.364+0100 I CONTROL [initandlisten] modules: none > 2017-03-01T19:39:45.364+0100 I CONTROL [initandlisten] build environment: > 2017-03-01T19:39:45.364+0100 I CONTROL [initandlisten] distarch: x86_64 > 2017-03-01T19:39:45.364+0100 I CONTROL [initandlisten] target_arch: > x86_64 > 2017-03-01T19:39:45.364+0100 I CONTROL [initandlisten] options: {} > 2017-03-01T19:39:45.409+0100 E NETWORK [initandlisten] listen(): bind() > failed errno:98 Address already in use for socket: 0.0.0.0:27017 > 2017-03-01T19:39:45.409+0100 E NETWORK [initandlisten] addr already in use > 2017-03-01T19:39:45.409+0100 E STORAGE [initandlisten] Failed to set up > sockets during startup. > 2017-03-01T19:39:45.409+0100 I CONTROL [initandlisten] dbexit: rc: 48 I seems like another mongod server is running (systemd service?), so mongod can't use port 27017 on localhost (another project is using it).
(In reply to Marek Skalický from comment #9) > I seems like another mongod server is running (systemd service?), so mongod > can't use port 27017 on localhost (another project is using it). It seem that there was a running process. I killed it and tried again "$ sudo mongod" but that didn't worked too $ sudo mongod 2017-03-01T21:26:39.885+0100 I CONTROL [initandlisten] MongoDB starting : pid=8754 port=27017 dbpath=/data/db 64-bit host=hp 2017-03-01T21:26:39.885+0100 I CONTROL [initandlisten] db version v3.2.8 2017-03-01T21:26:39.885+0100 I CONTROL [initandlisten] git version: ed70e33130c977bda0024c125b56d159573dbaf0 2017-03-01T21:26:39.885+0100 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2k-fips 26 Jan 2017 2017-03-01T21:26:39.885+0100 I CONTROL [initandlisten] allocator: tcmalloc 2017-03-01T21:26:39.885+0100 I CONTROL [initandlisten] modules: none 2017-03-01T21:26:39.885+0100 I CONTROL [initandlisten] build environment: 2017-03-01T21:26:39.885+0100 I CONTROL [initandlisten] distarch: x86_64 2017-03-01T21:26:39.885+0100 I CONTROL [initandlisten] target_arch: x86_64 2017-03-01T21:26:39.885+0100 I CONTROL [initandlisten] options: {} 2017-03-01T21:26:39.928+0100 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating 2017-03-01T21:26:39.928+0100 I CONTROL [initandlisten] dbexit: rc: 100 What is the recommended way for starting Mongod for local use (I'm learning MEAN Stack). Thanks !
(In reply to jeremy9856 from comment #10) > 2017-03-01T21:26:39.885+0100 I CONTROL [initandlisten] options: {} > 2017-03-01T21:26:39.928+0100 I STORAGE [initandlisten] exception in > initAndListen: 29 Data directory /data/db not found., terminating > 2017-03-01T21:26:39.928+0100 I CONTROL [initandlisten] dbexit: rc: 100 Default directory for data for mongod is /data/db, this directory does not exist, so it fails. > What is the recommended way for starting Mongod for local use (I'm learning > MEAN Stack). Thanks ! --dbpath option used to change data directory (must exist) --port option is used to change listened port (to not to conflicts with other processes) So it could be for example: mkdir ~/db mongod --dbpath ~/db --port 27018
Thank you very much ! I think I can close this :)