Wednesday 15 July 2020

mongod: error while loading shared libraries: libnetsnmpmibs.so.31: cannot open shared object file: No such file or directory


Error Details: 

[mongod@opsmanager bin]$ ./mongod -f /u01/app/mongo/data/mongod.conf
./mongod: error while loading shared libraries: libnetsnmpmibs.so.31: cannot open shared object file: No such file or directory

Solution install package net-snmp

mongod@opsmanager bin]$ yum install net-snmp
Loaded plugins: fastestmirror, langpacks
You need to be root to perform this command.
[mongod@opsmanager bin]$ sudo yum install net-snmp
[sudo] password for mongod:
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.mirror.lstn.net
 * extras: repos-tx.psychz.net
 * updates: repo1.ash.innoscale.net
base                                                                                                                                 | 3.6 kB  00:00:00
extras                                                                                                                               | 2.9 kB  00:00:00
updates                                                                                                                              | 2.9 kB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package net-snmp.x86_64 1:5.7.2-48.el7_8.1 will be installed
--> Processing Dependency: net-snmp-libs = 1:5.7.2-48.el7_8.1 for package: 1:net-snmp-5.7.2-48.el7_8.1.x86_64
--> Processing Dependency: net-snmp-agent-libs = 1:5.7.2-48.el7_8.1 for package: 1:net-snmp-5.7.2-48.el7_8.1.x86_64
--> Processing Dependency: libnetsnmptrapd.so.31()(64bit) for package: 1:net-snmp-5.7.2-48.el7_8.1.x86_64
--> Processing Dependency: libnetsnmpmibs.so.31()(64bit) for package: 1:net-snmp-5.7.2-48.el7_8.1.x86_64
--> Processing Dependency: libnetsnmpagent.so.31()(64bit) for package: 1:net-snmp-5.7.2-48.el7_8.1.x86_64
--> Running transaction check
---> Package net-snmp-agent-libs.x86_64 1:5.7.2-48.el7_8.1 will be installed
---> Package net-snmp-libs.x86_64 1:5.7.2-37.el7 will be updated
---> Package net-snmp-libs.x86_64 1:5.7.2-48.el7_8.1 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================
 Package                                    Arch                          Version                                      Repository                      Size
============================================================================================================================================================
Installing:
 net-snmp                                   x86_64                        1:5.7.2-48.el7_8.1                           updates                        332 k
Installing for dependencies:
 net-snmp-agent-libs                        x86_64                        1:5.7.2-48.el7_8.1                           updates                        707 k
Updating for dependencies:
 net-snmp-libs                              x86_64                        1:5.7.2-48.el7_8.1                           updates                        751 k

Transaction Summary
============================================================================================================================================================
Install  1 Package  (+1 Dependent package)
Upgrade             ( 1 Dependent package)

Total size: 1.7 M
Total download size: 1.0 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/updates/packages/net-snmp-5.7.2-48.el7_8.1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY --:--:-- ETA
Public key for net-snmp-5.7.2-48.el7_8.1.x86_64.rpm is not installed
(1/2): net-snmp-5.7.2-48.el7_8.1.x86_64.rpm                                                                                          | 332 kB  00:00:00
(2/2): net-snmp-agent-libs-5.7.2-48.el7_8.1.x86_64.rpm                                                                               | 707 kB  00:00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                       912 kB/s | 1.0 MB  00:00:01
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-6.1810.2.el7.centos.x86_64 (@anaconda)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : 1:net-snmp-libs-5.7.2-48.el7_8.1.x86_64                                                                                                  1/4
  Installing : 1:net-snmp-agent-libs-5.7.2-48.el7_8.1.x86_64                                                                                            2/4
  Installing : 1:net-snmp-5.7.2-48.el7_8.1.x86_64                                                                                                       3/4
  Cleanup    : 1:net-snmp-libs-5.7.2-37.el7.x86_64                                                                                                      4/4
  Verifying  : 1:net-snmp-agent-libs-5.7.2-48.el7_8.1.x86_64                                                                                            1/4
  Verifying  : 1:net-snmp-5.7.2-48.el7_8.1.x86_64                                                                                                       2/4
  Verifying  : 1:net-snmp-libs-5.7.2-48.el7_8.1.x86_64                                                                                                  3/4
  Verifying  : 1:net-snmp-libs-5.7.2-37.el7.x86_64                                                                                                      4/4

Installed:
  net-snmp.x86_64 1:5.7.2-48.el7_8.1

