Csrs_1 problem won't start

“vagrant@m103:~$”
mongod -f “/shared/csrs_1.txt”
[also tried without quotations around path - same]

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

when I run without --fork it gives an immediate abort/dump message

the dir csrs1 is in var/mongodb/db
and I did:
sudo chown vagrant:vagrant /var/mongodb/db/csrs1
[note I have to drill down to the db to run
sudo chown vagrant:vagrant csrs1 - it does not work with a path string]

if the config file itself I have wrapped all the strings with quotations:

sharding:
clusterRole: “configsvr”
replication:
replSetName: “m103-csrs”
security:
keyFile: “/var/mongodb/pki/m103-keyfile”
net:
bindIp: “localhost,192.168.103.100”
port: 26001
systemLog:
destination: “file”
path: “/var/mongodb/db/csrs1.log”
logAppend: true
processManagement:
fork: true
storage:
dbPath: “/var/mongodb/db/csrs1”

What do you do when you want to see the proper immediate error message on the screen?
Or what do you do when you want to see all logs?

I don’t know. In answer to both questions. Not thru lack of effort - have reviewed all notes and a couple of videos.

I do know now that my new dir ownership needed to be root, so undid that from vagrant…

sanity check, and I am not able either to bring up:
mongod --config /shared/mongod-repl-4.txt
which I whipped up just comparing my past 3 that are now up and so I have obviously a cockpit error…going to have to return for awhile to my real job though…

mongo

Suggest (again) that you review the Config File documentation, don’t rely on the videos. They’re just there to introduce you to the topic. Everything else is in the documentation.

In the documentation, look at systemLog.destination and systemLog.path to understand exactly what they do. Specifically, what is the default behaviour when these options are not set? This is the key to showing the current error message to the screen/console.

When an error occurs, where does it get saved? You already have it set it in your config file. What is the systemLog section in the config file? I’m not expecting answers to these questions. This is just to get you thinking along the right path.

What I’m hinting at are two ways of performing an initial diagnosis.

back at it - - before seeing your post I did a sanity test
first: back to basics launching mongod with a single command line without a config file - all ok

next: config file completely stripped down. This works:
net:
port: 30005

    • so I know the command/path to find the config file is ok

This config file does not work:
net:
port: 30005
storage:
dbPath: “/CFIGtest”

I had made sudo dir CFIGtest
with root owner next to the var dir
and also trial/changed to vagrant owner
…so I am path challenged…

indeed a line from the abort:
2019-12-12T02:43:38.102+0000 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory /CFIGtest not found., terminating

on your hints: the logs approach has had me baffled in that since mongod doesn’t launch I am not understanding whose logs and where - but it seems like you’re saying even if the daemon doesn’t launch there are left over logs about that in the systemLog - so that’s an avenue I didn’t know about…

but I am perplexed on my dbPath issue at the moment given that it is identical (in the csrs1 config file) to that of the replica set config file which worked several days past… so I had initially thought it was an ownership issue but have gone back and forth on this and no joy…not sure what has changed to make the dbPath incorrect

We might have already had this discussion before, CFIGtest and /CFIGtest are two different locations in Linux. The former is relative to your current location whilst the latter is based on the root dir.

The MongoDB log file contains startup error messages too. If it fails to startup, it gets logged somewhere.

there’s something I’m not getting

works:
dbPath: “/data/db”

that was an original class lesson path
so when in dir data: I made db2

not works:
dbPath: “/data/db2”

I see both db and db2 when I am in ‘data’ and
and both -ld return vagrant:vagrant

What is the error message? If both sub directories exist, you will not receive a NonExistentPath error.

exception in initAndListen: NonExistentPath: Data directory /data/db2 not found., terminating

not getting how both show in dir and both are -ld vagrant:vagrant but are different…

Let’s see a screenshot

Capture1

MongoDB starting : pid=19482 port=30005 dbpath=/data/db 64-bit host=m103
options: { config: “/shared/CFIGtest.txt”, net: { port: 30005 }, storage: { dbPath: “/data/db” } }

