Book Image

MongoDB High Availability

By : Afshin Mehrabani
Book Image

MongoDB High Availability

By: Afshin Mehrabani

Overview of this book

Table of Contents (17 chapters)
MongoDB High Availability
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Summary


In this chapter, you learned how to enable the sharding feature for a MongoDB database. First of all, we prepared the environment and configured the hostnames for configuration servers. Then, you learned how to start a configuration server and establish a configuration server on a machine. You are recommended to host the configuration server on separate machines in a production environment, but for development, you can host them on a single machine.

After establishing the configuration servers, we added shards to sharding. For production uses, it's better to use a replica set for each shard, but for development and testing environments, we can host standalone mongod instances. For our example, we added two shards, one replica set, and a standalone mongod instance.

Also, you learned how to manage and control mongos instances using the mongo shell.

At the end, we created a database and collection to test the sharding feature on. You learned that we should enable sharding for the database...