Skip to content

Commit 0e2d982

Browse files
committed
Merge branch 'release/1.0.0'
2 parents e76ca3a + 456d353 commit 0e2d982

File tree

7 files changed

+29
-23
lines changed

7 files changed

+29
-23
lines changed

docker-compose.1.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,35 @@ services:
55
image: mongo
66
ports:
77
- "30012:27017"
8-
command: mongod --replSet rs1 --shardsvr --port 27017
8+
command: mongod --replSet rs1 --shardsvr --port 27017 --nojournal --oplogSize 16 --noprealloc --smallfiles
99
restart: always
1010

1111
mongo-1-3:
1212
container_name: "mongo-1-3"
1313
image: mongo
1414
ports:
1515
- "30013:27017"
16-
command: mongod --replSet rs1 --shardsvr --port 27017
16+
command: mongod --replSet rs1 --shardsvr --port 27017 --nojournal --oplogSize 16 --noprealloc --smallfiles
1717
restart: always
1818

1919
mongo-1-1:
2020
container_name: "mongo-1-1"
2121
image: mongo
2222
ports:
2323
- "30011:27017"
24-
command: mongod --replSet rs1 --shardsvr --port 27017
24+
command: mongod --replSet rs1 --shardsvr --port 27017 --nojournal --oplogSize 16 --noprealloc --smallfiles
2525
links:
2626
- mongo-1-2:mongo-1-2
2727
- mongo-1-3:mongo-1-3
2828
restart: always
2929

3030
mongo-rs1-setup:
31+
container_name: "mongo-rs1-setup"
3132
image: mongo
3233
depends_on:
3334
- "mongo-1-1"
35+
- "mongo-1-2"
36+
- "mongo-1-3"
3437
links:
3538
- mongo-1-1:mongo-1-1
3639
- mongo-1-2:mongo-1-2

docker-compose.2.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,35 @@ services:
55
image: mongo
66
ports:
77
- "30042:27017"
8-
command: mongod --replSet rs2 --shardsvr --port 27017
8+
command: mongod --replSet rs2 --shardsvr --port 27017 --nojournal --oplogSize 16 --noprealloc --smallfiles
99
restart: always
1010

1111
mongo-2-3:
1212
container_name: "mongo-2-3"
1313
image: mongo
1414
ports:
1515
- "30043:27017"
16-
command: mongod --replSet rs2 --shardsvr --port 27017
16+
command: mongod --replSet rs2 --shardsvr --port 27017 --nojournal --oplogSize 16 --noprealloc --smallfiles
1717
restart: always
1818

1919
mongo-2-1:
2020
container_name: "mongo-2-1"
2121
image: mongo
2222
ports:
2323
- "30041:27017"
24-
command: mongod --replSet rs2 --shardsvr --port 27017
24+
command: mongod --replSet rs2 --shardsvr --port 27017 --nojournal --oplogSize 16 --noprealloc --smallfiles
2525
links:
2626
- mongo-2-2:mongo-2-2
2727
- mongo-2-3:mongo-2-3
2828
restart: always
2929

3030
mongo-rs2-setup:
31+
container_name: "mongo-rs2-setup"
3132
image: mongo
3233
depends_on:
3334
- "mongo-2-1"
35+
- "mongo-2-2"
36+
- "mongo-2-3"
3437
links:
3538
- mongo-2-1:mongo-2-1
3639
- mongo-2-2:mongo-2-2

docker-compose.cnf.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,35 @@ services:
55
image: mongo
66
ports:
77
- "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
99
restart: always
1010

1111
mongo-cnf-3:
1212
container_name: "mongo-cnf-3"
1313
image: mongo
1414
ports:
1515
- "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
1717
restart: always
1818

1919
mongo-cnf-1:
2020
container_name: "mongo-cnf-1"
2121
image: mongo
2222
ports:
2323
- "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
2525
links:
2626
- mongo-cnf-2:mongo-cnf-2
2727
- mongo-cnf-3:mongo-cnf-3
2828
restart: always
2929

