O Mongodb só funciona quando eu o sudo

1

Quando tento iniciar o MongoDB usando mongod , ele retorna para mim a seguinte mensagem:

2017-03-09T20:54:48.868-0300 I CONTROL  [initandlisten] MongoDB starting : pid=9556 port=27017 dbpath=/data/db 64-bit host=kallel-Aspire-ES1-511
2017-03-09T20:54:48.868-0300 I CONTROL  [initandlisten] db version v3.4.2
2017-03-09T20:54:48.869-0300 I CONTROL  [initandlisten] git version: 3f76e40c105fc223b3e5aac3e20dcd026b83b38b
2017-03-09T20:54:48.869-0300 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2017-03-09T20:54:48.869-0300 I CONTROL  [initandlisten] allocator: tcmalloc
2017-03-09T20:54:48.869-0300 I CONTROL  [initandlisten] modules: none
2017-03-09T20:54:48.869-0300 I CONTROL  [initandlisten] build environment:
2017-03-09T20:54:48.869-0300 I CONTROL  [initandlisten]     distmod: ubuntu1604
2017-03-09T20:54:48.869-0300 I CONTROL  [initandlisten]     distarch: x86_64
2017-03-09T20:54:48.869-0300 I CONTROL  [initandlisten]     target_arch: x86_64
2017-03-09T20:54:48.869-0300 I CONTROL  [initandlisten] options: {}
2017-03-09T20:54:48.869-0300 I STORAGE  [initandlisten] exception in initAndListen: 20 Attempted to create a lock file on a read-only directory: /data/db, terminating
2017-03-09T20:54:48.869-0300 I NETWORK  [initandlisten] shutdown: going to close listening sockets...
2017-03-09T20:54:48.869-0300 I NETWORK  [initandlisten] shutdown: going to flush diaglog...
2017-03-09T20:54:48.869-0300 I CONTROL  [initandlisten] now exiting
2017-03-09T20:54:48.869-0300 I CONTROL  [initandlisten] shutting down with code:100

Como posso resolvê-lo, não quero usá-lo toda vez.

    
por innis 10.03.2017 / 01:03

1 resposta

1

Você deve iniciar o serviço (mongod) usando root ou sudo. Tais como:

sudo service mongod start

Mas, sem necessidade de root, conecte-se usando o cliente mongo

mongo
    
por James 10.03.2017 / 02:11