Question

Mongo not working - cant connect

I ve installed mongo and it was working fine but at some point the daemon was down and if i try to call mongod that’s the output

2017-04-01T15:53:37.396+0000 I CONTROL  [initandlisten] MongoDB starting : pid=19715 port=27017 dbpath=/data/db 64-bit host=nodejs-512mb-fra1-01
2017-04-01T15:53:37.396+0000 I CONTROL  [initandlisten] db version v3.4.2
2017-04-01T15:53:37.396+0000 I CONTROL  [initandlisten] git version: 3f76e40c105fc223b3e5aac3e20dcd026b83b38b
2017-04-01T15:53:37.396+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2017-04-01T15:53:37.397+0000 I CONTROL  [initandlisten] allocator: tcmalloc
2017-04-01T15:53:37.397+0000 I CONTROL  [initandlisten] modules: none
2017-04-01T15:53:37.397+0000 I CONTROL  [initandlisten] build environment:
2017-04-01T15:53:37.397+0000 I CONTROL  [initandlisten]     distmod: ubuntu1604
2017-04-01T15:53:37.397+0000 I CONTROL  [initandlisten]     distarch: x86_64
2017-04-01T15:53:37.397+0000 I CONTROL  [initandlisten]     target_arch: x86_64
2017-04-01T15:53:37.397+0000 I CONTROL  [initandlisten] options: {}
2017-04-01T15:53:37.468+0000 I -        [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2017-04-01T15:53:37.469+0000 I STORAGE  [initandlisten] 
2017-04-01T15:53:37.469+0000 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2017-04-01T15:53:37.469+0000 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2017-04-01T15:53:37.469+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=256M,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2017-04-01T15:53:37.470+0000 E STORAGE  [initandlisten] WiredTiger error (13) [1491062017:470581][19715:0x7f5a7da3ccc0], wiredtiger_open: /data/db/WiredTiger.lock: handle-open: open: Permission denied
2017-04-01T15:53:37.471+0000 I -        [initandlisten] Assertion: 28595:13: Permission denied src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 267
2017-04-01T15:53:37.478+0000 I STORAGE  [initandlisten] exception in initAndListen: 28595 13: Permission denied, terminating
2017-04-01T15:53:37.478+0000 I NETWORK  [initandlisten] shutdown: going to close listening sockets...
2017-04-01T15:53:37.478+0000 I NETWORK  [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2017-04-01T15:53:37.478+0000 I NETWORK  [initandlisten] shutdown: going to flush diaglog...
2017-04-01T15:53:37.479+0000 I CONTROL  [initandlisten] now exiting
2017-04-01T15:53:37.479+0000 I CONTROL  [initandlisten] shutting down with code:100

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

@tamburrinipietro89 Run this command to show the contents:

sudo cat /etc/mongodb.conf

I get mongo invalid user

Have you given permissions for MongoDB to write to /data/db/ ? If you’re running it with user/group as mongo/mongo, then you can run this and then try to start MongoDB again:

chown -R mongo:mongo /data/db