-->

DEVOPSZONES

  • Recent blogs

    How To Install MongoDB 4 on RHEL 7 / CentOS 7

    How To Install MongoDB 4 on RHEL 7 / CentOS 7


    How To Install MongoDB 4

    In this guide, we will cover the steps to install MongoDB 4 on RHEL 7 / CentOS 7. MongoDB is an open source NoSQL database system written in C++ designed to ensure scalability and high performance.

    MongoDB 4 is available on MongoDB yum repository. Add the repository to your centos7 server by running below commands:


     Add the Repository:


    sudo tee /etc/yum.repos.d/mongodb-org-4.repo<<EOF
    [mongodb-org-4.0]
    name=MongoDB Repository
    baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/
    gpgcheck=1
    enabled=1
    gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc
    EOF

    How To Install MongoDB 4

    Install mongodb-org package.


    [root@dockerworkernode2 ~]# yum install mongodb-org -y
    Loaded plugins: fastestmirror
    mongodb-org-4.0                                                                                          | 2.5 kB  00:00:00
    mongodb-org-4.0/7/primary_db                                                                             |  59 kB  00:00:02
    Loading mirror speeds from cached hostfile
     * base: mirrors.piconets.webwerks.in
     * extras: mirrors.piconets.webwerks.in
     * updates: mirrors.piconets.webwerks.in
    Resolving Dependencies

    Starting MongoDB

    After MongoDB successfully installed, start the MongoDB.

    $ systemctl start mongod


    mongodb-org-mongos – This is a MongoDB Shard daemon
    mongodb-org-shell – This provides a shell to MongoDB
    mongodb-org-server – This provides MongoDB daemon mongod
    mongodb-org-tools – MongoDB tools used for export, dump, import

    How To Install MongoDB 4


    Enable mongod Service :

    [root@dockerworkernode2 ~]# systemctl enable --now mongod
    [root@dockerworkernode2 ~]# systemctl status mongod
    ● mongod.service - MongoDB Database Server
       Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
       Active: active (running) since Thu 2019-12-12 11:11:07 IST; 24s ago
         Docs: https://docs.mongodb.org/manual
      Process: 2707 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=0/SUCCESS)
      Process: 2704 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
      Process: 2701 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
      Process: 2699 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)
     Main PID: 2710 (mongod)
       Memory: 87.8M
       CGroup: /system.slice/mongod.service
               └─2710 /usr/bin/mongod -f /etc/mongod.conf

    Dec 12 11:11:06 dockerworkernode2.org systemd[1]: Starting MongoDB Database Server...
    Dec 12 11:11:06 dockerworkernode2.org mongod[2707]: about to fork child process, waiting until server is ready for connections.
    Dec 12 11:11:06 dockerworkernode2.org mongod[2707]: forked process: 2710
    Dec 12 11:11:07 dockerworkernode2.org systemd[1]: Started MongoDB Database Server.
    Hint: Some lines were ellipsized, use -l to show in full.
    [root@dockerworkernode2 ~]#

    Useful MongoDB Articles:

    No comments