Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing mongod-only server parameters through mlaunch #696

Open
p-mongo opened this issue Jun 14, 2019 · 6 comments
Open

Passing mongod-only server parameters through mlaunch #696

p-mongo opened this issue Jun 14, 2019 · 6 comments

Comments

@p-mongo
Copy link
Contributor

p-mongo commented Jun 14, 2019

I tried passing --setParameter transactionLifetimeLimitSeconds=15 to my sharded cluster via mlaunch. mlaunch failed thusly:

+ mlaunch --replicaset --nodes 2 --sharded 2 --name ruby-driver-rs --mongos 2 --dir /mnt/zram/mongodb/4.1-scm --setParameter ttlMonitorEnabled=false --wiredTigerEngineConfigString 'log=(prealloc=false,file_max=20MB)' --setParameter transactionLifetimeLimitSeconds=15 --wiredTigerCacheSizeGB 0.25 --setParameter enableTestCommands=1 --setParameter diagnosticDataCollectionEnabled=false --filePermissions 0666 --binarypath /usr/local/m/versions/4.1 --port 27570
warning: ignoring unknown argument --wiredTigerEngineConfigString for /usr/local/m/versions/4.1/mongos
launching: config server on port 27576
launching: "/usr/local/m/versions/4.1/mongod" on port 27572
launching: "/usr/local/m/versions/4.1/mongod" on port 27573
launching: "/usr/local/m/versions/4.1/mongod" on port 27574
launching: "/usr/local/m/versions/4.1/mongod" on port 27575
replica set 'configRepl' initialized.
replica set 'shard01' initialized.
replica set 'shard02' initialized.
BadValue: Illegal --setParameter parameter: "transactionLifetimeLimitSeconds"
try '/usr/local/m/versions/4.1/mongos --help' for more information


can't start process, return code 2. tried to launch: /usr/local/m/versions/4.1/mongos --logpath "/mnt/zram/mongodb/4.1-scm/mongos/mongos_27570.log" --port 27570 --configdb configRepl/localhost:27576  --setParameter ttlMonitorEnabled=false --setParameter transactionLifetimeLimitSeconds=15 --setParameter enableTestCommands=1 --setParameter diagnosticDataCollectionEnabled=false --filePermissions 0666  --fork

I filed https://jira.mongodb.org/browse/DOCS-12806 for this issue, but on the server parameter reference page (https://docs.mongodb.com/manual/reference/parameters/#param.transactionLifetimeLimitSeconds) there is, for example, maxTransactionLockRequestTimeoutMillis (https://docs.mongodb.com/manual/reference/parameters/#param.maxTransactionLockRequestTimeoutMillis) which is documented as being available for mongod only.

How does one pass parameters which are only recognized by mongod or mongos through mlaunch, without mlaunch giving them to the other binary which does not recognize them?

@stennie
Copy link
Collaborator

stennie commented Jun 15, 2019

How does one pass parameters which are only recognized by mongod or mongos through mlaunch, without mlaunch giving them to the other binary which does not recognize them?

mlaunch currently doesn't have an option to choose which binary any extra parameters are destined for. Both mongod and mongos accept --setParameter with different values, and we don't want to hardcode the list of known values.

Two possible workarounds would be:

  • Set parameters at runtime on the mongod with db.adminCommand( { setParameter: ... }).
  • Edit the startup_info section of the .mlaunch_startup JSON file which is generated in the base directory and then mlaunch start (or restart) to apply these changes.

We could perhaps something like --setParameterMongod and setParameterMongos to target parameters to the appropriate binary. Does that sound reasonable?

Cheers,
Stennie

@p-mongo
Copy link
Contributor Author

p-mongo commented Jun 16, 2019

If the goal of mlaunch is to encapsulate cluster provisioning logic, then having --setParameterMongod and setParameterMongos makes a lot of sense.

With adminCommand, from https://docs.mongodb.com/manual/reference/command/setParameter/ it is not clear which instances I need to execute it in if I have a deployment with 2 mongos and 3 replica set nodes behind each mongos. Do I need to run adminCommand one on each mongos (and then it would work even though --setParameter did not?), one on each RS master (bypassing mongos somehow?) or one on each mongod (6 calls in total)?

@stennie
Copy link
Collaborator

stennie commented Jun 20, 2019

I don't believe the setParameter admin command is replicated -- this is generally to change settings per instance. I expect the minimum would be setting on the current primaries, with the correct option being to set on all mongod processes to allow for election. Will test to confirm.

Another way to approach UX might be using the tags in mlaunch which already identify instances as mongod or mongos. Perhaps syntax like mlaunch eval --tags mongod "<script>" to run some JS on matching instances via mongo --eval.

@p-mongo
Copy link
Contributor Author

p-mongo commented Jul 2, 2019

Yes, if the user needs to do that many manual invocations, having mlaunch assist will definitely be appreciated.

@stennie stennie modified the milestones: 1.6.1, 1.6.2 Dec 29, 2019
@stennie stennie modified the milestones: 1.6.2, 1.6.3 Feb 4, 2020
@stennie stennie removed this from the 1.6.3 milestone Feb 11, 2020
@p-mongo
Copy link
Contributor Author

p-mongo commented Feb 26, 2020

Per the current documentation at https://docs.mongodb.com/manual/reference/parameters/#param.diagnosticDataCollectionEnabled, diagnosticDataCollectionEnabled can be passed to both mongod and mongos as of server 3.4, mitigating the issue.

@stennie stennie modified the milestone: 1.7.0 Oct 14, 2020
@devkev
Copy link
Contributor

devkev commented Nov 11, 2020

I recently encountered the need to pass --setParameter disableResumableRangeDeleter=true to mongod processes. Since this is a startup-only parameter, the setParameter admin command workaround isn't possible. Editing the .mlaunch_startup file would have been difficult (not to mention inelegant) because mlaunch is being called as part of a wider testing script.

In the absence of a --setParameterMongod parameter for mlaunch, I came up with another workaround, which is to create a temporary bin directory, which I then pass to mlaunch --binarypath. Inside the temporary bin there is a mongos symlink to the real mongos binary, and this simple mongod wrapper script:

#!/bin/sh
exec /real/path/to/mongod --setParameter disableResumableRangeDeleter=true "$@"

This works nicely for this simple case. If more advanced choices are required, then a utility like shwrapnel might be useful.

@stennie stennie added this to the 1.7.0 milestone Nov 12, 2020
@stennie stennie removed this from the 1.7.0 milestone Nov 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants