how to remove all data from specific MongoDB collections

HI all, this document shows you how to remove all data from specific MongoDB collections. MongoDB is NoSQL database, MongoDB uses JSON-like documents with optional schemas. Sometimes there will be a requirement to delete all the data of specific MongoDB collection. Here we will provide the steps for that. Step 1: log in to mongo shell Step 2: Now choose your database, Step 3: now display your collections under scrapper database, Step 4: Now delete all the data from user collection.   Success, now you deleted all the data from…

Read More

Failed to set up listener: SocketException: Permission denied

Hi All, this document deals with how to fix Failed to set up listener: SocketException: Permission denied error. This issue is related to permission issues where MongoDB is not able to start the service. Check the permission of tmp location Change the permission and ownership of temp folder. chown root:root /tmp chmod 1777 /tmp Now start the MongoDB service. service mongod start © 2019, Techrunnr. All rights reserved.

Read More

Change MongoDB Default Data Path in Linux

We will see how to change the default MongoDB database server directory, by default, it is stored all data in /var/lib/mongo. Now we will see how to change this directory. Before making any changes, stop MongoDB service Create a new directory where we need to move the storage location for Mongo Edit the configuration file /etc/mongod.conf and modify the following fields accordingly: Make sure the new directory has mongod user access. Now we need the SELinux Configuration if it is enforced. Configure SELinux, if it’s in enforcing mode. Since we…

Read More

Ansible playbook for MongoDB Replication setup on CentOS7

Hi Techrunnr, this post is regarding mongoDB installation and replica setup with HA using ansible on CentOS7 Prerequisites: 3 servers with CentOS7 operating system Deploy 3 servers in 3 different AZ Python on 3 nodes Ansible on execution server Enable Security groups on each server to communicate with each other Create 3 servers on different AZ Lets say server A <IP1>, server B <IP2>, server C <IP3>, make sure that security groups are enable to allow traffic from each other Edit the /etc/hosts file in 3 nodes, add the IP…

Read More

dockerisation of monogdb replica and HA

Hi Techrunnr, this document is related dockerising mongodb with replication setup and HA HA (High availability) refers to improvement of system and app availability by minimising the down time for usual maintenance of system and as well as application and system crash (unplanned). This post specifically talk about the mongoDB replication setup and HA with docker, this is a master-salve architecture Master: The master node can both read and write data. When handling modified data, the op-log will synchronise¬†the updates to all the connected slave nodes. Slave: The slave node…

Read More

reset mongodb password

  Hi Techrunnr, this document deals with reset password and authentication setup of mongoDB, this document helps you to work with when you forget mongodb user (include super user too) credentials For MongoDB authentication setup please go through the our blog link: https://www.techrunnr.com/mongodb-create-user-authentication-setup-and-mongo-dump/ To reset the mongodb authentication setup, first we need to edit the mongod.conf file, authentication setup block looks like as shown below Now we need to disable this authentication setup Restart the mongod service Now login to mongodb, and create a super user or else a normal…

Read More