Book Image

MongoDB Cookbook

By : Amol Nayak
Book Image

MongoDB Cookbook

By: Amol Nayak

Overview of this book

<p>MongoDB is a high-performance and feature-rich NoSQL database that forms the backbone of numerous complex development systems. You will certainly find the MongoDB solution you are searching for in this book.</p> <p>Starting with how to initialize the server in three different modes with various configurations, you will then learn a variety of skills including the basics of advanced query operations and features in MongoDB and monitoring and backup using MMS. From there, you can delve into recipes on cloud deployment, integration with Hadoop, and improving developer productivity. By the end of this book, you will have a clear idea about how to design, develop, and deploy MongoDB.</p>
Table of Contents (17 chapters)
MongoDB Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Exploring the config database in a sharded setup


The config database is the backbone of a sharded setup in Mongo. It stores all the metadata of the shard setup and has a dedicated mongod process running for it. When a mongos process is started, we provide it with the config server's URL. In this recipe, we will take a look at some collections in the config database and dive deep into their content and significance.

Getting ready

We will have a sharded setup for this recipe. Refer to the Starting a simple sharded environment of two shards in Chapter 1, Installing and Starting the MongoDB Server, for how to start a simple shard. Additionally, connect to the mongos process from a shell.

How to do it…

  1. From the console connected to the mongos process, switch to the config database and execute view all collections as follows:

    mongos> use config
    mongos>show collections
    
  2. From the list of all collections, we will visit a few. We start with the databases collection. This keeps a track of all the...