Thursday, 25 July 2019

how to install Mongo DB on linux..

->how to install Mongo DB on linux?

OS details:

[root@localhost ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
[root@localhost ~]#

mongo db version Details.

mongodb-org-3.0

installation steps

1) check network connections

[root@MongoDB ~]# ping mongodb.com
PING mongodb.com (52.21.89.200) 56(84) bytes of data.
64 bytes from ec2-52-21-89-200.compute-1.amazonaws.com (52.21.89.200): icmp_seq=1 ttl=45 time=224 ms
64 bytes from ec2-52-21-89-200.compute-1.amazonaws.com (52.21.89.200): icmp_seq=2 ttl=45 time=227 ms

--- mongodb.com ping statistics ---
3 packets transmitted, 2 received, 33% packet loss, time 2001ms
rtt min/avg/max/mdev = 224.843/226.084/227.325/1.241 ms

2) create and add below paramters in vi /etc/yum.repos.d/mongodb-org-3.0.repo file 

[root@MongoDB ~]# cat /etc/yum.repos.d/mongodb-org-3.0.repo
[mongodb-org-3.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/x86_64/
gpgcheck=0
enabled=1

3) Run yum command to install mongoDB RPM

[root@MongoDB ~]# yum install -y mongodb-org
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mongodb-org.x86_64 0:3.0.12-1.el5 set to be updated
--> Processing Dependency: mongodb-org-tools = 3.0.12 for package: mongodb-org
--> Processing Dependency: mongodb-org-shell = 3.0.12 for package: mongodb-org
--> Processing Dependency: mongodb-org-server = 3.0.12 for package: mongodb-org
--> Processing Dependency: mongodb-org-mongos = 3.0.12 for package: mongodb-org
--> Running transaction check
---> Package mongodb-org-mongos.x86_64 0:3.0.12-1.el5 set to be updated
---> Package mongodb-org-server.x86_64 0:3.0.12-1.el5 set to be updated
---> Package mongodb-org-shell.x86_64 0:3.0.12-1.el5 set to be updated
---> Package mongodb-org-tools.x86_64 0:3.0.12-1.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================
 Package                                Arch                       Version                           Repository                           Size
===============================================================================================================================================
Installing:
 mongodb-org                            x86_64                     3.0.12-1.el5                      mongodb-org-3.0                     5.7 k
Installing for dependencies:
 mongodb-org-mongos                     x86_64                     3.0.12-1.el5                      mongodb-org-3.0                     4.7 M
 mongodb-org-server                     x86_64                     3.0.12-1.el5                      mongodb-org-3.0                     9.8 M
 mongodb-org-shell                      x86_64                     3.0.12-1.el5                      mongodb-org-3.0                     5.0 M
 mongodb-org-tools                      x86_64                     3.0.12-1.el5                      mongodb-org-3.0                      28 M

Transaction Summary
===============================================================================================================================================
Install      5 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total size: 48 M
Total download size: 28 M
Downloading Packages:
mongodb-org-tools-3.0.12-1.el5.x86_64.rpm                                                                               |  28 MB     03:29
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : mongodb-org-server                                                                                                      1/5
  Installing     : mongodb-org-shell                                                                                                       2/5
  Installing     : mongodb-org-tools                                                                                                       3/5
  Installing     : mongodb-org-mongos                                                                                                      4/5
  Installing     : mongodb-org                                                                                                             5/5

Installed:
  mongodb-org.x86_64 0:3.0.12-1.el5

Dependency Installed:
  mongodb-org-mongos.x86_64 0:3.0.12-1.el5       mongodb-org-server.x86_64 0:3.0.12-1.el5       mongodb-org-shell.x86_64 0:3.0.12-1.el5
  mongodb-org-tools.x86_64 0:3.0.12-1.el5

Complete!
[root@MongoDB ~]#

4) MongoDB details 

[root@MongoDB ~]# service mongod status
mongod is stopped
[root@MongoDB ~]# service mongod start
Starting mongod:                                           [  OK  ]
[root@MongoDB ~]# service mongod status
mongod (pid 3672) is running...
[root@MongoDB ~]#

=> mongoDB logs 

