File tree Expand file tree Collapse file tree 7 files changed +29
-23
lines changed Expand file tree Collapse file tree 7 files changed +29
-23
lines changed Original file line number Diff line number Diff line change @@ -5,32 +5,35 @@ services:
5
5
image : mongo
6
6
ports :
7
7
- " 30012:27017"
8
- command : mongod --replSet rs1 --shardsvr --port 27017
8
+ command : mongod --replSet rs1 --shardsvr --port 27017 --nojournal --oplogSize 16 --noprealloc --smallfiles
9
9
restart : always
10
10
11
11
mongo-1-3 :
12
12
container_name : " mongo-1-3"
13
13
image : mongo
14
14
ports :
15
15
- " 30013:27017"
16
- command : mongod --replSet rs1 --shardsvr --port 27017
16
+ command : mongod --replSet rs1 --shardsvr --port 27017 --nojournal --oplogSize 16 --noprealloc --smallfiles
17
17
restart : always
18
18
19
19
mongo-1-1 :
20
20
container_name : " mongo-1-1"
21
21
image : mongo
22
22
ports :
23
23
- " 30011:27017"
24
- command : mongod --replSet rs1 --shardsvr --port 27017
24
+ command : mongod --replSet rs1 --shardsvr --port 27017 --nojournal --oplogSize 16 --noprealloc --smallfiles
25
25
links :
26
26
- mongo-1-2:mongo-1-2
27
27
- mongo-1-3:mongo-1-3
28
28
restart : always
29
29
30
30
mongo-rs1-setup :
31
+ container_name : " mongo-rs1-setup"
31
32
image : mongo
32
33
depends_on :
33
34
- " mongo-1-1"
35
+ - " mongo-1-2"
36
+ - " mongo-1-3"
34
37
links :
35
38
- mongo-1-1:mongo-1-1
36
39
- mongo-1-2:mongo-1-2
Original file line number Diff line number Diff line change @@ -5,32 +5,35 @@ services:
5
5
image : mongo
6
6
ports :
7
7
- " 30042:27017"
8
- command : mongod --replSet rs2 --shardsvr --port 27017
8
+ command : mongod --replSet rs2 --shardsvr --port 27017 --nojournal --oplogSize 16 --noprealloc --smallfiles
9
9
restart : always
10
10
11
11
mongo-2-3 :
12
12
container_name : " mongo-2-3"
13
13
image : mongo
14
14
ports :
15
15
- " 30043:27017"
16
- command : mongod --replSet rs2 --shardsvr --port 27017
16
+ command : mongod --replSet rs2 --shardsvr --port 27017 --nojournal --oplogSize 16 --noprealloc --smallfiles
17
17
restart : always
18
18
19
19
mongo-2-1 :
20
20
container_name : " mongo-2-1"
21
21
image : mongo
22
22
ports :
23
23
- " 30041:27017"
24
- command : mongod --replSet rs2 --shardsvr --port 27017
24
+ command : mongod --replSet rs2 --shardsvr --port 27017 --nojournal --oplogSize 16 --noprealloc --smallfiles
25
25
links :
26
26
- mongo-2-2:mongo-2-2
27
27
- mongo-2-3:mongo-2-3
28
28
restart : always
29
29
30
30
mongo-rs2-setup :
31
+ container_name : " mongo-rs2-setup"
31
32
image : mongo
32
33
depends_on :
33
34
- " mongo-2-1"
35
+ - " mongo-2-2"
36
+ - " mongo-2-3"
34
37
links :
35
38
- mongo-2-1:mongo-2-1
36
39
- mongo-2-2:mongo-2-2
Original file line number Diff line number Diff line change @@ -5,32 +5,35 @@ services:
5
5
image : mongo
6
6
ports :
7
7
- " 30002:27017"
8
- command : mongod --replSet cnf-serv --rest --configsvr --port 27017
8
+ command : mongod --replSet cnf-serv --rest --configsvr --port 27017 --oplogSize 16 --noprealloc --smallfiles
9
9
restart : always
10
10
11
11
mongo-cnf-3 :
12
12
container_name : " mongo-cnf-3"
13
13
image : mongo
14
14
ports :
15
15
- " 30003:27017"
16
- command : mongod --replSet cnf-serv --rest --configsvr --port 27017
16
+ command : mongod --replSet cnf-serv --rest --configsvr --port 27017 --oplogSize 16 --noprealloc --smallfiles
17
17
restart : always
18
18
19
19
mongo-cnf-1 :
20
20
container_name : " mongo-cnf-1"
21
21
image : mongo
22
22
ports :
23
23
- " 30001:27017"
24
- command : mongod --replSet cnf-serv --rest --configsvr --port 27017
24
+ command : mongod --replSet cnf-serv --rest --configsvr --port 27017 --oplogSize 16 --noprealloc --smallfiles
25
25
links :
26
26
- mongo-cnf-2:mongo-cnf-2
27
27
- mongo-cnf-3:mongo-cnf-3
28
28
restart : always
29
29
30
30
mongo-cnf-setup :
31
+ container_name : " mongo-cnf-setup"
31
32
image : mongo
32
33
depends_on :
33
34
- " mongo-cnf-1"
35
+ - " mongo-cnf-2"
36
+ - " mongo-cnf-3"
34
37
links :
35
38
- mongo-cnf-1:mongo-cnf-1
36
39
- mongo-cnf-2:mongo-cnf-2
@@ -43,4 +46,4 @@ services:
43
46
- MONGO3=mongo-cnf-3
44
47
- RS=cnf-serv
45
48
- PORT=27017
46
- entrypoint : [ "/scripts/setup_cnf .sh" ]
49
+ entrypoint : [ "/scripts/setup-cnf .sh" ]
Original file line number Diff line number Diff line change @@ -6,9 +6,9 @@ services:
6
6
ports :
7
7
- " 30031:27017"
8
8
depends_on :
9
- - " mongo-cnf-1 "
10
- - " mongo-1-1 "
11
- - " mongo-2-1 "
9
+ - " mongo-rs1-setup "
10
+ - " mongo-rs2-setup "
11
+ - " mongo-cnf-setup "
12
12
links :
13
13
- mongo-cnf-1:mongo-cnf-1
14
14
- mongo-cnf-2:mongo-cnf-2
@@ -23,6 +23,7 @@ services:
23
23
restart : always
24
24
25
25
mongo-shard-setup :
26
+ container_name : " mongo-shard-setup"
26
27
image : mongo
27
28
depends_on :
28
29
- " mongo-router"
@@ -44,5 +45,5 @@ services:
44
45
- PORT1=27017
45
46
- PORT2=27017
46
47
- PORT3=27017
47
- entrypoint : [ "/scripts/init_shard .sh" ]
48
+ entrypoint : [ "/scripts/init-shard .sh" ]
48
49
restart : on-failure:20
Original file line number Diff line number Diff line change @@ -10,19 +10,17 @@ mongodb21=`ping -c 1 ${MONGO21} | head -1 | cut -d "(" -f 2 | cut -d ")" -f 1`
10
10
mongodb22=` ping -c 1 ${MONGO22} | head -1 | cut -d " (" -f 2 | cut -d " )" -f 1`
11
11
mongodb23=` ping -c 1 ${MONGO23} | head -1 | cut -d " (" -f 2 | cut -d " )" -f 1`
12
12
13
-
14
13
port=${PORT:- 27017}
15
14
16
15
echo " Waiting for startup.."
17
- until curl http:// ${mongodb1} :${port} /serverStatus \? text \= 1 2>&1 | grep uptime | head -1 ; do
16
+ until mongo --host ${mongodb1} :${port} --eval ' quit(db.runCommand({ ping: 1 }).ok ? 0 : 2) ' & > /dev/null ; do
18
17
printf ' .'
19
18
sleep 1
20
19
done
21
20
22
- echo curl http://${mongodb1} :${port} /serverStatus\? text\= 1 2>&1 | grep uptime | head -1
23
21
echo " Started.."
24
22
25
- echo setup .sh time now: ` date +" %T" `
23
+ echo init-shard .sh time now: ` date +" %T" `
26
24
mongo --host ${mongodb1} :${port} << EOF
27
25
sh.addShard( "${RS1} /${mongodb11} :${PORT1} ,${mongodb12} :${PORT2} ,${mongodb13} :${PORT3} " );
28
26
sh.addShard( "${RS2} /${mongodb21} :${PORT1} ,${mongodb22} :${PORT2} ,${mongodb23} :${PORT3} " );
Original file line number Diff line number Diff line change @@ -7,15 +7,14 @@ mongodb3=`ping -c 1 ${MONGO3} | head -1 | cut -d "(" -f 2 | cut -d ")" -f 1`
7
7
port=${PORT:- 27017}
8
8
9
9
echo " Waiting for startup.."
10
- until curl http:// ${mongodb1} :${port} /serverStatus \? text \= 1 2>&1 | grep uptime | head -1 ; do
10
+ until mongo --host ${mongodb1} :${port} --eval ' quit(db.runCommand({ ping: 1 }).ok ? 0 : 2) ' & > /dev/null ; do
11
11
printf ' .'
12
12
sleep 1
13
13
done
14
14
15
- echo curl http://${mongodb1} :${port} /serverStatus\? text\= 1 2>&1 | grep uptime | head -1
16
15
echo " Started.."
17
16
18
- echo setup.sh time now: ` date +" %T" `
17
+ echo setup-cnf .sh time now: ` date +" %T" `
19
18
mongo --host ${mongodb1} :${port} << EOF
20
19
var cfg = {
21
20
"_id": "${RS} ",
Original file line number Diff line number Diff line change @@ -7,12 +7,11 @@ mongodb3=`ping -c 1 ${MONGO3} | head -1 | cut -d "(" -f 2 | cut -d ")" -f 1`
7
7
port=${PORT:- 27017}
8
8
9
9
echo " Waiting for startup.."
10
- until curl http:// ${mongodb1} :${port} /serverStatus \? text \= 1 2>&1 | grep uptime | head -1 ; do
10
+ until mongo --host ${mongodb1} :${port} --eval ' quit(db.runCommand({ ping: 1 }).ok ? 0 : 2) ' & > /dev/null ; do
11
11
printf ' .'
12
12
sleep 1
13
13
done
14
14
15
- echo curl http://${mongodb1} :${port} /serverStatus\? text\= 1 2>&1 | grep uptime | head -1
16
15
echo " Started.."
17
16
18
17
echo setup.sh time now: ` date +" %T" `
You can’t perform that action at this time.
0 commit comments