Mongo not working - cant connect

April 1, 2017 426 views
MongoDB Ubuntu 16.04

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

3 Answers

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

I get mongo invalid user

@tamburrinipietro89 Run this command to show the contents:

sudo cat /etc/mongodb.conf
  • I only have a mongod.conf , not mongodb.conf
    The output of that command mongod.conf

    # mongod.conf
    
    # for documentation of all options, see:
    #   http://docs.mongodb.org/manual/reference/configuration-options/
    
    # Where and how to store data.
    storage:
      dbPath: /var/lib/mongodb
      journal:
        enabled: true
    #  engine:
    #  mmapv1:
    #  wiredTiger:
    
    # where to write logging data.
    systemLog:
      destination: file
      logAppend: true
      path: /var/log/mongodb/mongod.log
    
    # network interfaces
    net:
      port: 27017
      bindIp: 127.0.0.1
    
    
    #processManagement:
    
    #security:
    
    #operationProfiling:
    
    #replication:
    
    #sharding:
    
    ## Enterprise-Only Options:
    
    #auditLog:
    
    #snmp:
    
    
    • Okay, you must have a configuration file somewhere else, since this file has a different dbPath and no user/group information.

Have another answer? Share your knowledge.