O MongoDB já estava funcionando há alguns meses e parou de repente.
eu corri:
service mongod restart
Restarting mongod (via systemctl): Job for mongod.service failed because
the control process exited with error code. See "systemctl status mongod.service"
and "journalctl -xe" for details
então:
systemctl status mongod.service
mongod.service - SYSV: Mongo is a scalable, document-oriented database.
Loaded: loaded (/etc/rc.d/init.d/mongod; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2017-12-21 14:57:30 EST; 9s ago
Docs: man:systemd-sysv-generator(8)
Process: 22675 ExecStop=/etc/rc.d/init.d/mongod stop (code=exited, status=0/SUCCESS)
Process: 28515 ExecStart=/etc/rc.d/init.d/mongod start (code=exited, status=1/FAILURE)
systemd[1]: Starting SYSV: Mongo is a scalable, document-oriented database....
mongod[28515]: Error starting mongod. /var/run/mongodb/mongod.pid exists.
systemd[1]: mongod.service: control process exited, code=exited status=1
systemd[1]: Failed to start SYSV: Mongo is a scalable, document-oriented database..
systemd[1]: Unit mongod.service entered failed state.
systemd[1]: mongod.service failed.
eu verifiquei o mongodb.log e obtive estes:
I CONTROL ***** SERVER RESTARTED *****
I CONTROL [initandlisten] MongoDB starting : pid=24312 port=27017 dbpath=/var/lib/mongo 64-bit host=server-11
I CONTROL [initandlisten] db version v3.0.15
I CONTROL [initandlisten] git version: b8ff507269c382bc100fc52f75f48d54cd42ec3b
I CONTROL [initandlisten] allocator: tcmalloc
I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, processManagement: { fork: true, pidFilePath: "/var/run/mongodb/mongod.pid" }, storage: { dbPath: "/var/lib/mongo", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
I STORAGE [initandlisten] exception in initAndListen: 98 Unable to create/open lock file: /var/lib/mongo/mongod.lock errno:28 No space left on device Is a mongod instance already running?, terminating
I CONTROL [initandlisten] dbexit: rc: 100
que é estranho porque a execução de df -h
mostra que ainda tenho muito espaço:
[root@server-11 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 20G 4.4G 15G 24% /
devtmpfs 485M 0 485M 0% /dev
tmpfs 494M 0 494M 0% /dev/shm
tmpfs 494M 57M 438M 12% /run
tmpfs 494M 0 494M 0% /sys/fs/cgroup
tmpfs 99M 0 99M 0% /run/user/0
[root@server-11 /]# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/xvda1 1310720 68253 1242467 6% /
devtmpfs 123983 303 123680 1% /dev
tmpfs 126358 1 126357 1% /dev/shm
tmpfs 126358 495 125863 1% /run
tmpfs 126358 16 126342 1% /sys/fs/cgroup
tmpfs 126358 1 126357 1% /run/user/0
eu também corri ls -la / var / lib / mongo
total 376860
drwxr-xr-x. 3 mongod mongod 4096 Dec 21 16:18 .
drwxr-xr-x. 38 root root 4096 Aug 17 13:25 ..
-rw-------. 1 mongod mongod 67108864 Aug 17 14:23 admin.0
-rw-------. 1 mongod mongod 16777216 Aug 17 14:23 admin.ns
drwxr-xr-x. 2 mongod mongod 4096 Dec 14 14:28 journal
-rw-------. 1 mongod mongod 67108864 Dec 20 16:59 learning_locker.0
-rw-------. 1 mongod mongod 134217728 Dec 20 16:59 learning_locker.1
-rw-------. 1 mongod mongod 16777216 Dec 20 16:59 learning_locker.ns
-rw-------. 1 mongod mongod 67108864 Dec 14 14:26 local.0
-rw-------. 1 mongod mongod 16777216 Dec 14 14:26 local.ns
-rw-r--r--. 1 mongod mongod 69 Aug 17 13:29 storage.bson
Eu instalei o mongodb com o usuário root e reiniciei o mongo com o mesmo usuário. Não sei por que isso mudaria de repente.