Skip to main content
This small script allow a host to join a remove MongoDB RS.

It connects to the RS and run the correct command to integrate the new host into it.

It support hidden hosts and custom priority.

You first have to make sure that the new host has correct configuration (Authentication, keyfile, etc.)

Here is an example of run :

PS C:\Users\mathieu.poussin\Desktop> mongo_join_rs --connection-string "mongodb://admin:admin@10.75.50.40,10.74.50.50,10.75.50.51/admin" --ssl --hostname 10.10.0.66 --priority 0.0 --hidden
[2016-12-19 16:38:30.637167] INFO: JoinRs: Connecting to existing RS
[2016-12-19 16:38:30.638168] INFO: JoinRs: Connected !
[2016-12-19 16:38:30.638668] INFO: JoinRs: Determinating ID for the new host
[2016-12-19 16:38:31.511956] INFO: JoinRs: Current RS configuration:
{'_id': 'myRs',
'members': [{'_id': 0,
'arbiterOnly': False,
'buildIndexes': True,
'hidden': False,
'host': 'gc-xxx-live-1:27017',
'priority': 1.0,
'slaveDelay': 0,
'tags': {},
'votes': 1},
{'_id': 1,
'arbiterOnly': False,
'buildIndexes': True,
'hidden': False,
'host': 'gc-xxx-live-2:27017',
'priority': 1.0,
'slaveDelay': 0,
'tags': {},
'votes': 1},
{'_id': 2,
'arbiterOnly': False,
'buildIndexes': True,
'hidden': False,
'host': 'gc-xxx-live-3:27017',
'priority': 1.0,
'slaveDelay': 0,
'tags': {},
'votes': 1},
{'_id': 3,
'arbiterOnly': False,
'buildIndexes': True,
'hidden': True,
'host': 'gc-lab-xxx-1:27017',
'priority': 0.0,
'slaveDelay': 0,
'tags': {},
'votes': 1}],
'protocolVersion': 1,
'settings': {'catchUpTimeoutMillis': 2000,
'chainingAllowed': True,
'electionTimeoutMillis': 10000,
'getLastErrorDefaults': {'w': 1, 'wtimeout': 0},
'getLastErrorModes': {},
'heartbeatIntervalMillis': 2000,
'heartbeatTimeoutSecs': 10,
'replicaSetId': ObjectId('xxx')},
'version': 9}
[2016-12-19 16:38:31.555702] INFO: JoinRs: Last ID is [3], Next ID will be [4]
[2016-12-19 16:38:31.556565] INFO: JoinRs: Joining RS
[2016-12-19 16:38:31.999751] INFO: JoinRs: Done!

I can also be used with "--leave" to leave the RS instead of joining it.

Release files for mongo-join-rs 0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mongo-join-rs 0.3
File Size Uploaded
mongo-join-rs-0.3.tar.gz 3.1 kB Details

Release files / mongo-join-rs-0.3.tar.gz

Download URL mongo-join-rs-0.3.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b07b0d7830479f38772c5979cf445eb899d39e8e7206b19114aebae745e69adb
BLAKE2b-256 checksum
How to use checksums
f9479dab0a038a7323b29729cc4cbccda7d4a8f0d55989a948f8f823eac7f451
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.3 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page