[root@MongoDB ~]# cat /var/log/mongodb/mongod.log
2016-07-30T17:55:37.721+0530 I CONTROL  ***** SERVER RESTARTED *****
2016-07-30T17:55:37.725+0530 I CONTROL  [initandlisten] MongoDB starting : pid=3672 port=27017 dbpath=/var/lib/mongo 64-bit host=MongoDB.example.com
2016-07-30T17:55:37.725+0530 I CONTROL  [initandlisten] db version v3.0.12
2016-07-30T17:55:37.725+0530 I CONTROL  [initandlisten] git version: 33934938e0e95d534cebbaff656cde916b9c3573
2016-07-30T17:55:37.725+0530 I CONTROL  [initandlisten] build info: Linux build13.ny.cbi.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2016-07-30T17:55:37.725+0530 I CONTROL  [initandlisten] allocator: tcmalloc
2016-07-30T17:55:37.725+0530 I CONTROL  [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, processManagement: { fork: true, pidFilePath: "/var/run/mongodb/mongod.pid" }, storage: { dbPath: "/var/lib/mongo", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2016-07-30T17:55:37.751+0530 I JOURNAL  [initandlisten] journal dir=/var/lib/mongo/journal
2016-07-30T17:55:37.751+0530 I JOURNAL  [initandlisten] recover : no journal files present, no recovery needed
2016-07-30T17:55:37.898+0530 I JOURNAL  [durability] Durability thread started
2016-07-30T17:55:37.898+0530 I JOURNAL  [journal writer] Journal writer thread started
2016-07-30T17:55:37.901+0530 I INDEX    [initandlisten] allocating new ns file /var/lib/mongo/local.ns, filling with zeroes...
2016-07-30T17:55:37.944+0530 I STORAGE  [FileAllocator] allocating new datafile /var/lib/mongo/local.0, filling with zeroes...
2016-07-30T17:55:37.944+0530 I STORAGE  [FileAllocator] creating directory /var/lib/mongo/_tmp
2016-07-30T17:55:38.286+0530 I STORAGE  [FileAllocator] done allocating datafile /var/lib/mongo/local.0, size: 64MB,  took 0.298 secs
2016-07-30T17:55:38.292+0530 I NETWORK  [initandlisten] waiting for connections on port 27017
2016-07-30T17:58:05.287+0530 I CONTROL  [signalProcessingThread] got signal 15 (Terminated), will terminate after current cmd ends
2016-07-30T17:58:05.287+0530 I CONTROL  [signalProcessingThread] now exiting
2016-07-30T17:58:05.287+0530 I NETWORK  [signalProcessingThread] shutdown: going to close listening sockets...
2016-07-30T17:58:05.287+0530 I NETWORK  [signalProcessingThread] closing listening socket: 6
2016-07-30T17:58:05.287+0530 I NETWORK  [signalProcessingThread] closing listening socket: 7
2016-07-30T17:58:05.288+0530 I NETWORK  [signalProcessingThread] removing socket file: /tmp/mongodb-27017.sock
2016-07-30T17:58:05.288+0530 I NETWORK  [signalProcessingThread] shutdown: going to flush diaglog...
2016-07-30T17:58:05.288+0530 I NETWORK  [signalProcessingThread] shutdown: going to close sockets...
2016-07-30T17:58:05.288+0530 I STORAGE  [signalProcessingThread] shutdown: waiting for fs preallocator...
2016-07-30T17:58:05.288+0530 I STORAGE  [signalProcessingThread] shutdown: final commit...
2016-07-30T17:58:05.288+0530 I JOURNAL  [signalProcessingThread] journalCleanup...
2016-07-30T17:58:05.288+0530 I JOURNAL  [signalProcessingThread] removeJournalFiles
2016-07-30T17:58:05.311+0530 I JOURNAL  [signalProcessingThread] Terminating durability thread ...
2016-07-30T17:58:05.394+0530 I JOURNAL  [journal writer] Journal writer thread stopped
2016-07-30T17:58:05.394+0530 I JOURNAL  [durability] Durability thread stopped
2016-07-30T17:58:05.394+0530 I STORAGE  [signalProcessingThread] shutdown: closing all files...
2016-07-30T17:58:05.395+0530 I STORAGE  [signalProcessingThread] closeAllFiles() finished
2016-07-30T17:58:05.395+0530 I STORAGE  [signalProcessingThread] shutdown: removing fs lock...
2016-07-30T17:58:05.395+0530 I CONTROL  [signalProcessingThread] dbexit:  rc: 0


[root@MongoDB ~]# mongod --version
db version v3.0.12
git version: 33934938e0e95d534cebbaff656cde916b9c3573

[root@MongoDB ~]# mongo -version
MongoDB shell version: 3.0.12


:- Uninstall MongoDB

[root@MongoDB ~]# service mongod stop
Stopping mongod:                                           [  OK  ]
[root@MongoDB ~]# service mongod status
mongod is stopped
[root@MongoDB ~]#

[root@MongoDB ~]# yum erase $(rpm -qa | grep mongodb-org)

Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package mongodb-org.x86_64 0:3.0.12-1.el5 set to be erased
---> Package mongodb-org-mongos.x86_64 0:3.0.12-1.el5 set to be erased
---> Package mongodb-org-server.x86_64 0:3.0.12-1.el5 set to be erased
---> Package mongodb-org-shell.x86_64 0:3.0.12-1.el5 set to be erased
---> Package mongodb-org-tools.x86_64 0:3.0.12-1.el5 set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================
 Package                                 Arch                        Version                              Repository                      Size
===============================================================================================================================================
Removing:
 mongodb-org                             x86_64                      3.0.12-1.el5                         installed                       0.0
 mongodb-org-mongos                      x86_64                      3.0.12-1.el5                         installed                       13 M
 mongodb-org-server                      x86_64                      3.0.12-1.el5                         installed                       26 M
 mongodb-org-shell                       x86_64                      3.0.12-1.el5                         installed                       14 M
 mongodb-org-tools                       x86_64                      3.0.12-1.el5                         installed                       92 M

Transaction Summary
===============================================================================================================================================
Install      0 Package(s)
Update       0 Package(s)
Remove       5 Package(s)

Is this ok [y/N]:y

[root@MongoDB ~]# rm -r /var/log/mongodb
[root@MongoDB ~]# rm -r /var/lib/mongo

2 comments:

  1. The Best of the Blogs You have Mentioned here..
    Full Stack Online Training

    ReplyDelete
  2. Good post and informative. Thank you very much for sharing this good article, it was so good to read and useful to improve my knowledge as updated, keep blogging.This article is very much helpful and i hope this will be an useful information for the needed one.Keep on updating these kinds of informative things
    oracle training in chennai

    oracle training institute in chennai

    oracle training in bangalore

    oracle training in hyderabad

    oracle training

    oracle online training

    hadoop training in chennai

    hadoop training in bangalore

    ReplyDelete

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...