Installation failing

Hi Team,

I can successfully install using yum,but when i am changing the path of dbpath to new location.It is failing with below.

Mongo version 3.4
Amazon linux 2

[root@# service mongod start
Starting mongod (via systemctl): Job for mongod.service failed because the control process exited with error code. See “systemctl status mongod.service” and “journalctl -xe” for details.
[FAILED]
[root@ip-172-10-0-11 bin]# service mongod status
● mongod.service - SYSV: Mongo is a scalable, document-oriented database.
Loaded: loaded (/etc/rc.d/init.d/mongod; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2020-01-17 23:20:31 UTC; 3s ago
Docs: man:systemd-sysv-generator(8)
Process: 3900 ExecStop=/etc/rc.d/init.d/mongod stop (code=exited, status=0/SUCCESS)
Process: 4172 ExecStart=/etc/rc.d/init.d/mongod start (code=exited, status=1/FAILURE)

Jan 17 23:20:31 ip-172-10-0-11.ec2.internal systemd[1]: Starting SYSV: Mongo is a scalable, document-oriented database…
Jan 17 23:20:31 ip-172-10-0-11.ec2.internal mongod[4172]: Error starting mongod. /var/run/mongodb/mongod.pid exists.
Jan 17 23:20:31 ip-172-10-0-11.ec2.internal systemd[1]: mongod.service: control process exited, code=exited status=1
Jan 17 23:20:31 ip-172-10-0-11.ec2.internal systemd[1]: Failed to start SYSV: Mongo is a scalable, document-oriented database…
Jan 17 23:20:31 ip-172-10-0-11.ec2.internal systemd[1]: Unit mongod.service entered failed state.
Jan 17 23:20:31 ip-172-10-0-11.ec2.internal systemd[1]: mongod.service failed.

Please use the latest or >=3.6 version of MongoDB.

Kanika

Thank you for your email.
I am trying to perform upgrade from 3.4 to 3.6 on my local machine before i perform on production

We have our current production running on 3.4 (3 node).We are planning to upgrade to 3.6 as 3.4 will be end of support.

I am doing yum install

Yum install mongo-org

But when i am starting the service i am getting the following error.

Whereas i can successfully start mongod --fork

Hi @Santosh_87156,

Please share the following details:

  • The OS you are using
  • The output when you run mongod --version

Kanika

Hi ,

Please find details below.

[root@ bin]# ./mongod --fork --logpath /var/log/mongodb.log
about to fork child process, waiting until server is ready for connections.
forked process: 3493
child process started successfully, parent exiting

[root@ bin]# cat /etc/mongod.conf

mongod.conf

for documentation of all options, see:

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

where to write logging data.

systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log

Where and how to store data.

storage:
dbPath: “/data/db”
journal:
enabled: true

engine:

mmapv1:

wiredTiger:

how the process runs

processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile

network interfaces

net:
port: 27017
bindIp: 127.0.0.1 # Listen to local interface only, comment to listen on all interfaces.

[root@ bin]# service mongodb status
Redirecting to /bin/systemctl status mongodb.service
Unit mongodb.service could not be found.

[root@ bin]# service mongodb start
Redirecting to /bin/systemctl start mongodb.service
Failed to start mongodb.service: Unit not found.

[root@ bin]# rpm -qa | grep mongodb-org
mongodb-org-mongos-3.4.23-1.amzn1.x86_64
mongodb-org-shell-3.4.23-1.amzn1.x86_64
mongodb-org-tools-3.4.23-1.amzn1.x86_64
mongodb-org-server-3.4.23-1.amzn1.x86_64
mongodb-org-3.4.23-1.amzn1.x86_64

[root@ bin]# ps -ef |grep mongo
root 3493 1 0 18:25 ? 00:00:00 ./mongod --fork --logpath /var/log/mongodb.log
root 3561 3467 0 18:27 pts/0 00:00:00 grep --color=auto mongo

[root@ bin]# mongo
MongoDB shell version v3.4.23
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.23
Server has startup warnings:
2020-01-21T18:25:30.319+0000 I CONTROL [initandlisten]
2020-01-21T18:25:30.319+0000 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2020-01-21T18:25:30.319+0000 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2020-01-21T18:25:30.319+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2020-01-21T18:25:30.319+0000 I CONTROL [initandlisten]

show dbs;
admin 0.000GB
local 0.000GB
test 0.000GB
xyz 0.000GB

[root@ bin]# uname -a
Linux .ec2.internal 4.14.154-128.181.amzn2.x86_64 #1 SMP Sat Nov 16 21:49:00 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
[root@ bin]# uname -r
4.14.154-128.181.amzn2.x86_64

Installation i have followed:-
[root@ bin]# cat /etc/yum.repos.d/mongodb-enterprise-3.4.repo
[mongodb]
name=mongodb RPM Repository
baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.4/x86_64/
enabled=1
gpgcheck=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
sslverify=true

yum install mongo-org

Hi ,

Troubleshooting further i end up with below

[root@ bin]# systemctl enable mongod
mongod.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig mongod on

[root@ bin]# service mongod status
● mongod.service - SYSV: Mongo is a scalable, document-oriented database.
Loaded: loaded (/etc/rc.d/init.d/mongod; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2020-01-21 18:53:45 UTC; 2min 31s ago
Docs: man:systemd-sysv-generator(8)

Jan 21 18:53:45 .ec2.internal systemd[1]: Starting SYSV: Mongo is a scalable, document-oriented database…
Jan 21 18:53:45 .ec2.internal mongod[4099]: Error starting mongod. /var/run/mongodb/mongod.pid exists.
Jan 21 18:53:45 .ec2.internal systemd[1]: mongod.service: control process exited, code=exited status=1
Jan 21 18:53:45 .ec2.internal systemd[1]: Failed to start SYSV: Mongo is a scalable, document-oriented database…
Jan 21 18:53:45 .ec2.internal systemd[1]: Unit mongod.service entered failed state.
Jan 21 18:53:45 .ec2.internal systemd[1]: mongod.service failed.

[root@ bin]# service mongodb status
Redirecting to /bin/systemctl status mongodb.service
Unit mongodb.service could not be found.

[root@ bin]# service mongodb start
Redirecting to /bin/systemctl start mongodb.service
Failed to start mongodb.service: Unit not found.

[root@ bin]# systemctl enable mongod
mongod.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig mongod on

[root@ bin]# service mongod restart
Restarting mongod (via systemctl): Job for mongod.service failed because the control process exited with error code. See “systemctl status mongod.service” and “journalctl -xe” for details.
[FAILED]

[root@ bin]# service mongod status
● mongod.service - SYSV: Mongo is a scalable, document-oriented database.
Loaded: loaded (/etc/rc.d/init.d/mongod; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2020-01-21 18:53:45 UTC; 21s ago
Docs: man:systemd-sysv-generator(8)
Process: 4099 ExecStart=/etc/rc.d/init.d/mongod start (code=exited, status=1/FAILURE)

Jan 21 18:53:45 .ec2.internal systemd[1]: Starting SYSV: Mongo is a scalable, document-oriented database…
Jan 21 18:53:45 .ec2.internal mongod[4099]: Error starting mongod. /var/run/mongodb/mongod.pid exists.
Jan 21 18:53:45 .ec2.internal systemd[1]: mongod.service: control process exited, code=exited status=1
Jan 21 18:53:45 .ec2.internal systemd[1]: Failed to start SYSV: Mongo is a scalable, document-oriented database…
Jan 21 18:53:45 .ec2.internal systemd[1]: Unit mongod.service entered failed sta

I start using db service using mongod

[root@ bin]# ./mongod --fork --logpath /var/log/mongodb.log
about to fork child process, waiting until server is ready for connections.
forked process: 3722
child process started successfully, parent exiting
[root@ bin]# tail -f /var/log/mongodb.log
2020-01-21T18:42:35.791+0000 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2020-01-21T18:42:35.791+0000 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2020-01-21T18:42:35.791+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2020-01-21T18:42:35.791+0000 I CONTROL [initandlisten]
2020-01-21T18:42:35.800+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory ‘/data/db/diagnostic.data’
2020-01-21T18:42:35.814+0000 I INDEX [initandlisten] build index on: admin.system.version properties: { v: 2, key: { version: 1 }, name: “incompatible_with_version_32”, ns: “admin.system.version” }
2020-01-21T18:42:35.814+0000 I INDEX [initandlisten] building index using bulk method; build may temporarily use up to 500 megabytes of RAM
2020-01-21T18:42:35.815+0000 I INDEX [initandlisten] build index done. scanned 0 total records. 0 secs
2020-01-21T18:42:35.816+0000 I COMMAND [initandlisten] setting featureCompatibilityVersion to 3.4
2020-01-21T18:42:35.817+0000 I NETWORK [thread1] waiting for connections on port 27017
^C
[root@ bin]# ps -ef |grep mongod
root 3722 1 0 18:42 ? 00:00:00 ./mongod --fork --logpath /var/log/mongodb.log
root 3744 3545 0 18:42 pts/0 00:00:00 grep --color=auto mongod

[root@ bin]# service mongodb status
Redirecting to /bin/systemctl status mongodb.service
Unit mongodb.service could not be found.
[root@ bin]# systemctl enable mongod
mongod.service is not a native service, redirecting to /sbin/chkconfig.

For this course, you are supposed to be using the Virtual Machine that’s created using VirtualBox and vagrant. See the installation instructions again in the first chapter.

2 Likes

Hi @Santosh_87156,

This is not really the right place for taking any production related advise as this forum is dedicated to supporting the users taking the M103 course.

That being said here are couple of the links that you may find helpful while upgrading to 3.6 version.

For standalone node - Link

For a replica set - Link

For sharded environment - Link

Hope it helps!

Thanks,
Shubham Ranjan
Curriculum Services Engineer