mongoDB: child process failed, exited with 1 & 14 - mongodb

I have already tried it with the following thread but it didn't help me:
ERROR: child process failed, exited with error number 1,mongodb
Tried that:
sudo mongod --fork --config /etc/mongod.conf --logpath /var/log/mongodb/mongod.log
Result:
forked process: 2887
ERROR: child process failed, exited with 48
To see additional information in this output, start without the "--fork" option.
Tried the following as well:
sudo systemctl start mongod
One of the lines in the error message say:
ERROR: child process failed, exited with 14
Would appreciate any help. mongod was working pretty well until I have started trying to implement a replica set.

Use this command on the terminal:
sudo mongod --dbpath /System/Volumes/Data/data/db
It should start the MongoDB server and allocate a port for it. You can exit out of the server and then try the command again and it should work.

Related

Unable to start mongodb without access control

I am using EC2(for Ubuntu 16.04) and i have installed mongodb 3.6
but when i start it using following command
mongod --port 27017 --dbpath /data/db
It is giving following error
An unsupported journal format detected - If you are trying to rollback from version 4.0 to 3.6, please re-start a 4.0 binary and cleanly shut it down so that the journal format will be downgraded.
Assertion: 28595:13: Permission denied src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 488
exception in initAndListen: Location28595: 13: Permission denied, terminating
Invariant failure globalStorageEngine src/mongo/db/service_context_d.cpp 272
please suggest
Try:
sudo service mongod restart
sudo service mongod status
sudo service mongod stop
sudo service mongod status
and then maybe your commands to follow

ERROR: child process failed, exited with error number 4

I was trying to run this command
#mongod --fork --logpath /var/log/mongod.log
but I got this message
about to fork child process, waiting until server is ready for connections.
forked process: 10750
all output going to: /var/log/mongod.log
log file [/var/log/mongod.log] exists; copied to temporary file
[/var/log/mongod.log.2017-05-23T14-57-31]
ERROR: child process failed, exited with error number 4
Could you please help me resolve the problem?
Per the MongoDB docs:
4
The version of the database is different from the version supported by the mongod (or mongod.exe) instance. The instance exits cleanly.

Can't start mongoDB as a service

I'd like to run mongoDB as a service. The instance shall be configured as a single-node replicaset to be able to connect a elasticSearch instance to it with a the connector.
So I extended the mongod.conf:
...
replication:
replSetName: "singleNodeRepl"
...
I tried different ways to start now the mongod, but nothing works.
When I try to start the service by $ service mongod start, following error is thrown:
start: Rejected send message, 1 matched rules; type="method_call", sender=":1.106" (uid=1225 pid=26018 comm="start mongod ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")
When I execute this command as sudo (whats not best-practise, right?), its "running" and following message is shown:
mongod start/running, process 26034
But process 26034 doesn't exist and ps aux | grep mongo also shows nothing?!
Next try: Run it as a normal application
mongod --dbpath /var/lib/mongodb/ --replSet SingleNodeRepl
Here following exception is shown:
2016-04-08T14:31:35.192+0200 I STORAGE [initandlisten] exception in initAndListen: 98 Unable to create/open lock file: /var/lib/mongodb/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
2016-04-08T14:31:35.192+0200 I CONTROL [initandlisten] dbexit: rc: 100
Everything is fine when I run ~$ sudo mongod --dbpath /var/lib/mongodb/ --replSet SingleNodeRepl, but thats not my target: Its not running as a service and its running as root.
The mongod-logfile often keeps untouched. But the last lines are curious:
2016-04-08T14:24:56.242+0200 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock errno:1 Operation not permitted
2016-04-08T14:24:56.242+0200 I - [initandlisten] Fatal Assertion 28578
2016-04-08T14:24:56.242+0200 I - [initandlisten]
***aborting after fassert() failure
A mongodb-27017.sock existed, but deleting (what was suggested anywhere) didn't help.
Based on the erros above if tried serveral solutions, but nothing helps.
I think it's a very simple mistake...but which one?
[edit:]
I discovered, that I perhaps should have specified the config-location. So the (working but bad) command looks like:
$ sudo mongod --dbpath /var/lib/mongodb/ --replSet SingleNodeRepl --config /etc/mongod.conf
This brings following error:
warning: bind_ip of 0.0.0.0 is unnecessary; listens on all ips by default
Thats an old thing, which was the solution for this problem and suddenly doesn't work anymore!?
I've had issues stopping and starting mongod as a service. Turns out there was an issue with the upsart script.
I found this discussion which seemed to fix it.
The suggested solution was pretty much: (copy pasting now)
vim /etc/init.d/mongod
look for stop() function (and start() function for good measure) and remove quotes around $PIDFILE in the following line.
killproc -p $PIDFILE -d 300 /usr/bin/mongod
Do this:
sudo rm /var/lib/mongodb/mongod.lock
mongod --repair
sudo service mongodb start
Let me know if this doesn't work!

