Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR: child process failed, exited with error number 48

Tags:

mongodb

error 48 is a new error for me.

i'm also getting the error when trying to enter mongo

Error: network error while attempting to run command 'isMaster' on host '127.0.0.1:27017'

v3.2.10
git version: 79d9b3ab5ce20f51c272b4411202710a082d0317
allocator: tcmalloc
modules: none
build environment:
  distmod: ubuntu1604
  distarch: x86_64
  target_arch: x86_64

i try starting mongo with

sudo mongod --fork --port 27017 --replSet replset --logpath ~/log/mongo.log
like image 347
user1709076 Avatar asked Dec 13 '16 03:12

user1709076


5 Answers

just kill the mongod process first

ps -ef | grep mongod
sudo kill -9 {processid}

then run the command.

like image 187
Duaa Zahi Avatar answered Nov 07 '22 20:11

Duaa Zahi


You can try the following steps to restart the process:

  1. pidof mongod
  2. sudo kill -9 {pidOfRunningMongod}
  3. sudo mongod --fork --auth --port 27018 --dbpath /data/db --logpath /var/log/mongod.log

Worked for me

like image 30
Sunil Mhetre Avatar answered Nov 07 '22 19:11

Sunil Mhetre


What does the log file says? This error usually comes when there is a process already running with the port number you are using to start mongod process with, which is 27017 here.

You can run the below command to check the spid which is using the port

netstat -ntulp|grep 27017

like image 38
Rohit Avatar answered Nov 07 '22 19:11

Rohit


I took used to get similar error (error no. 48). I usually run like this:

mongod --config /apps/data/appdb/appdb.conf --fork

In my "appdb.conf" there is a parameter called "Bind Address" which was pointing to "0.0.0.0" and I simply changed it to actual IP of the server/machine (which can be found if you run hostname -i command). Saved the file and tried the above "fork" command and worked like a charm. Hope this helps.

like image 3
Shesh Kumar Bhombore Avatar answered Nov 07 '22 18:11

Shesh Kumar Bhombore


First of all, for the first answer, you should not kill a Mongodb process with -9.

See use kill section in following documentation: https://docs.mongodb.com/manual/tutorial/manage-mongodb-processes/

Maybe try to find and delete mongod.pid (/your/path/mongodb/mongod.pid) and restart Mongodb again.

like image 1
Huaxin Zhang Avatar answered Nov 07 '22 18:11

Huaxin Zhang