Mongodb fails to start -> presents weird error logs - mongodb

When I moved my environment from my local (mac) to my server (ubuntu) I unzipped my directory and the server installed with npm install with no errors or warnings, but my database was failing so I decided to reinstall it based on this tutorial (well, apt-remove mongo* first)
https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04
but then I get a
Job for mongodb.service failed because the control process exited with error code. See "systemctl status mongodb.service" and "journalctl -xe" for details.
Does anyone know what any of this means?
-- Unit mongodb.service has begun starting up.
Jun 20 03:54:18 ip-172-31-16-163 mongodb[25271]: * Starting database mongodb
Jun 20 03:54:19 ip-172-31-16-163 mongodb[25271]: ...fail!
Jun 20 03:54:19 ip-172-31-16-163 systemd[1]: mongodb.service: Control process exited, code=exited status=1
Jun 20 03:54:19 ip-172-31-16-163 sudo[25268]: pam_unix(sudo:session): session closed for user root
Jun 20 03:54:19 ip-172-31-16-163 systemd[1]: Failed to start LSB: An object/document-oriented database.
-- Subject: Unit mongodb.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mongodb.service has failed.
--
-- The result is failed.
Jun 20 03:54:19 ip-172-31-16-163 systemd[1]: mongodb.service: Unit entered failed state.
Jun 20 03:54:19 ip-172-31-16-163 systemd[1]: mongodb.service: Failed with result 'exit-code'.

Looks familiar. Check ownership of files. Files in dbPath, mongod.run -lock file, keyfile...
Basically all those files what are listed at your /etc/mongod.conf

Run the following command and Its works for me
sudo apt-get install --reinstall mongodb

Related

Mongodb will not start. libboost_filesystem.so.1.78.0: cannot open shared object file: No such file or directory

Something must be broken, or maybe there is something I am not seeing.
I do:
sudo systemctl status mongodb.service
But I get this error:
Jan 26 10:47:49 MacBookPro systemd[1]: Starting MongoDB Database Server...
Jan 26 10:47:49 MacBookPro mongod[12272]: /usr/bin/mongod: error while loading shared libraries: libboost_filesystem.so.1.78.0: cannot>
Jan 26 10:47:49 MacBookPro systemd[1]: mongodb.service: Control process exited, code=exited, status=127/n/a
Jan 26 10:47:49 MacBookPro systemd[1]: mongodb.service: Failed with result 'exit-code'.
Jan 26 10:47:49 MacBookPro systemd[1]: Failed to start MongoDB Database Server.
I have been reading: https://wiki.archlinux.org/title/MongoDB
And because there is no mongod.lock file I do:
mongod --dbpath /var/lib/mongodb/ --repair
But the error persists:
mongod: error while loading shared libraries: libboost_filesystem.so.1.78.0: cannot open shared object file: No such file or directory
What do you guys think is happening? Thanks in advance. Btw I am using BlackArch.
I have tried a full update and upgrade. My system says it is fully updated, but maybe it is not?

Error running mongodb as service on Centos 7

I've got a VPS with Centos 7, But when I try to run MongoDB as service I get the following message:
Apr 06 03:11:46 server.backupserver.com systemd[1]: Starting MongoDB Database Server...
Apr 06 03:11:46 server.backupserver.com mongod[3767]: about to fork child process, waiting until server is ready for connections.
Apr 06 03:11:46 server.backupserver.com mongod[3767]: forked process: 3769
Apr 06 03:11:49 server.backupserver.com systemd[1]: Can't open PID file /var/run/mongodb/mongod.pid (yet?) after start: Too many levels of symbolic links
Apr 06 03:13:17 server.backupserver.com systemd[1]: mongod.service start operation timed out. Terminating.
Apr 06 03:13:17 server.backupserver.com systemd[1]: Failed to start MongoDB Database Server.
Apr 06 03:13:17 server.backupserver.com systemd[1]: Unit mongod.service entered failed state.
Apr 06 03:13:17 server.backupserver.com systemd[1]: mongod.service failed.
I tested the responses from another topics, but it doesn't work yet.
The "var/run/mongodb" directory and the file "mongod.pid" has the right permissions and user (mongod).
Please, help
This seems to be a message that systemd can produce under a variety of conditions. To troubleshoot:
Start with a pristine Docker, Vagrant, VirtualBox etc. image of CentOS 7.
Follow the official MongoDB installation instructions.
If you succeed, follow the official installation instructions on your VPS.

How to upgrade postgresql in NixOS?

