Skip to content

Latest commit

 

History

History
 
 
About
=======================================

A simple Mongo sharding (with replica sets) setup example using Mongo/Java/Ant.

See: http://www.mongodb.org/display/DOCS/Sharding and http://www.mongodb.org/display/DOCS/Replica+Sets

Prerequisites
=======================================

You must have Ant installed and in your $PATH.

You must have Mongo installed and the bin files in your $PATH.

Running
=======================================

Open a terminal window and run:

* ant run

This runs three shard servers (four including the replicas), two arbiters, three config servers and two mongos servers.

The ports are:

    * mongo-shard-0     : 27018
    * mongo-shard-0a    : 27019 (this is a replica of mongo-shard-0)
    * mongo-arbiter-0   : 27023
    * mongo-shard-1     : 27020
    * mongo-shard-1a    : 27021 (this is a replica of mongo-shard-1)
    * mongo-arbiter-0   : 27024
    * mongo-config-0    : 27022
    * mongo-config-1    : 27025
    * mongo-config-2    : 27026
    * mongos            : 27017
    * mongos            : 27030

The run command will start your mongo servers and initialize your replica sets, shard cluster and run a couple
of simple tests. This command takes a while to run because it waits (sleeps) to make sure the replica sets and
cluster are setup.

The run command will not exit untl CTRL-C is hit. CTRL-C also kills your mongo processes.

Note: If you run "ant clean" this deletes the temp database files stored in build/*.

Note: This was last tested with 2.4.1, but it should work with other versions as well.

License
=======================================

Copyright 2011, Deft Labs.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.