mongod
and mongos
accept --outputConfig
command-line option to output the configuration used by the mongod
/ mongos
instance.
You can use this option to convert command-line options to YAML configuration.
Consider the following mongod
invocation that uses the command-line options:
mongod --shardsvr --replSet myShard --dbpath /var/lib/mongodb --bind_ip localhost,My-Example-Hostname --fork --logpath /var/log/mongodb/mongod.log --clusterAuthMode x509 --tlsMode requireTLS --tlsCAFile /path/to/my/CA/file --tlsCertificateKeyFile /path/to/my/certificate/file --tlsClusterFile /path/to/my/cluster/membership/file
Include the --outputConfig
command-line option to generate the corresponding YAML file.
mongod --shardsvr --replSet myShard --dbpath /var/lib/mongodb --bind_ip localhost,My-Example-Hostname --fork --logpath /var/log/mongodb/mongod.log --clusterAuthMode x509 --tlsMode requireTLS --tlsCAFile /path/to/my/CA/file --tlsCertificateKeyFile /path/to/my/certificate/file --tlsClusterFile /path/to/my/cluster/membership/file --outputConfig
The mongod
outputs the following YAML to stdout
and exits:
net: bindIp: localhost,My-Example-Hostname tls: CAFile: /path/to/my/CA/file certificateKeyFile: /path/to/my/certificate/file clusterFile: /path/to/my/cluster/membership/file mode: requireTLSoutputConfig: trueprocessManagement: fork: truereplication: replSet: myShardsecurity: clusterAuthMode: x509sharding: clusterRole: shardsvrstorage: dbPath: /var/lib/mongodbsystemLog: destination: file path: /var/log/mongodb/mongod.log
To create a configuration file, copy the generated content into a file and delete the outputConfig
setting from the YAML.
Consider the following mongos
invocation that uses the command-line options:
mongos --configdb myCSRS/cfg1.example.net:27019,cfg2.example.net:27019 --bind_ip localhost,My-Example-MONGOS-Hostname --fork --logpath /var/log/mongodb/mongos.log --clusterAuthMode x509 --tlsMode requireTLS --tlsCAFile /path/to/my/CA/file --tlsCertificateKeyFile /path/to/my/certificate/file --tlsClusterFile /path/to/my/cluster/membership/file
Include the --outputConfig
command-line option to generate the corresponding YAML for the mongos
instance:
mongos --configdb myCSRS/cfg1.example.net:27019,cfg2.example.net:27019 --bind_ip localhost,My-Example-MONGOS-Hostname --fork --logpath /var/log/mongodb/mongos.log --clusterAuthMode x509 --tlsMode requireTLS --tlsCAFile /path/to/my/CA/file --tlsCertificateKeyFile /path/to/my/certificate/file --tlsClusterFile /path/to/my/cluster/membership/file --outputConfig
The mongos
outputs the following YAML to stdout
and exits:
net: bindIp: localhost,My-Example-MONGOS-Hostname tls: CAFile: /path/to/my/CA/file certificateKeyFile: /path/to/my/certificate/file clusterFile: /path/to/my/cluster/membership/file mode: requireTLSoutputConfig: trueprocessManagement: fork: truesecurity: clusterAuthMode: x509sharding: configDB: myCSRS/cfg1.example.net:27019,cfg2.example.net:27019systemLog: destination: file path: /var/log/mongodb/mongos.log
To create a configuration file, copy the generated content into a file and delete the outputConfig
setting from the YAML.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4