Showing posts with label mongo. Show all posts
Showing posts with label mongo. Show all posts

Wednesday, May 13, 2020

Mongo DB Commands - Mithun Technologies - +91 99809 23226

Mithun Technologies            +91-9980923226              devopstrainingblr@gmail.com

                                                       http://mithuntechnologies.com/
                                                       http://mithuntechnologies.co.in/ 


mongod --version: It will gives the MongoDB Server version.

mongo -version: It will gives the MongoDB Shell version.
Mongo Shell is the command line client.

To login into mongo db just type mongo command.

db.createCollection("students"): It will create a collection called students.


db.students.insertOne( {
    name: "Mithun",
    age: 07,
    status: "A"
 } )



Wednesday, February 19, 2020

Mongo DB Installation - Linux - Mithun Technologies - 9980923226



Mithun Technologies            +91-9980923226              devopstrainingblr@gmail.com

                                                       http://mithuntechnologies.com/
                                                       http://mithuntechnologies.co.in/ 
Mongo DB Installation 
#Login as a root user
sudo su -

#Configure the package management system (yum).
#Create a file /etc/yum.repos.d/mongodb-org-4.2.repo


vi /etc/yum.repos.d/mongodb-enterprise-4.2.repo

#add below lines in /etc/yum.repos.d/mongodb-org-4.2.repo file

[mongodb-enterprise-4.2]
name=MongoDB Enterprise Repository
baseurl=https://repo.mongodb.com/yum/redhat/$releasever/mongodb-enterprise/4.2/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc

#Install the mongodb
yum install -y mongodb-enterprise

#Enable the mongod service
systemctl enable mongod
#Start  the mongod service
systemctl start mongod
#Check the mongo db version
mongo --version

#Connect to mongo db
mongo
#Create a user

use admin
 
db.createUser(
  {
    user: "mithuntechnologies",
    pwd: "passw0rd",
    roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
  }
)

#Enable authentication

vi /etc/mongod.conf

security:
    authorization: "enabled"
   
#Restart the mongod service as follows.

service mongod restart

# Connect to Mongo DB from any client
mongo mongod:IPAddress:27017


Ansible Installation in Amazon Linux - Mithun Technologies - 9980923226

  Mithun Technologies            +91-9980923226              devopstrainingblr@gmail.com                                                 ...