Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
MongoDB High Availability
MongoDB High Availability

MongoDB High Availability: Design and implement a highly available server using the latest features of MongoDB.

eBook
$14.99 $21.99
Paperback
$36.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

MongoDB High Availability

Chapter 2. Understanding MongoDB's Failures and Limitations

As you are undoubtedly aware, developers might face data loss or server failures while working with the server, just like other database engines. This book is aimed at providing you with solutions so that you have a readily available database engine in MongoDB. Before talking about the remedies, you should understand the main reasons for failures and limitations.

In this chapter, we will understand the reasons for MongoDB's failures and limitations in the production environment.

Understanding the limitation of a 32-bit version of MongoDB

If you want to deploy MongoDB in a production environment, it's necessary that you use a 64-bit version and not a 32-bit one. In the 32-bit version, MongoDB has the limitation of storage size, that is, you cannot store datasets more than 2 GB.

While using a 32-bit version, if the database storage is more than 2 GB, you will get an error, and you can't start the server till the time you remove your data or migrate your database to a 64-bit version of MongoDB.

The Unix limitation

Most of the Unix family systems such as OS X and Linux provide a method to limit the amount of resources that each user and process can use at the moment. The ulimit function is responsible for managing and applying this limitation.

When the mongod or mongos processes reach the limitation, some errors will show up and the MongoDB server will crash at that moment. You can simply change the limitation using the ulimit function.

Both mongod and mongos...

Failover in replica set

In MongoDB, we have a feature that enables clustering for a database. This feature is called a replica set. In further chapters, we will introduce and review it in detail. However, for this chapter, a brief introduction to this feature is enough.

Note

A replica set in MongoDB is a group of mongod processes that maintain the same dataset. Replica sets provide redundancy and high availability and are the basis for all production deployments. For more information, please visit http://docs.mongodb.org/manual/replication/.

In replica sets, when the primary node becomes unavailable, the replica set conducts an election process to choose a new primary member from secondaries. This change might take about 10 to 60 seconds. However, it varies between servers and depends on the replica set settings, numbers of nodes, and server capacity.

While performing the election process, the replica set becomes unavailable for write operations. So, in this situation, operations are limited...

Sharding the configuration server failure

To distribute the whole dataset to different machines and servers, that is, horizontal scaling, MongoDB provides you with the sharding feature. Using this feature, you can split the database into different pieces in separate servers. In the next chapters, we will learn more about this feature in detail.

MongoDB uses configuration servers to store the configuration for the sharding settings and relations between members. For the production environment, these configuration servers are exactly three in number.

If one or two distinct configuration servers become unavailable, the clustering works properly, but it cannot create more chunks from the dataset, which means that it will be read-only.

Chunks are pieces of database in separate machines, and MongoDB splits the database into chunks of data based on a sharded key. MongoDB creates chunks from the database after write operations based on the given sharded key.

If all three configuration servers become...

Understanding database locks

MongoDB uses read/write locks to prevent conflicts between write/read operations and also makes sure that all clients receive the same dataset with the same query.

MongoDB uses the readers-writer lock to prevent conflicts and control the read/write operations.

Note

A readers-writer lock is like a mutex, in that, it controls access to a shared resource, allowing concurrent access to multiple threads for reading, but restricting access to a single thread for writes (or other changes) to the resource. For more information, please visit http://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock.

MongoDB uses the shared read-lock, which means that many operations can use the existing read-lock. On the other hand, a write-lock is limited to a single operation, which means that no more write operations can use and share the existing lock.

The MongoDB lock mechanism gets better with each version. Before v2.2, MongoDB had a global lock per mongod instance for most read/write...

Summary

In this chapter, you learned the basic reasons for MongoDB failures and the situations in which they might happen. We learned that the 32-bit version of MongoDB has some issues in the production environment, and it's necessary to use a 64-bit version for production only to prevent issues in high load.

After this, we learned about the ulimit function in Unix family operating systems, which enable us to manage limitations for processes or change the limitation easily via the command-line environment. Most of the time, MongoDB can reach this limitation and crashes due to not having enough resources.

We then went on to discover that while replica sets are available for failover and the election process, MongoDB is not available for write operations. Hence, we need to provide a way to control the write operations and prevent data loss.

Then, we saw that the unavailability of configuration servers can cause issues for the sharded cluster, and at least one configuration server should...

Left arrow icon Right arrow icon

Description

This book has a perfect balance of concepts and their practical implementation along with solutions to make a highly available MongoDB server with clear instructions and guidance. If you are using MongoDB in a production environment and need a solution to make a highly available MongoDB server, this book is ideal for you. Familiarity with MongoDB is expected so that you understand the content of this book.

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jul 24, 2014
Length: 164 pages
Edition : 1st
Language : English
ISBN-13 : 9781783986736
Category :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Jul 24, 2014
Length: 164 pages
Edition : 1st
Language : English
ISBN-13 : 9781783986736
Category :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 62.98
MongoDB High Availability
$36.99
Instant MongoDB
$25.99
Total $ 62.98 Stars icon

Table of Contents

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

Customer reviews

Rating distribution
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
(1 Ratings)
5 star 0%
4 star 0%
3 star 0%
2 star 0%
1 star 100%
kinfire75 Aug 20, 2014
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
What a rip off. Essentially, the author has read MongoDB documentation and has decided to re-tell it in his own words. There is zero practical advice, zero original content, zero learning from someone else's experience - most of the book consists of mongodb documentation URL references wrapped in 2 to 5 sentences of some filler verbiage. I am not a MongoDB expert, but I have been working with it hands on daily for the past 7 months, and the few places where the author does venture to give his opinion, he is just plain wrong. Overall, the book feels like it was written by a college student who has "looked it up" somewhere, and moved some words around, incorrectly, in some cases. It is such a blatant case of quick and dirty workmanship, I am simply disgusted how this crap can be put out.I am going to try to get my money back.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.