asicfr / mongodbonwindows Goto Github PK
View Code? Open in Web Editor NEWDeploy MongoDB shard cluster on Windows in one click
Deploy MongoDB shard cluster on Windows in one click
Deploy MongoDB shard cluster on Windows in one click. --------------------------------------------------------------------- Deploy MongoDB shard cluster on Linux is very easy with fork option (http://docs.mongodb.org/manual/reference/program/mongod/). But if you want to do that on Windows (yes i know ...), it's a little bit more complicated. In this post, i will show you how to use batch and javascript to easily deploy MongoDB (without Windows service). MongoDB must be already installed, if you need information, read that excellent post : http://blog.ajduke.in/2013/04/10/install-setup-and-start-mongodb-on-windows/ The first problem is to successfully launch mongo executables in "background" from a batch. The syntax is very simple (see http://technet.microsoft.com/en-us/library/bb491005.aspx) : start /b "title" myExe arg0 arg1 ... I add /b to start an application without opening a new command prompt window. So, for example to launch the mongo shell, i just create the following command : start /b "test launching mongo shell" "C:\Program Files\MongoDB 2.6 Standard\bin\mongo" Second step, create a sweet cluster on my computer (nodes can also be remote). Here is the structure of folders : https://gist.github.com/asicfr/fbece3bc3bc4630aa8b9 The last step is to create the complete script to deploy MongoDB that shard cluster. What we have to do (see http://docs.mongodb.org/manual/tutorial/deploy-shard-cluster/ for more details) ? - Start our two replicatSets - Start the Config Server Database Instances - Start the mongos Instances - Add Shards to the Cluster - Enable Sharding for a Database - Enable Sharding for a Collection Here is the script : https://gist.github.com/asicfr/2c7b99947083d13a9c6b This script uses three javascript to interact with mongo shell : - configS1.js : define the members of first replicatSet https://gist.github.com/asicfr/207682eeca5a6ac836ea - configS2.js : define the members of second replicatSet https://gist.github.com/asicfr/9e70a374480dd5d85519 - configShard.js : configure sharding and show the status of the sharding configuration https://gist.github.com/asicfr/12d50de4f792fe165290 If the script work, you must see the following status : https://gist.github.com/asicfr/548941c0b9de7abe17fd I added some pauses, especially before the last action (define sharding configuration) otherwise the sharding configure is not applied. If you find a better solution, tell me. Conclusion : You no longer have excuses for not testing MongoDB shard cluster on Windows. All script and folders are available on github : https://github.com/asicfr/mongoDBonWindows
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.