I am attempting to update my postgresql server from 9.4 to (at least) 9.6 on my NixOS machine.
I have edited services.postgres.package in my configuration.nix to reflect this change, changing it from:
services.postgresql.package = pkgs.postgresql94
to
services.postgresql.package = pkgs.postgresql96
However, this results in an error upon running nixos-rebuild switch, namely:
$ sudo nixos-rebuild switch
building Nix...
building the system configuration...
stopping the following units: postgresql.service
NOT restarting the following changed units: display-manager.service
activating the configuration...
setting up /etc...
setting up tmpfiles
reloading the following units: dbus.service
restarting the following units: polkit.service
starting the following units: postgresql.service
Job for postgresql.service failed because the control process exited with error code.
See "systemctl status postgresql.service" and "journalctl -xe" for details.
warning: the following units failed: postgresql.service
● postgresql.service - PostgreSQL Server
Loaded: loaded (/nix/store/bh7vzvacc9y56w0kzs1mwgb1jy9bwvf6-unit-postgresql.service/postgresql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2018-08-04 17:39:33 UTC; 26ms ago
Process: 25399 ExecStartPost=/nix/store/hj8lfb9bbspn76nwm0qmx0xr4466gh0a-unit-script/bin/postgresql-post-start (code=exited, status=1/FAILURE)
Process: 25398 ExecStart=/nix/store/qhdnk3qsw00igzadqfxf7kpp3a48z368-unit-script/bin/postgresql-start (code=exited, status=1/FAILURE)
Process: 25395 ExecStartPre=/nix/store/qg6s6mph3jmrsgr67vh4bsydxrrbmvrr-unit-script/bin/postgresql-pre-start (code=exited, status=0/SUCCESS)
Main PID: 25398 (code=exited, status=1/FAILURE)
Aug 04 17:39:33 nixos systemd[1]: Starting PostgreSQL Server...
Aug 04 17:39:33 nixos systemd[1]: postgresql.service: Main process exited, code=exited, status=1/FAILURE
Aug 04 17:39:33 nixos systemd[1]: postgresql.service: Control process exited, code=exited status=1
Aug 04 17:39:33 nixos systemd[1]: Failed to start PostgreSQL Server.
Aug 04 17:39:33 nixos systemd[1]: postgresql.service: Unit entered failed state.
Aug 04 17:39:33 nixos systemd[1]: postgresql.service: Failed with result 'exit-code'.
warning: error(s) occurred while switching to the new configuration
I notice that the NixOS manual contains a PostgreSQL section, however the "Upgrading" subsection is not yet filled out. Any ideas on how I might resolve this error and upgrade my PostgreSQL?
I solved this issue by creating a dump of all server databases, whacking the old data_directory and uninstalling the old version, installing the new version, then restoring from the dump.
These steps are described in detail below.
Create a dump of all server databases.
$ pg_dumpall -U root > sql-dump
Identify the location of the current version's data_directory.
root=# SHOW data_directory;
data_directory
--------------------
/var/db/postgresql
(1 row)
Change the version of services.postgresql.package in /etc/nixos/configuration.nix.
services.postgresql.package = pkgs.postgresql100
This is apparently the expression for version 10.4, according to $ nix-env -qaP '*' --description.
Next whack the data_directory for the current version.
$ sudo rm -rf /var/db/postgresql/
And switch to the new version marked in configuration.nix
$ sudo nixos-rebuild switch
I had to create a root db.
$ sudo createdb root
(I also had to change some instances of postgres to root in my sql-dump file.)
Restore the data into the new version.
$ psql -U root -f sql-dump
Anyone know how one can contribute to the nixos manual?
I am happy to use what I've learned here to write up the updating postgres section.

unable to set replica set in mongodb3.2

I am trying to setup a demo replicaset from standalone MongoDB in MongoDB 3.2 with the following options in mongod.conf:
#replication:
oplogSizeMB: 10240
replSetName: "rs0"
But when I am trying to start mongodb it is throwing error:
Starting 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. [FAILED]
output of journalctl -xe says:
Jul 02 07:53:56 smartJN3-LTest-Blr1 systemd[1]: Starting SYSV: Mongo is a scalable, document-oriented database....
-- Subject: Unit mongod.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mongod.service has begun starting up.
Jul 02 07:53:56 smartJN3-LTest-Blr1 runuser[29989]: pam_unix(runuser:session): session opened for user mongod by (uid=0)
Jul 02 07:53:56 smartJN3-LTest-Blr1 runuser[29989]: pam_unix(runuser:session): session closed for user mongod
Jul 02 07:53:56 smartJN3-LTest-Blr1 mongod[29982]: Starting mongod: [FAILED]
Jul 02 07:53:56 smartJN3-LTest-Blr1 systemd[1]: mongod.service: control process exited, code=exited status=1
Jul 02 07:53:56 smartJN3-LTest-Blr1 systemd[1]: Failed to start SYSV: Mongo is a scalable, document-oriented database..
-- Subject: Unit mongod.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mongod.service has failed.
--
-- The result is failed.
Jul 02 07:53:56 smartJN3-LTest-Blr1 systemd[1]: Unit mongod.service entered failed state.
Jul 02 07:53:56 smartJN3-LTest-Blr1 systemd[1]: mongod.service failed.
Jul 02 07:53:56 smartJN3-LTest-Blr1 polkitd[2089]: Unregistered Authentication Agent for unix-process:29977:8668980 (system bus name :1.114, object path /org
This is on CentOS 7.2 . Thanks
Anyone any help. Thanks
fixed it myself. stupid me, I didn't uncomment the section header replication, which is why the settings were never picked.

Failed to start mongod.service opensuse 13.2 (Harlequin)

Anyone can help me with this error?
I've just finish install mongodb with this tutorial Official Install MongoDB for Suse
but, when i want to start mongod service
systemctl start mongod.service
The error
Failed to start mongod.service: Unit mongod.service failed to load: No such file or directory.
I've check that /var/log/mongodb/mongod.log still empty
if i check status the service
systemctl status mongod.service
error
mongod.service
Loaded: not-found (Reason: No such file or directory)
Active: failed (Result: exit-code) since Mon 2016-03-28 21:57:20 WIB; 3 weeks 4 days ago
Mar 28 21:57:20 proxy-witel-kalbar mongod[622958]: Starting mongod: ..failed
Mar 28 21:57:20 proxy-witel-kalbar systemd[1]: Failed to start LSB: Mongod.
Mar 28 21:57:20 proxy-witel-kalbar systemd[1]: Unit mongod.service entered failed state.
Thanks before.