Monday, 10 September 2018

MongoDB installation and configuration with non-root user


MongoDB can be installed with root or non root. for root its always easy to install and configure MongoDB.
But for non-root, there are some steps you need to follow for configuring the environment.

Important notes

a.  All below steps need to be executed on all nodes of MongoDB cluster
b.  non-root user should be logged in before executing any CLI command
c.  non-root user should be added under sudoers list (vi /etc/sudoers) on Linux platforms


MongoDB installation and configuration with non-root user


Yum repository way-

1. Launch https://docs.mongodb.com/manual/installation/  to see the steps for different platforms
2. For non-root, you need to execute all commands with sudo
3. Once it's installed, you need to spawn the mongod and mongos processes .
    Ensure that you non root user you are logged in with has ownership to below

   - Data paths/folder used for config
   - mongod.conf file (is used)
   - mongos.conf file (is used)
   - Security key used for enabling authentication (if used)
   - mongodb installation paths

      [use chwon command to own the environment for linux]



Tar Ball installation


1. Launch https://docs.mongodb.com/manual/installation/  to see the steps for different platforms with tarball installation
2. Untar the mongdb.tar to the folder
3. Set the path to bin folder under bashrc of this user so that you can execute the mongod/mongos from anywhere else you will see "command not error" as the system doesn't know where the h*** is mongod extracted.

  e.g. if you are logged in with the admin user, navigate to /home/admin/.bashrc and set below value

 



  4. Once this is set, save the file and execute below
        source /bashrc_path

  5. Now you won't see command not found error as it will be executed from bin directory by system 

  6. Ensure that you non root user you are logged in with has ownership to below

   - Data paths/folder used for config/data 
   - mongod.conf file (is used)
   - mongos.conf file (is used)
   - Security key used for enabling authentication (if used)
   - mongodb installation/extracted folder

      [use chwon command to own the environment for linux]


 7. Once this is spawned using conf or CLI , you can access it like root user

 8. For spawning mongod or mongos using config files or CLI methos, please read by other post




















  

No comments:

Post a Comment

Configure certificate based authentication for mongodb (MongoDB-X509 authentication)

A . Spawn mongod and mongos with no authentication first Configure MongoDB cluster, with no authentication, enabled using config files ...