File: cluster_setup.sh

package info (click to toggle)
node-mongodb 3.6.4%2B~cs11.13.19-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 76,604 kB
  • sloc: javascript: 138,083; python: 429; sh: 52; makefile: 37
file content (19 lines) | stat: -rwxr-xr-x 773 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash

if [ "$#" -ne 1 ]; then
    echo "usage: cluster_setup <server|replica_set|sharded_cluster>"
    exit
fi

if [[ $1 == "replica_set" ]]; then
    mlaunch init --replicaset --nodes 3 --arbiter --name rs --port 31000 --enableMajorityReadConcern --setParameter enableTestCommands=1
    echo "mongodb://localhost:31000/?replicaSet=rs"
elif [[ $1 == "sharded_cluster" ]]; then
    mlaunch init --replicaset --nodes 3 --arbiter --name rs --port 51000 --enableMajorityReadConcern --setParameter enableTestCommands=1 --sharded 1 --mongos 2
    echo "mongodb://localhost:51000,localhost:51001/"
elif [[ $1 == "server" ]]; then
    mlaunch init --single --setParameter enableTestCommands=1
    echo "mongodb://localhost:27017"
else
    echo "unsupported topology: $1"
fi