Skip to content

Commit c0506b1

Browse files
authored
docs(NODE-5730): update load balancer docs (#3910)
1 parent b602162 commit c0506b1

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

test/readme.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,33 @@ The following steps will walk you through how to start and test a load balancer.
284284
```
285285

286286
Create two mongoses running on ports 27017 and 27018:
287-
`mongos --configdb test/localhost:27217 --bind_ip localhost --setParameter enableTestCommands=1 --setParameter featureFlagLoadBalancer=true --setParameter loadBalancerPort=27050`
288-
`mongos --configdb test/localhost:27217 --port 27018 --bind_ip localhost --setParameter enableTestCommands=1 --setParameter featureFlagLoadBalancer=true --setParameter loadBalancerPort=27051`.
287+
`mongos --configdb test/localhost:27217 --bind_ip localhost --setParameter enableTestCommands=1 --setParameter --setParameter loadBalancerPort=27050`
288+
`mongos --configdb test/localhost:27217 --port 27018 --bind_ip localhost --setParameter enableTestCommands=1 --setParameter --setParameter loadBalancerPort=27051`.
289289

290290
Initiate cluster on mongos in shell:
291291
```shell
292292
mongosh "mongodb://localhost:27017" --eval "sh.addShard('testing/localhost:27218,localhost:27219,localhost:27220')"
293293
mongosh "mongodb://localhost:27017" --eval "sh.enableSharding('test')"
294294
```
295+
1. An alternative way to the fully manual cluster setup is to use `mlaunch`:
296+
Initialize the sharded cluster via `mlaunch` in a new empty directory:
297+
```shell
298+
mlaunch init --dir data --ipv6 --replicaset --nodes 2 --port 51000 --name testing --setParameter enableTestCommands=1 --sharded 1 --mongos 2
299+
```
300+
301+
`mlaunch` will then start up the sharded cluster. Once it finishes, stop the cluster:
302+
```shell
303+
mlaunch stop
304+
```
305+
306+
When `mlaunch` has stopped the cluster, navigate to the `data` directory and edit the `.mlaunch_startup` file:
307+
- Add `--setParameter \"loadBalancerPort=27050\"` to the first mongos configuration at the bottom of the file.
308+
- Add `--setParameter \"loadBalancerPort=27051\"` to the second mongos configuration at the bottom of the file.
309+
310+
Navigate back up to the root directory where `mlaunch` was initialized and restart:
311+
```shell
312+
mlaunch start
313+
```
295314

296315
1. Create an environment variable named `MONGODB_URI` that stores the URI of the sharded cluster you just created. For example: `export MONGODB_URI="mongodb://host1,host2/"`
297316
1. Install the HAProxy load balancer. For those on macOS, you can install HAProxy with `brew install haproxy`.

0 commit comments

Comments
 (0)