Não é possível iniciar o serviço mongodb

0

Seguindo este guia para instalar o mongodb, mas mongo só não quer começar.

Ao executar sudo systemctl status mongodb , ele mostra apenas Active: failed (Result: exit-code) . Não há saída útil nisso. Como descubro por que não está começando?

Editar:

saída de ls -al /etc/systemd/system/mongodb.service

-rw-r--r-- 1 root root 220 Feb 17 23:59 /etc/systemd/system/mongodb.service

saída de cat /etc/systemd/system/mongodb.service

[Unit]
Description=High-performance, schema-free document-oriented >database
After=network.target

[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf

[Install]
WantedBy=multi-user.target

saída de mongod

2017-02-18T10:19:55.072+0200 I CONTROL  [initandlisten] MongoDB starting : pid=6617 port=27017 dbpath=/data/db 64-bit host=sherrie-HP-Pavilion-x360-m3-Convertible
2017-02-18T10:19:55.072+0200 I CONTROL  [initandlisten] db version v3.2.12
2017-02-18T10:19:55.072+0200 I CONTROL  [initandlisten] git version: ef3e1bc78e997f0d9f22f45aeb1d8e3b6ac14a14
2017-02-18T10:19:55.072+0200 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2017-02-18T10:19:55.072+0200 I CONTROL  [initandlisten] allocator: tcmalloc
2017-02-18T10:19:55.072+0200 I CONTROL  [initandlisten] modules: none
2017-02-18T10:19:55.072+0200 I CONTROL  [initandlisten] build environment:
2017-02-18T10:19:55.072+0200 I CONTROL  [initandlisten]     distmod: ubuntu1604
2017-02-18T10:19:55.072+0200 I CONTROL  [initandlisten]     distarch: x86_64
2017-02-18T10:19:55.072+0200 I CONTROL  [initandlisten]     target_arch: x86_64
2017-02-18T10:19:55.072+0200 I CONTROL  [initandlisten] options: {}
2017-02-18T10:19:55.137+0200 I -        [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2017-02-18T10:19:55.155+0200 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
2017-02-18T10:19:55.155+0200 I CONTROL  [initandlisten] dbexit:  rc: 100
    
por Mina Michael 18.02.2017 / 01:21

1 resposta

2

Apenas uma reinstalação simples funcionou.

sudo apt purge mongodb-org*
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
sudo apt update
sudo apt-get install -y mongodb-org

e verifique novamente o arquivo de configuração:

sudo nano /etc/systemd/system/mongodb.service

cole isto:

[Unit]
Description=High-performance, schema-free document-oriented >database
After=network.target

[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf

[Install]
WantedBy=multi-user.target

finalmente

sudo systemctl start mongodb
sudo systemctl enable mongodb

também acho que mudei as permissões do arquivo de log para 777

    
por Mina Michael 18.02.2017 / 12:11