Error in Lab: Deploy a Replica Set

While starting a instance i am getting this error

user@M103# mongod --config mongod_1.conf 
about to fork child process, waiting until server is ready for connections.
forked process: 359
ERROR: child process failed, exited with error number 48
To see additional information in this output, start without the "--fork" option.

user@M103# mongod -f mongod_2.conf 
about to fork child process, waiting until server is ready for connections.
forked process: 364
ERROR: child process failed, exited with error number 48
To see additional information in this output, start without the "--fork" option.

user@M103# mongod -f mongod_3.conf 
about to fork child process, waiting until server is ready for connections.
forked process: 366
ERROR: child process failed, exited with error number 48
To see additional information in this output, start without the "--fork" option.

and when i start instance without

processManagement:
  fork: true

the command : mongod -f mongod_1.conf runs without giving any error, but then when i try to connect to it first instance i get another error

user@M103# mongo --port 27001
MongoDB shell version v4.0.5
connecting to: mongodb://127.0.0.1:27001/?gssapiServiceName=mongodb
2021-08-14T19:12:09.829+0000 E QUERY    [js] Error: couldn't connect to server 127.0.0.1:27001, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27001 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:328:13
@(connect):1:6
exception: connect failed

i have been trying this or 2 days now, cannot unable to solve this issue.

Also for this lab, when you run tests, it stays

[FAIL] "localhost:27001 is running"

and same for localhost:27002 and localhost:27003. Whereas this is not mentioned in the lab instructions, and the in video lecture and its notes, port 27011, 27012, 27013 are used.

Also in the lecture notes of Setting Up a Replica Set :

# why is ownership changed to user vagrant
sudo chown vagrant:vagrant /var/mongodb/pki/

This command isn’t used in the video lecture

vagrant is the owner of mongod in older version of course which uses vagrant setup
For IDE you don’t need this step.May be lecture notes not updated to match with IDE

For mongod errors you got error 48 means socket or address in use
Make sure no other mongods running on the ports you are using
You can check mongod.log when you ran it with --fork.It would have given more details on why it is failing

thanks for the response, today when i tried again with fork, got this error

about to fork child process, waiting until server is ready for connections.
forked process: 349
ERROR: child process failed, exited with error number 48
To see additional information in this output, start without the "--fork" option.

my config file

storage:
  dbPath: /var/mongodb/db/node1
net:
  bindIp: 192.168.103.100,localhost
  port: 27001
security:
  authorization: enabled
  keyFile: /var/mongodb/pki/m103-keyfile
systemLog:
  destination: file
  path: /var/mongodb/db/node1/mongod.log
  logAppend: true
processManagement:
  fork: true
replication:
  replSetName: m103-example

running this commands to generate key and folders

mkdir -p /var/mongodb/pki/
openssl rand -base64 741 > /var/mongodb/pki/m103-keyfile
chmod 600 /var/mongodb/pki/m103-keyfile
mkdir -p /var/mongodb/db/{node1,node2,node3}

This configuration file looks like a file copied from an old version (based on Vagrant) of the course.

In the current M103 course, you should be using the IDE and modify the configuration files based of the requirements. You should also only performs the steps requested. There is no need to create key files in the new version of M103 as they are supplied in the IDE.

2 Likes

In IDE, just update your configuration files first. Next, start mongod processes directly. If you still getting the same error reset your IDE and starts from scratch.
Hope this’ll help.