News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Derick Rethans:
Read Preferences wth the MongoDB PHP driver
December 20, 2012 @ 13:41:24

Derick Rethans has a new post to his site detailing some of the "read" preferences that you can customize in the latest versions of the MongoClient functionality in the MongoDB PHP extension for replica sets and sharing setups.

Read Preferences are a new Replica Set and Sharding feature implemented by most MongoDB drivers that are supported by 10gen. This functionality requires MongoDB 2.2. In short, Read Preferences allow you to configure from which nodes you prefer the driver reads data from. In a Replica Set environment it is the driver that does the selection of the preferred node, and in a Sharded environment it is the mongos process that routes queries according to the defined Read Preferences.

He starts with a look at the read preference types (like "primary", "secondary" and "nearest") how the connection manager works to handle each type. He includes some code samples showing how to configure your MongoClient connections to use these various types of preferences. He also introduces the concept of "tags" for the replica set - aliases to make them a bit easier to identify when making a connection and how to define them in the connection string.

0 comments voice your opinion now!
mongodb mongoclient read preference replicaset sharding connection tutorial


blog comments powered by Disqus

Similar Posts

NETTUTS.com: Secure Your Forms With Form Keys

Hasin Hayder's Blog: RSA Encrypting and Decrypting data with Zend_Crypt_Rsa Library

DotKernel.com: Installing GeoIP extension in Zend Server 5.6 on Windows

Chad Lung's Blog: Install Lighttpd, PHP and MySQL on Ubuntu 10.10

PHPMaster.com: Parsing XML With SimpleXML


Community Events

Don't see your event here?
Let us know!


introduction podcast language laravel5 release community symfony threedevsandamaybe laravel voicesoftheelephpant interview security version library opinion unittest framework extension api series

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework