Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
root
committed
Jul 3, 2011
1 parent
af55517
commit 14e8906
Showing
13 changed files
with
145 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
:: configdb.bat ( same as a replica but without "--replSet myreplsetname" ) | ||
:: this file is used to Reinstall mongodb as service | ||
:: this file is for configdb database | ||
:: make sure you use forward slash "/" in mongod arguments | ||
|
||
net stop MongoDBconfigdb | ||
mkdir c:\mongodb\data\configdb | ||
c:\mongodb\bin\mongod --remove --serviceName MongoDBconfigdb | ||
c:\mongodb\bin\mongod --bind_ip 127.0.0.1,192.168.10.2 --port 27019 --logpath c:/mongodb/logs/configdb.log --logappend --dbpath c:/mongodb/data/configdb/ --directoryperdb --serviceName MongoDBconfigdb --serviceDisplayName MongoDBconfigdb --install | ||
c:\mongodb\bin\mongod --bind_ip 127.0.0.1 --port 27019 --logpath c:/mongodb/logs/configdb.log --logappend --dbpath c:/mongodb/data/configdb/ --directoryperdb --serviceName MongoDBconfigdb --serviceDisplayName MongoDBconfigdb --install | ||
net start MongoDBconfigdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
:: configdb2.bat ( same as configdb.bat but to be run on the same computer under a different name ) | ||
:: this file is used to Reinstall mongodb as service | ||
:: this file is for configdb2 database | ||
:: make sure you use forward slash "/" in mongod arguments | ||
|
||
net stop MongoDBconfigdb2 | ||
mkdir c:\mongodb\data\configdb2 | ||
c:\mongodb\bin\mongod --remove --serviceName MongoDBconfigdb2 | ||
c:\mongodb\bin\mongod --bind_ip 127.0.0.1,192.168.10.2 --port 27119 --logpath c:/mongodb/logs/configdb2.log --logappend --dbpath c:/mongodb/data/configdb2/ --directoryperdb --serviceName MongoDBconfigdb2 --serviceDisplayName MongoDBconfigdb2 --install | ||
c:\mongodb\bin\mongod --bind_ip 127.0.0.1 --port 27119 --logpath c:/mongodb/logs/configdb2.log --logappend --dbpath c:/mongodb/data/configdb2/ --directoryperdb --serviceName MongoDBconfigdb2 --serviceDisplayName MongoDBconfigdb2 --install | ||
net start MongoDBconfigdb2 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
:: configdb3.bat ( same as configdb.bat but to be run on the same computer under a different name ) | ||
:: this file is used to Reinstall mongodb as service | ||
:: this file is for configdb3 database | ||
:: make sure you use forward slash "/" in mongod arguments | ||
|
||
net stop MongoDBconfigdb3 | ||
mkdir c:\mongodb\data\configdb3 | ||
c:\mongodb\bin\mongod --remove --serviceName MongoDBconfigdb3 | ||
c:\mongodb\bin\mongod --bind_ip 127.0.0.1,192.168.10.2 --port 27219 --logpath c:/mongodb/logs/configdb3.log --logappend --dbpath c:/mongodb/data/configdb3/ --directoryperdb --serviceName MongoDBconfigdb3 --serviceDisplayName MongoDBconfigdb3 --install | ||
c:\mongodb\bin\mongod --bind_ip 127.0.0.1 --port 27219 --logpath c:/mongodb/logs/configdb3.log --logappend --dbpath c:/mongodb/data/configdb3/ --directoryperdb --serviceName MongoDBconfigdb3 --serviceDisplayName MongoDBconfigdb3 --install | ||
net start MongoDBconfigdb3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
::::::::::::::::::::::::::::::::::::::::::::::::::: | ||
:: Contribute to: https://github.com/shimondoodkin/mongodb.co.il/tree/master/basicsetup/ | ||
:: | ||
:: Mongodb Quick Installation Script | ||
:: | ||
:: 1. copy all files from this folder to c:\mongodb\bin\ | ||
:: | ||
:: 2. change ip binding to your likening if required. | ||
:: the ip can be several ips separated by comma | ||
:: in files: | ||
:: s1r1.bat | ||
:: s1r2.bat | ||
:: s1r3.bat | ||
:: configdb.bat | ||
:: configdb2.bat | ||
:: configdb3.bat | ||
:: mongos.bat | ||
:: | ||
:: 3. you can use the computer name | ||
:: or validate your c:\Windows\System32\drivers\etc\hosts file | ||
:: that it contains your hostname as a name not localhost | ||
:: for example: | ||
:: web0 127.0.0.1 | ||
:: | ||
:: 4. change hostname in files: (search and replace web0 with your local hostname) | ||
:: mongos.bat | ||
:: install.bat | ||
:: | ||
:: 5. run install.bat | ||
:: if you have made a mistake you can install.bat file again it will re-register the services | ||
:: | ||
:: 6 Credits | ||
:: Created by Shimon Doodkin (http://doodkin.com) | ||
:: | ||
|
||
echo "start replica set for shard s1" | ||
s1r1.bat | ||
s1r2.bat | ||
s1r3.bat | ||
echo "initiate replica set, can take about 60 seconds" | ||
c:\mongodb\bin\mongo web0:27018/admin --eval "rs.initiate({_id : 's1',members : [ {_id : 0, host : 'web0:27018'}, {_id : 1, host : 'web0:27020'}, {_id : 2, host : 'web0:27021', arbiterOnly:true } ]}).errmsg" | ||
echo "start config databases" | ||
configdb.bat | ||
configdb2.bat | ||
configdb3.bat | ||
echo "start databases router" | ||
mongos.bat | ||
echo "initiate sharding with shard s1" | ||
c:\mongodb\bin\mongo web0:27017/admin --eval "db.runCommand( { addshard : 's1/web0:27018,web0:27020' } ).errmsg" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
Mongodb Quick Installation Script | ||
|
||
1. copy all files from this folder to c:\mongodb\bin\ | ||
|
||
2. change ip binding to your likening if required. | ||
the ip can be several ips separated by comma | ||
in files: | ||
s1r1.bat | ||
s1r2.bat | ||
s1r3.bat | ||
configdb.bat | ||
configdb2.bat | ||
configdb3.bat | ||
mongos.bat | ||
|
||
3. you can use the computer name | ||
or validate your c:\Windows\System32\drivers\etc\hosts file | ||
that it contains your hostname as a name not localhost | ||
for example: | ||
web0 127.0.0.1 | ||
|
||
4. change hostname in files: (search and replace web0 with your local hostname) | ||
mongos.bat | ||
install.bat | ||
|
||
5. run install.bat | ||
if you have made a mistake you can install.bat file again it will re-register the services | ||
|
||
6 Credits | ||
Created by Shimon Doodkin (http://doodkin.com) | ||
|
||
|
||
|
||
Read install.sh | ||
The scripts are simple you can modify it and bend it to your needs quickly. | ||
I wrote it is intentionally in not a not DRY functions fashion | ||
So it will by straight forward. I think you will be able fairly easily | ||
reconstruct this script in to a script of your needs. | ||
|
||
|
||
|
||
plan: | ||
|
||
all hosted on 127.0.0.1 one shard "s1" | ||
|
||
mongod servers replica set "s1": web0:27018,web0:27020,web0:27021 | ||
config servers: web0:27019,web0:27119,web0:27219 | ||
mongos router: web0:27017 | ||
|
||
please note: this script doesn't configure how to shard a database | ||
if you need it later you can do it yourself | ||
|
||
|
||
|
||
snippets: | ||
|
||
net stop mongos | ||
net stop MongoDBconfigdb | ||
net stop MongoDBconfigdb2 | ||
net stop MongoDBconfigdb3 | ||
net stop MongoDBs1r1 | ||
net stop MongoDBs1r2 | ||
net stop MongoDBs1r3 | ||
|
||
net start MongoDBs1r1 | ||
net start MongoDBs1r2 | ||
net start MongoDBs1r3 | ||
net start MongoDBconfigdb | ||
net start MongoDBconfigdb2 | ||
net start MongoDBconfigdb3 | ||
net start mongos | ||
|
||
|
||
|
||
Contribute to: | ||
https://github.com/shimondoodkin/mongodb.co.il/tree/master/basicsetup/ | ||
|
||
Israeli MongoDB website | ||
http://mongodb.co.il |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
:: s1r1.bat (r=replica set) | ||
:: this file is used to Reinstall mongodb as service | ||
:: this file is for s1r1 database | ||
:: make sure you use forward slash "/" in mongod arguments | ||
|
||
net stop MongoDBs1r1 | ||
mkdir c:\mongodb\data\s1r1 | ||
c:\mongodb\bin\mongod --remove --serviceName MongoDBs1r1 | ||
c:\mongodb\bin\mongod --bind_ip 127.0.0.1,192.168.10.2 --port 27018 --logpath c:/mongodb/logs/s1r1.log --logappend --dbpath c:/mongodb/data/s1r1/ --directoryperdb --replSet s1 --serviceName MongoDBs1r1 --serviceDisplayName MongoDBs1r1 --install | ||
c:\mongodb\bin\mongod --bind_ip 127.0.0.1 --port 27018 --logpath c:/mongodb/logs/s1r1.log --logappend --dbpath c:/mongodb/data/s1r1/ --directoryperdb --replSet s1 --serviceName MongoDBs1r1 --serviceDisplayName MongoDBs1r1 --install | ||
net start MongoDBs1r1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
:: s1r2.bat (r=replica set) | ||
:: this file is used to Reinstall mongodb as service | ||
:: this file is for s1r2 database | ||
:: make sure you use forward slash "/" in mongod arguments | ||
|
||
net stop MongoDBs1r2 | ||
mkdir c:\mongodb\data\s1r2 | ||
c:\mongodb\bin\mongod --remove --serviceName MongoDBs1r2 | ||
c:\mongodb\bin\mongod --bind_ip 127.0.0.1,192.168.10.2 --port 27020 --logpath c:/mongodb/logs/s1r2.log --logappend --dbpath c:/mongodb/data/s1r2/ --directoryperdb --replSet s1 --serviceName MongoDBs1r2 --serviceDisplayName MongoDBs1r2 --install | ||
c:\mongodb\bin\mongod --bind_ip 127.0.0.1 --port 27020 --logpath c:/mongodb/logs/s1r2.log --logappend --dbpath c:/mongodb/data/s1r2/ --directoryperdb --replSet s1 --serviceName MongoDBs1r2 --serviceDisplayName MongoDBs1r2 --install | ||
net start MongoDBs1r2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
:: s1r3.bat (r=replica set) | ||
:: this file is used to Reinstall mongodb as service | ||
:: this file is for s1r3 database | ||
:: make sure you use forward slash "/" in mongod arguments | ||
|
||
net stop MongoDBs1r3 | ||
mkdir c:\mongodb\data\s1r3 | ||
c:\mongodb\bin\mongod --remove --serviceName MongoDBs1r3 | ||
c:\mongodb\bin\mongod --bind_ip 127.0.0.1,192.168.10.2 --port 27021 --logpath c:/mongodb/logs/s1r3.log --logappend --dbpath c:/mongodb/data/s1r3/ --directoryperdb --replSet s1 --serviceName MongoDBs1r3 --serviceDisplayName MongoDBs1r3 --install | ||
c:\mongodb\bin\mongod --bind_ip 127.0.0.1 --port 27021 --logpath c:/mongodb/logs/s1r3.log --logappend --dbpath c:/mongodb/data/s1r3/ --directoryperdb --replSet s1 --serviceName MongoDBs1r3 --serviceDisplayName MongoDBs1r3 --install | ||
net start MongoDBs1r3 |