Modify MongoDB Settings
ServBay comes with a built-in MongoDB database and offers flexible configuration options. This article will explain in detail how to modify MongoDB settings in ServBay, including the location of the configuration files and common configuration items. Depending on the MongoDB version, these files are located in the /Applications/ServBay/etc/mongodb/<version>
directory. For example, the configuration file for MongoDB 8.0 is in the /Applications/ServBay/etc/mongodb/8.0
directory.
Important Note
Please do not manually modify the configuration files. All configuration files are automatically generated by ServBay, and manual modifications risk being overwritten. Make changes through the UI instead.
Modify via ServBay's UI
ServBay provides a powerful graphical management interface that allows users to modify different configuration parameters directly. After clicking save, changes will be automatically applied and take effect in real time, saving the hassle of manually editing parameters.
Users can navigate through ServBay's left sidebar by selecting Database
- MongoDB
, and then choose the corresponding version to edit MongoDB configurations.
In the graphical editing interface, users can modify MongoDB's listening address bindIp
and port port
(default is 127.0.0.1, ::1:27017
). Additionally, users can configure other MongoDB settings.
Moreover, users can configure additional parameters in Additional Parameters
to meet development business requirements.
Once modifications are complete, click the Save
button to apply the changes and make them effective in real time.
Modify by Editing Configuration Files Manually
WARNING
Manually editing configuration files is only suitable for temporary changes to some configuration items.
We do not recommend modifying MongoDB's configuration files manually, as all changes will be overwritten by ServBay.
Overview
In ServBay, MongoDB's configuration files are stored in different directories based on their version. For instance, the configuration files for MongoDB 8.0 are stored in the /Applications/ServBay/etc/mongodb/8.0
directory. The main configuration file includes mongod.conf
.
Configuration File Location
mongod.conf
:/Applications/ServBay/etc/mongodb/8.0/mongod.conf
Common Configuration Items and Modification Methods
mongod.conf
mongod.conf
is the main configuration file for MongoDB and is used to set runtime options for the database server.
Common Configuration Items
Modify Listening Address:
yamlnet: bindIp: 0.0.0.0
1
2Modify Port Number:
yamlnet: port: 27017
1
2Modify Maximum Number of Connections:
yamlmaxIncomingConnections: 100
1Modify WiredTiger Cache Size:
yamlstorage: wiredTiger: engineConfig: cacheSizeGB: 1
1
2
3
4Enable Slow Query Log:
yamloperationProfiling: slowOpThresholdMs: 100
1
2
Restart MongoDB
After modifying the MongoDB configuration file, you need to restart the MongoDB service for the changes to take effect. You can restart it through ServBay's management interface or by using the servbayctl
command-line tool.
Restart via ServBay Management Interface
- Open the ServBay management interface.
- Navigate to
Services
. - Find the corresponding version of the MongoDB service and click the
Restart
button.
Restart via servbayctl
The servbayctl
command-line tool can be used to conveniently restart the MongoDB service:
servbayctl restart mongodb 8.0
Summary
In ServBay, MongoDB configuration files are located in the /Applications/ServBay/etc/mongodb/<version>
directory, including mongod.conf
. After modifying these configuration files, MongoDB services can be restarted through ServBay’s management interface or using the servbayctl
command-line tool to make the changes effective.