3030
mongo-cnf-setup:
31+
container_name: "mongo-cnf-setup"
3132
image: mongo
3233
depends_on:
3334
- "mongo-cnf-1"
35+
- "mongo-cnf-2"
36+
- "mongo-cnf-3"
3437
links:
3538
- mongo-cnf-1:mongo-cnf-1
3639
- mongo-cnf-2:mongo-cnf-2
@@ -43,4 +46,4 @@ services:
4346
- MONGO3=mongo-cnf-3
4447
- RS=cnf-serv
4548
- PORT=27017
46-
entrypoint: [ "/scripts/setup_cnf.sh" ]
49+
entrypoint: [ "/scripts/setup-cnf.sh" ]

docker-compose.shard.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ services:
66
ports:
77
- "30031:27017"
88
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"
1212
links:
1313
- mongo-cnf-1:mongo-cnf-1
1414
- mongo-cnf-2:mongo-cnf-2
@@ -23,6 +23,7 @@ services:
2323
restart: always
2424

2525
mongo-shard-setup:
26+
container_name: "mongo-shard-setup"
2627
image: mongo
2728
depends_on:
2829
- "mongo-router"
@@ -44,5 +45,5 @@ services:
4445
- PORT1=27017
4546
- PORT2=27017
4647
- PORT3=27017
47-
entrypoint: [ "/scripts/init_shard.sh" ]
48+
entrypoint: [ "/scripts/init-shard.sh" ]
4849
restart: on-failure:20

scripts/init_shard.sh renamed to scripts/init-shard.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,17 @@ mongodb21=`ping -c 1 ${MONGO21} | head -1 | cut -d "(" -f 2 | cut -d ")" -f 1`
1010
mongodb22=`ping -c 1 ${MONGO22} | head -1 | cut -d "(" -f 2 | cut -d ")" -f 1`
1111
mongodb23=`ping -c 1 ${MONGO23} | head -1 | cut -d "(" -f 2 | cut -d ")" -f 1`
1212

13-
1413
port=${PORT:-27017}
1514

1615
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
1817
printf '.'
1918
sleep 1
2019
done
2120

22-
echo curl http://${mongodb1}:${port}/serverStatus\?text\=1 2>&1 | grep uptime | head -1
2321
echo "Started.."
2422

25-
echo setup.sh time now: `date +"%T" `
23+
echo init-shard.sh time now: `date +"%T" `
2624
mongo --host ${mongodb1}:${port} <<EOF
2725
sh.addShard( "${RS1}/${mongodb11}:${PORT1},${mongodb12}:${PORT2},${mongodb13}:${PORT3}" );
2826
sh.addShard( "${RS2}/${mongodb21}:${PORT1},${mongodb22}:${PORT2},${mongodb23}:${PORT3}" );

scripts/setup_cnf.sh renamed to scripts/setup-cnf.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@ mongodb3=`ping -c 1 ${MONGO3} | head -1 | cut -d "(" -f 2 | cut -d ")" -f 1`
77
port=${PORT:-27017}
88

99
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
1111
printf '.'
1212
sleep 1
1313
done
1414

15-
echo curl http://${mongodb1}:${port}/serverStatus\?text\=1 2>&1 | grep uptime | head -1
1615
echo "Started.."
1716

18-
echo setup.sh time now: `date +"%T" `
17+
echo setup-cnf.sh time now: `date +"%T" `
1918
mongo --host ${mongodb1}:${port} <<EOF
2019
var cfg = {
2120
"_id": "${RS}",

scripts/setup.sh

100644100755
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ mongodb3=`ping -c 1 ${MONGO3} | head -1 | cut -d "(" -f 2 | cut -d ")" -f 1`
77
port=${PORT:-27017}
88

99
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
1111
printf '.'
1212
sleep 1
1313
done
1414

15-
echo curl http://${mongodb1}:${port}/serverStatus\?text\=1 2>&1 | grep uptime | head -1
1615
echo "Started.."
1716

1817
echo setup.sh time now: `date +"%T" `

0 commit comments

Comments
 (0)