The three config servers are not starting - The first lab

I followed every step to start up my sharded cluster:
I created the conf files as required, an example:

clusterRole: configsvr
replSetName: m103-csrs
keyFile: /var/mongodb/pki/m103-keyfile
bindIp: localhost,
port: 26001
destination: file
path: /var/mongodb/db/csrs1/mongod.log
logAppend: true
fork: true
dbPath: /var/mongodb/db/csrs1

I did for each file:

cp /shared/csrs_1.conf csrs_1.conf

When I lunch mongod:

mongod -f csrs_1.conf

I got this message:

mongod -f csrs_1.conf
about to fork child process, waiting until server is ready for connections.
forked process: 2456
ERROR: child process failed, exited with error number 1
To see additional information in this output, start without the “–fork” option.

I tried to chown dbpath:

$ sudo chown vagrant:vagrant /var/mongodb/db/csrs1

I got:

chown: cannot access ‘/var/mongodb/db/csrs1’: No such file or directory

I don’t know what to do else?

Did you run without --fork as suggested
It will give error on your screen
Most likely missing directory is the issue

Did you create the dirs csrs1,csrs2,csrs3
When you tried chown it file/dir not exists
Actually no chown is needed
You would have already created dir /var/mongodb/db/ with necessary permissions in previous labs
You just need to create the new dirs


When you do this

cp /shared/csrs_1.conf csrs_1.conf

It copies the file to your current working directory, which isn’t going to be the /var/mongodb/db/csrs1 folder, unless you’ve previously cdd to that folder. To see what your current working directory is, use the pwd command.

And as Ramachandra suggests, have you created that csrs1 folder?

Yes, I run it without – fork didn’t work

mongod --config csrs_1.conf

I even deleted fork inside the file

However, it turned out the directory is missing and it is working now. Thank you.

1 Like