MongoDB starting : pid=19517 port=30005 dbpath=/data/db2 64-bit host=m103
options: { config: “/shared/CFIGtest.txt”, net: { port: 30005 }, storage: { dbPath: “/data/db2” } }
exception in initAndListen: NonExistentPath: Data directory /data/db2 not found., terminating

Reiterating what I mentioned earlier. Look at what you’re doing in the screenshot you sent.

dir CFIGtest and /CFIGtest are no longer part of this. they were deleted after your prior post. also it was confusing having the config file name and the dir name the same.

/data/db is from a lesson and works with the config file

I created db2 dir in the data dir - - as the screen shot shows

db2 does not work with a config file

a single config file is being used each time, and I simply add/remove the character ‘2’ in the dbPath file string

the identical config command is being reused each time

I see no difference, meaning I don’t grasp any relative root/virtual reference difference between db and db2

Suggest reading up on Directory Structure in Linux and Relative vs Absolute Paths. This isn’t a MongoDB question, it’s a basic Linux paths question.

I’ll hint differently then: data/db2 is not the same location as /data/db2
Hopefully you can see it now.

Hi @James_58604,

I would like to add couple of things here.

Quotation marks are not necessary in the configuration file. It’s okay if you don’t have it.

As you can see the directories are not available. Please use this command to create the directory.

sudo mkdir -p /data/db2

[Edit : 18th December, 2019 ] - In this case, create the directories without sudo command.

Notice that there is a difference between /data/db2 and data/db2. The first one is located in your root directory. As I can see in the screenshot, you have created the second one in the Vagrant@m103:~ prompt, so it will have this path - /home/vagrant/data/db2 because your current working directory is /home/vagrant.

You can check the current working directory by running this command.

pwd

This is what @007_jb was trying to mention.

Now, coming back to your original question post #1 - You are not able to start your mongod instance using the csrs_1.txt file.

As you can see, you are using a lot of directories in you configuration file so please make sure you have created them correctly and you have set the permissions on them.

If you are not able to resolve the issue then please share the content of your log file by running this command.

cat /var/mongodb/db/csrs1.log 

Hope it helps!

Thanks,
Shubham Ranjan
Curriculum Support Engineer

in my sanity check mode I would like my basic config file to work at both /data/db and /data/db2…
(the csrs config file is more complex and deeper down in dir - so trying to keep it simple for the moment)

first I cd from vagrant prompt to dir data

  • it shows db and db2-
    rmdir db2
    and dir shows only db remaining

returned back up to the “vagrant@m103:~$” prompt
sudo mkdir -p /data/db2 (Shubham’s instruction)

it immediately returned the vagrant prompt

then ‘cd data’ next ‘dir’
the data dir shows only the pre-existing ‘db’ and no ‘db2’

if I do mkdir db2 (with or without sudo) while in the data dir - then it will be created (that’s what I did before)

so maybe if we resolve this step alone it will help me get this linux pathing clear…

I’m once more stating that data and /data are not the same locations.
cd data and cd /data will take you to different locations. They are not the same.

The point we keep making is that the inclusion of a forward slash (/) at the beginning of a path makes a big difference. If the lab requirement is /data/db, you write /data/db and not data/db.

Not sure how much clearer we can be on this subject.

I’m again seriously suggesting that you read about the Directory Structure in Linux. It’s a few minutes read.

1 Like

you’ve helped me alot - and I do get the point of /
there’s a construct though that is unclear - which I’ll explain this way:
in data dir there are db and db2 - both with owner vagrant

config file “/data/db” works
config file “/data/db2” does not work
config file “data/db2” works

so on the left side I see 2 dirs identical
and want on the right side the 2 config files identical to work

so making the config file work without the / kind of leaves me still unable to explain why the config files that work are not identical - - if the appearance of the 2 dirs appear identical…

“Does not work” means the error message states directory not found or something? Screenshot…

1 Like

*NonExistentPath: Data directory /data/db2 not found., terminating

this has been consistently the error message