Permalink
Browse files

Added replicaset doc

  • Loading branch information...
1 parent 020ddec commit 0b5d097464b8dd9fe5a1a894a159c0b1a6ef3b52 @christkv committed May 25, 2011
Showing with 49 additions and 4 deletions.
  1. +8 −4 Readme.md
  2. +1 −0 docs/README.md
  3. +40 −0 docs/replicaset.md
View
@@ -80,11 +80,15 @@ For examples look in the examples/ directory. You can execute the examples using
$ node queries.js
GridStore
-========
+=========
The GridStore class allows for storage of binary files in mongoDB using the mongoDB defined files and chunks collection definition.
-See the gridfs.js file under examples/ for how to use it or view the integration tests marked with test_gs_...
+For more information have a look at [Gridstore](docs/gridfs.md)
+
+Replicasets
+===========
+For more information about how to connect to a replicaset have a look at [Replicasets](docs/replicaset.md)
Notes
========
@@ -154,8 +158,8 @@ Documentation
========
If this document doesn't answer your questions, see the source of
-[Collection](https://github.com/mongodb/mongo-python-driver/blob/master/pymongo/connection.py)
-or [Cursor](https://github.com/mongodb/mongo-python-driver/blob/master/pymongo/cursor.py),
+[Collection](https://github.com/christkv/node-mongodb-native/blob/master/lib/mongodb/collection.js)
+or [Cursor](https://github.com/christkv/node-mongodb-native/blob/master/lib/mongodb/cursor.js),
or the documentation at MongoDB for query and update formats.
Find
View
@@ -9,5 +9,6 @@ Select topic of interest for detailed description:
* [Inserting/updating documents](insert.md)
* [GridStore](gridfs.md)
* [Indexes](indexes.md)
+ * [Replicasets](replicaset.md)
This documentation is incomplete, the best source for all possible methods are [the source fornode-mongodb-native](https://github.com/christkv/node-mongodb-native) and [MongDB manual](http://www.mongodb.org/display/DOCS/Manual).
View
@@ -0,0 +1,40 @@
+Replicasets
+===========
+
+## Introduction
+
+Replica sets is the asynchronous master/slave replication added to Mongodb that takes care off all the failover and recovery for the member nodes. According to the mongodb documentation a replicaset is
+
+ * Two or more nodes that are copies of each other
+ * Automatic assignment of a primary(master) node if none is available
+ * Drivers that automatically detect the new master and send writes to it
+
+More information at [Replicasets](http://www.mongodb.org/display/DOCS/Replica+Sets)
+
+## Driver usage
+
+To create a new replicaset follow the instructions on the mongodb site to setup the config and the replicaset instances. Then using the driver.
+
+ var replSet = new ReplSetServers( [
+ new Server( 127.0.0.1, 30000, { auto_reconnect: true } ),
+ new Server( 127.0.0.1, 30001, { auto_reconnect: true } ),
+ new Server( 127.0.0.1, 30002, { auto_reconnect: true } )
+ ],
+ {rs_name:RS.name}
+ );
+
+ var db = new Db('integration_test_', replSet);
+ db.open(function(err, p_db) {
+ // Do you app stuff :)
+ })
+
+The ReplSetSrvers object has the following parameters
+
+ var replSet = new ReplSetSrvers(servers, options)
+
+Where
+
+ * `servers` is an array of `Server` objects
+ * `options` can contain the following options
+ * `rs_name` is the name of the replicaset you configured when you started the server, you can have multiple replicasets running on your servers.
+ * `read_secondary` set's the driver to read from secondary servers (slaves) instead of only from the primary(master) server.

0 comments on commit 0b5d097

Please sign in to comment.