Cannot restart mongodb

I am trying to restart my mongodb but it has an error
this is the error:
[root#testdb vagrant]# sudo service mongod restart
Stopping mongod: [FAILED]
Starting mongod: warning: bind_ip of 0.0.0.0 is unnecessary; listens on all ips by default
about to fork child process, waiting until server is ready for connections.
forked process: 6843
ERROR: child process failed, exited with error number 100
[FAILED]
my config file is:
bind_ip = 0.0.0.0
dbpath = /var/lib/mongodb
fork = true
logappend = true
logpath = /var/log/mongodb/mongodb.log
nojournal = false
pidfilepath = /var/run/mongodb/mongodb.pid
port = 27017
rest = false
smallfiles = false
this is my log
this is the output of ps ax | grep mongod
1935 ? Sl 1:53 /usr/bin/mongod --config /etc/mongodb.conf
5592 pts/0 S+ 0:00 tail -f /var/log/mongodb/mongodb.log
5889 pts/1 S+ 0:00 grep mongod
i also removed /var/lib/mongodb/mongod.lock
when i restart this is the output stop failed.
Stopping mongod: [FAILED]
Starting mongod: warning: bind_ip of 0.0.0.0 is unnecessary; listens on all ips by default
about to fork child process, waiting until server is ready for connections.
forked process: 5874
child process started successfully, parent exiting
[ OK ]
Most likely either a permissions issue or a incorrect shutdown.
Run commands sudo rm /var/lib/mongodb/mongod.lock to remove the lock on mongod process then chown the directory to the mongod user using
chown-R mongod: mongod /var/lib/mongo
then start service sudo service mongod start
Before I try and give my input, here is the MongoDB documentation for processes:
http://docs.mongodb.org/manual/tutorial/manage-mongodb-processes/#StartingandStoppingMongo-SendingshutdownServer%28%29messagefromthemongoshell
That being said, trying shutting down the server:
use admin
db.shutdownServer()
and starting it again.
If you're using linux:
mongod --shutdown
I hope this helped a little, or atleast you can try and use the documentation.

Created mongod replication Set but fail to connect

I have created mongoDB replication set using this command:
F:\data>mongod --replSet set1 --dbpath 1 --port 27101
--oplogSize 50 --logpath log.1 --logappend --fork
It does not recognize --fork and it is not there in --help as well (I guess) so I have excluded it and got following output. I think there is nothing wrong so far.
all output going to: log.1
Then when I try to use mongo console using this command
F:\data>mongo --port 27101
It returns
MongoDB shell version: 2.2.2
connecting to: 127.0.0.1:27101/test
Thu Feb 14 01:36:33 Error: couldn't connect to server 127.0.0.1:27101 src/mongo/
shell/mongo.js:93
exception: connect failed
Now what can be done to make it work?
Actually I in the parameter I had this data path --dbpath 1 so I need to have a directory named '1' in my current directory but I had created it in data directory by misunderstanding.
Thankyou #Alptigin Jalayr and others who has lead me to the correct direction.