Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
MongoDB High Availability

You're reading from   MongoDB High Availability Design and implement a highly available server using the latest features of MongoDB.

Arrow left icon
Product type Paperback
Published in Jul 2014
Publisher
ISBN-13 9781783986729
Length 164 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Afshin Mehrabani Afshin Mehrabani
Author Profile Icon Afshin Mehrabani
Afshin Mehrabani
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Understanding the MongoDB Architecture and Processes FREE CHAPTER 2. Understanding MongoDB's Failures and Limitations 3. Clustering in MongoDB 4. Utilizing a Replica Set 5. Replica Set in Action 6. Understanding the Concept of Sharding 7. Sharding in Action 8. Analyzing and Improving Database Performance 9. Migrating Instances and Reducing Downtime 10. Monitoring and Troubleshooting the Database Index

Managing a mongos instance


Now it's time to add shards and split the entire dataset into smaller pieces. For production use, each shard should be a replica set network, but for the development and testing environment, you can simply add a single mongod instance to the cluster. In previous chapters, we learned how to set up and configure a replica set from scratch.

To control and manage the mongos instance, we can simply use the mongo shell to connect to the mongos and execute commands. To connect to the mongos instance, you use the following command:

mongo --host <mongos hostname> --port <mongos port>

For instance, our mongos address is mongos1.sharding.com and the port is 27017. This is depicted in the following screenshot:

After connecting to the mongos instance, we have a command environment, and we can use it to add, remove, or modify shards, or even get the status of the entire sharding network.

Using the following command, you can get the status of the sharding network:

sh...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime