Mongo not running post db.shutdownServer()

Hi,

I have issued db.shutdownServer() from admin DB within from mongo shell on Windows localhost. Post this i have to run mongod for every terminal session whenever i am using the command prompt. Do i need to restart my machine for the deamon to run in background without me invoking it everytime on a separate terminal.

Also is there any process similar to --fork which can be used for Windows cmd.

Regards,
Chetan

Hey @Chetan_Prakash_59365

I believe you should be able to use the --fork option even if on Windows. Also did this course not come with a vagrant VM for you which runs linux?

Yes using vagrant for this chapter, however working on localhost as well to replicate everything on Windows whatever commands we are using on LinuxBox.

Also i dont see --fork in General options in help section for the deamon. see below.

General options:
-v [ --verbose ] [=arg(=v)] be more verbose (include multiple times
for more verbosity e.g. -vvvvv)
–quiet quieter output
–port arg specify port number - 27017 by default
–logpath arg log file to send write to instead of
stdout - has to be a file, not
directory
–logappend append to logpath instead of
over-writing
–logRotate arg set the log rotation behavior
(rename|reopen)
–timeStampFormat arg Desired format for timestamps in log
messages. One of ctime, iso8601-utc or
iso8601-local
–setParameter arg Set a configurable parameter
-h [ --help ] show this usage information
–version show version information
-f [ --config ] arg configuration file specifying
additional options
–bind_ip arg comma separated list of ip addresses to
listen on - localhost by default
–bind_ip_all bind to all ip addresses
–ipv6 enable IPv6 support (disabled by
default)
–listenBacklog arg (=2147483647) set socket listen backlog size
–maxConns arg max number of simultaneous connections
- 1000000 by default
–pidfilepath arg full path to pidfile (if not set, no
pidfile is created)
–timeZoneInfo arg full path to time zone info directory,
e.g. /usr/share/zoneinfo
–keyFile arg private key for cluster authentication
–noauth run without security
–transitionToAuth For rolling access control upgrade.
Attempt to authenticate over outgoing
connections and proceed regardless of
success. Accept incoming connections
with or without authentication.
–clusterAuthMode arg Authentication mode used for cluster
authentication. Alternatives are
(keyFile|sendKeyFile|sendX509|x509)
–slowms arg (=100) value of slow for profile and console
log
–slowOpSampleRate arg (=1) fraction of slow ops to include in the
profile and console log
–networkMessageCompressors [=arg(=disabled)] (=snappy)
Comma-separated list of compressors to
use for network messages
–auth run with security
–clusterIpSourceWhitelist arg Network CIDR specification of permitted
origin for __system access.
–profile arg 0=off 1=slow, 2=all
–cpu periodically show cpu and iowait
utilization
–sysinfo print some diagnostic system
information
–noIndexBuildRetry don’t retry any index builds that were
interrupted by shutdown
–noscripting disable scripting engine
–notablescan do not allow table scans

This course has you running up to 9 mongod processes just FYI.

And I was wrong --fork is not available in windows as I have read here.

In that case see the docs here to run it as a service in Windows.
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/#run-mdb-edition-as-a-windows-service

Found this post to

Thanks for the suggested links.
Now going back to my initial question am clarifying the doubt again in steps below.

  1. i have ran command “db.shutdownServer()” from one of my terminals.
  2. Log file in bin folder reflects the shutdown process.
  3. Now as per my understanding i need to run “mongod” again once to start my deamon process for all my corresponding mongo executables.
  4. However i need to run “mongod” for all new cmd sessions everytime and also my logfile is not getting appended post the first step i.e. post shutdown.

Any suggestions as to how mongod gets shutdown and starts as a deamon service again.

Yep

Not if run as a service

Docs

You will have to start the service again

Thanks again for the info for starting mongod as a service.

Now my only remaining questions is related to the log file in bin folder which is not getting updated by its own.

Tried running mongod using --logappend as well, still not working.
Just to add here logappend is set to True in the mongod.cfg with the same logfile path.

Are you sure it is going to the same --logpath

yes.

see below…

mongod.conf

for documentation of all options, see:

http://docs.mongodb.org/manual/reference/configuration-options/

Where and how to store data.

storage:
dbPath: C:\Program Files\MongoDB\Server\4.0\data
journal:
enabled: true

engine:

mmapv1:

wiredTiger:

where to write logging data.

systemLog:
destination: file
logAppend: true
path: C:\Program Files\MongoDB\Server\4.0\log\mongod.log

network interfaces

net:
port: 27017
bindIp: 127.0.0.1

#processManagement:

#security:

#operationProfiling:

#replication:

#sharding:

Enterprise-Only Options:

#auditLog:

#snmp:

Sorry I do not know then…

Hi @Chetan_Prakash_59365,

Can you please check if you have appropriate permissions on the folder that contains your log file and let me know if the issue isn’t resolved?

Thanks,
Muskan
Curriculum Support Engineer

Hi ,

I have the required permissions on the log file folder as it is on my local machine disk only.

This seems to be a strange issue and is being faced by some other folks as well.

Hi,

This issue can be termed as closed now as log file is now getting updated.

Hi @Chetan_Prakash_59365,

Can you please share how you were able to resolve the issue and the steps you followed for the same?

Thanks.
Muskan
Curriculum Support Engineer

1 Like

Had some admin rights issues within windows. Sorted those out and everything is running fine now.

1 Like