DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Data Engineering
  3. Databases
  4. MongoDB 1.6 Arrives With Auto-Sharding and Replica Sets

MongoDB 1.6 Arrives With Auto-Sharding and Replica Sets

Mitch Pronschinske user avatar by
Mitch Pronschinske
·
Aug. 05, 10 · Interview
Like (0)
Save
Tweet
Share
16.92K Views

Join the DZone community and get the full member experience.

Join For Free

Companies like Foursquare, bit.ly, and BoxedIce have been using the beta version of MongoDB 1.6 in production for a few months and they have been very impressed with the new functionality in today's release.  Two main new features in 1.6 are Auto-Sharding and Replica Sets.  Auto-sharding allows the automation of horizontal scaling for MongoDB across multiple nodes, and Replica sets will automate failover and redundancy so that data existence on any number of servers across multiple datacenters is assured.  MongoDB is a NoSQL (non-relational) document store.

How to Make Replica Sets
Replica sets are a new method for database replication in MongoDB 1.6.  They support automatic failover, automatic recovery of nodes, and multi data center operations.  A replica set will hold any number of members and the data will fully exist on each one.  There is always a primary server which receives reads and writes while other members accept reads only.  If your primary fails, another member will take over automatically.  Once you have the replica set, you can begin sharding.

Setting up Replica Sets


How to use Auto-Sharding
Configuring the auto-sharding has three parts in MongoDB 1.6.  First, you need to set up the shard servers with the --shardsvr parameter when starting each mongod instance.  The config servers run with the --configsvr parameter to store metadata for the shard.  The documentation states that “a production shard cluster will have three config server processes, each existing on a separate machine. Writes to config servers use a two-phase commit to ensure an atomic and replicated transaction of the shard cluster’s metadata.”  Finally, the shard servers and config servers connect to the 'mongos', which are the processes that your clients connect to when routing queries to the appropriate shards.  They are self-contained and they usually run on each of your app servers.



Sharding setup



Foursquare moved all check-ins and user data to MongoDB from PostgreSQL once they no longer could use a single physical machine.  “With foursquare's growing popularity, we were fast approaching the point where it would no longer be feasible to store user checkins on a single physical machine.,” said Harry Heymann, Engineering Lead at Foursquare. “MongoDB's auto-sharding capabilities enabled us to easily transition to a multi-node cluster that will enable us to continue to grow for the foreseeable future.”

Another MongoDB user is Bit.ly, a service with 50 million users and 12.5 billion 'shortens' per month.  They store user history in MongoDB. Other major production users of MongoDB include the New York Times, Etsy, SourceForge, and Shutterfly.  Downloads of the database exceeded 50,000 in the month of July.

For more info on how BoxedIce set up their auto-sharding, check out their recent blog entry.

MongoDB Data (computing) Database

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Building a REST API With AWS Gateway and Python
  • How To Build a Spring Boot GraalVM Image
  • Key Elements of Site Reliability Engineering (SRE)
  • Specification by Example Is Not a Test Framework

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: