Support embeddedcrs#913
Open
renatoriccio wants to merge 4 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for MongoDB “embedded config server replica set” (embedded CSRS) mode in mlaunch init, including a new CLI flag and related runtime/listing behavior, plus macOS-specific process launching adjustments.
Changes:
- Add
--embeddedcsrsflag and init-time logic to size config members and adjust shard count for embedded-CSRS topologies. - Run
transitionFromDedicatedConfigServerduring sharded init when embedded-CSRS is enabled. - Update
list()output labeling for config nodes, and adjust macOS process launching (nohup+ backgrounding).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+293
to
296
| init_parser.add_argument('--config', action='store', default=-1, | ||
| type=int, metavar='NUM', | ||
| help=('adds NUM config servers to sharded ' | ||
| 'setup (requires --sharded, default=1)')) |
Comment on lines
+683
to
+686
| # Check if embedded is used, if it's the case the number of shards should be decremented by 1 | ||
| if self.args['embeddedcsrs'] and 'sharded' in self.args and self.args['sharded']: | ||
| if len(self.args['sharded']) == 1: | ||
| self.args['sharded'][0] = str(int(self.args['sharded'][0]) - 1) |
Comment on lines
+812
to
+815
| if self.args['embeddedcsrs']: | ||
| print("Configuring embedded config servers") | ||
| con = self.client('localhost:%i' % mongos[0]) | ||
| con.admin.command({'transitionFromDedicatedConfigServer': 1}) |
Comment on lines
+1054
to
+1058
| # temporary list used to find the list of running nodes | ||
| tmp_config_list = [] | ||
| string_config = "config server" | ||
| for node in sorted(self.get_tagged(['config'])): | ||
| doc = OrderedDict([('process', 'config server'), | ||
| if self.cluster_running[node]: |
Comment on lines
+2178
to
+2183
| if sys.platform == 'darwin': | ||
| command_str = ("nohup \"%s\" %s --dbpath \"%s\" --logpath \"%s\" " | ||
| "--port %i" | ||
| "%s %s >/dev/null &" % (os.path.join(path, 'mongod'), rs_param, | ||
| dbpath, logpath, port, auth_param, | ||
| extra)) |
Comment on lines
+2244
to
+2252
| mongos = sorted(self.get_tagged(['mongos'])) | ||
| con = self.client('localhost:%i' % mongos[0], readPreference="primaryPreferred") | ||
| try: | ||
| if con['config']['shards'].find_one({ '_id': 'config' }): | ||
| return True | ||
| return False | ||
| except OperationFailure: | ||
| print("WARNING: Unable to check if config server is embedded") | ||
| return False |
Comment on lines
+298
to
+299
| init_parser.add_argument('--embeddedcsrs', default=False, action='store_true', | ||
| help=('use embedded CSRS (only for MongoDB 8.0.0+), default=False')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes
Support Embedded config servers
Usage:
`
Will start 1 config server/shard + 1 shard
./mlaunch.py init --sharded=2 --embeddedcsrs --replicaset --node 1
Will start 1 config server/shard
./mlaunch.py init --sharded=1 --embeddedcsrs --replicaset --node 1
`