mirror of
https://github.com/btdig/dhtcrawler2.git
synced 2024-12-12 19:46:22 +00:00
add database repl-set scripts
This commit is contained in:
parent
2d4d3f89a7
commit
ea6df3b2df
@ -13,4 +13,7 @@ copy tools\*.* bin\
|
||||
mkdir bin\priv
|
||||
mkdir bin\ebin
|
||||
copy ebin\*.* bin\ebin\
|
||||
mkdir bin\tools
|
||||
mkdir bin\tools\db-replset
|
||||
copy tools\db-replset\*.* bin\tools\db-replset\
|
||||
pause
|
||||
|
10
tools/db-replset/README.md
Normal file
10
tools/db-replset/README.md
Normal file
@ -0,0 +1,10 @@
|
||||
The scripts in this directory can help you to deply a repl set mongodb, which there is a primary database used by the crawler, and the secondary database is used to query by the http server.
|
||||
|
||||
[Check here if you know Chinese](http://www.cnblogs.com/dennisit/archive/2013/01/28/2880166.html)
|
||||
|
||||
Make sure mongod is in your path.
|
||||
|
||||
* db-start-primary.bat
|
||||
* db-start-slave.bat
|
||||
* init-primary-db.bat, make sure `rs.initiate()` success
|
||||
|
1
tools/db-replset/db-start-primary.bat
Normal file
1
tools/db-replset/db-start-primary.bat
Normal file
@ -0,0 +1 @@
|
||||
mongod --replSet rs1 --keyFile key1.txt --port 27010 --dbpath db --setParameter textSearchEnabled=true --logappend --logpath db-primary.log --pologSize
|
2
tools/db-replset/db-start-slave.bat
Normal file
2
tools/db-replset/db-start-slave.bat
Normal file
@ -0,0 +1,2 @@
|
||||
mongod --replSet rs1 --keyFile key2.txt --port 27017 --dbpath dbread --setParameter textSearchEnabled=true --logappend --logpath db-slave.log --pologSize
|
||||
|
2
tools/db-replset/init-primary-db.bat
Normal file
2
tools/db-replset/init-primary-db.bat
Normal file
@ -0,0 +1,2 @@
|
||||
mongo --port 27010 init-rs.js
|
||||
pause
|
6
tools/db-replset/init-rs.js
Normal file
6
tools/db-replset/init-rs.js
Normal file
@ -0,0 +1,6 @@
|
||||
config_rs1 = {
|
||||
_id : "rs1",
|
||||
members : [ { _id:0, host:"localhost:27010", priority:1 }, { _id:1, host:"localhost:27017" } ]
|
||||
};
|
||||
rs.initiate(config_rs1);
|
||||
|
1
tools/db-replset/key1.txt
Normal file
1
tools/db-replset/key1.txt
Normal file
@ -0,0 +1 @@
|
||||
4C3B4CF8CC58F6755BBE3B6FB073145958A67B6E
|
1
tools/db-replset/key2.txt
Normal file
1
tools/db-replset/key2.txt
Normal file
@ -0,0 +1 @@
|
||||
4C3B4CF8CC58F6755BBE3B6FB073145958A67B6E
|
Loading…
Reference in New Issue
Block a user