Dependency Installed:
  net-snmp-agent-libs.x86_64 1:5.7.2-48.el7_8.1

Dependency Updated:
  net-snmp-libs.x86_64 1:5.7.2-48.el7_8.1

Complete!

[mongod@opsmanager bin]$ ./mongod -f /u01/app/mongo/data/mongod.conf

about to fork child process, waiting until server is ready for connections.

forked process: 20740

child process started successfully, parent exiting

step-5 connect database


Friday 10 July 2020

WARNING: Unable to raise nofile/nproc limit to 64000. Ops Manager may not function correctly.


Warning:

WARNING: Unable to raise nofile limit to 64000. Ops Manager may not function correctly.
WARNING: Unable to raise nproc limit to 64000. Ops Manager may not function correctly.


Solution

Add below lines to file /etc/security/limits.d/20-nproc.conf  


mongo     soft    nproc   2047
mongo     hard    nproc   64000
mongo     soft    nofile  4096
mongo     hard    nofile  65536
mongo     soft    stack   10240

Note: here mongo is my os user from which i am installing ops manager.

[mongo@opsmanager bin]$ cat  /etc/security/limits.d/20-nproc.conf
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.

*          soft    nproc     64000
root       soft    nproc     unlimited
mongo     soft    nproc   2047
mongo     hard    nproc   64000
mongo     soft    nofile  4096
mongo     hard    nofile  65536
mongo     soft    stack   10240

Thursday 9 July 2020

Start mongo database(mongod) automatically after system reboot

After OS patching process we need a database administrator support to stop and start database.To avoid such small dependency we can write small shell script which will take care of database startup process after system Reboot. In below example we are creating a shell script and seting it in crontab, so database will be start automatically after system reboot.  

1] creating a test.js file for specify database commands to test connectivity.

[mongo@localhost ~]$ cat test.js
print("Successfully connect to Test database ");
db.getName();

2] creating main shell script db_startup.sh

[mongo@localhost ~]$ cat db_startup.sh
#!/bin/bash

export PATH=/u01/mongo/mongodb-linux-x86_64-rhel70-4.2.8/bin:$PATH

export MONGO_HOME=/u01/mongo/mongodb-linux-x86_64-rhel70-4.2.8

export LOG_FILE="/home/mongo/STARTUP_LOG.txt"
export MAIL_FROM=abc@axmple.com
export MAIL_TO=pqr@example.com
cd /u01/mongo/mongodb-linux-x86_64-rhel70-4.2.8/bin

echo "===========Starting Database========" > $LOG_FILE
echo " " >> $LOG_FILE
echo " " >> $LOG_FILE

mongod -f /u01/DATA/appdb/mongod.conf >> $LOG_FILE

echo  " "  >> $LOG_FILE
echo  " "  >> $LOG_FILE
echo "-------checking database status ------" >> $LOG_FILE

echo  " " >> $LOG_FILE
echo  " " >> $LOG_FILE

if [ `ps -ef | grep -i mongod.conf | wc -l` -le 1 ]; then
    echo "mongodb not running" >> $LOG_FILE
    exit 1
else
    echo "database started successfully" >> $LOG_FILE
fi

echo "=======checking connectivity of database======" >> $LOG_FILE
echo " ">> $LOG_FILE
echo " ">> $LOG_FILE
./mongo -u admin -p Admin1234 < /home/mongo/test.js  >> $LOG_FILE

cat $LOG_FILE | mailx -r $MAIL_FROM -s "mongodb status After server reboot" -a $LOG_FILE $MAIL_TO

exit

3] specify the entry in crontab for above shell script. 

[mongo@localhost ~]$ crontab -e
crontab: installing new crontab

[mongo@localhost ~]$ crontab -l
@reboot sleep 60 && /home/mongo/db_startup.sh > /home/mongo/db_startup.log
[mongo@localhost ~]$

4] reboot the system for test the script.

5] Output of log file:

[mongo@localhost ~]$ cat STARTUP_LOG.txt

===========Starting Database========


about to fork child process, waiting until server is ready for connections.
forked process: 10178
child process started successfully, parent exiting


-------checking database status ------


database started successfully
=======checking connectivity of database======


MongoDB shell version v4.2.8
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("bbd16589-fc43-48ca-a16b-1b65cd77c9f0") }
MongoDB server version: 4.2.8
Successfully connect to Test database
test
bye

work on autovacuum postgreSQL parameter

 In This blog, we are discussing the auto vacuum parameter on a small scale. we will understand the below parameters and will see how to mod...