Warning
MongoDB 8.3 Not Yet AvailableMongoDB 8.3尚未推出
MongoDB 8.3 release candidates are not yet available. This version of the manual is for an upcoming release and is currently a work in progress.MongoDB 8.3候选版本尚未发布。此版本的手册适用于即将发布的版本,目前正在进行中。
Important
MongoDB 8.3 is the latest minor release. Starting with MongoDB 8.2, minor releases are available for on-premises deployments (Community and EA) for specific use cases. For more information, see MongoDB Versioning.MongoDB 8.3是最新的次要版本。从MongoDB 8.2开始,次要版本可用于特定用例的本地部署(社区和EA)。有关更多信息,请参阅MongoDB版本控制。
To install the latest MongoDB version supported for on-premises use, see the installation instructions.要安装支持本地使用的最新MongoDB版本,请参阅安装说明。
Overview概述
Use this tutorial to manually install MongoDB 8.3 Enterprise Edition on macOS using a downloaded 使用本教程,使用下载的.tgz tarball..tgz tarball在macOS上手动安装MongoDB 8.3企业版。
MongoDB Enterprise Edition is available on select platforms and contains support for several features related to security and monitoring.MongoDB企业版可在特定平台上使用,并包含对与安全和监控相关的几个功能的支持。
MongoDB VersionMongoDB版本
This tutorial installs MongoDB 8.3 Enterprise Edition. To install a different version of MongoDB Enterprise, use the version drop-down menu in the upper-left corner of this page to select the documentation for that version.本教程安装MongoDB 8.3企业版。要安装不同版本的MongoDB Enterprise,请使用此页面左上角的版本下拉菜单选择该版本的文档。
Considerations注意事项
MongoDB Shell, mongosh
When you use the 当您使用.tgz package to install the server, you need to follow the mongosh installation instructions to download and install mongosh separately..tgz软件包安装服务器时,您需要按照mongosh安装说明单独下载和安装mongosh。
Platform Support平台支持
MongoDB 8.3 Enterprise Edition supports macOS 11 or later.MongoDB 8.3企业版支持macOS 11或更高版本。
For more information, see Platform Support.有关更多信息,请参阅平台支持。
Production Notes制作笔记
Before deploying MongoDB in a production environment, consider the Production Notes for Self-Managed Deployments document which offers performance considerations and configuration recommendations for production MongoDB deployments.在生产环境中部署MongoDB之前,请考虑《自我管理部署的生产说明》文档,该文档为生产MongoDB部署提供了性能考虑和配置建议。
Install MongoDB Enterprise Edition安装MongoDB企业版
To manually install MongoDB Enterprise Edition from the 要从.tgz, select the tab that corresponds with your Mac's processor and complete the following steps:.tgz手动安装MongoDB Enterprise Edition,请选择与Mac处理器对应的选项卡,并完成以下步骤:
intel
Download the tarball.下载tarball。
Download the MongoDB Enterprise 从以下链接下载MongoDB Enterprise tgz tarball from the following link:tgz tarball:
➤ MongoDB Download CenterMongoDB下载中心
In the Version dropdown, select the version of MongoDB to download.在版本下拉列表中,选择要下载的MongoDB版本。In the Platform dropdown, select macOS ARM 64.在平台下拉列表中,选择macOS ARM 64。In the Package dropdown, select tgz.在“包”下拉列表中,选择tgz。Click Download.单击“下载”。
Extract the files from the downloaded archive.从下载的存档中提取文件。
tar -zxvf mongodb-macos-x86_64-enterprise-8.3.tgz
If your web browser automatically unzips the file as part of the download, the file ends in 如果web浏览器在下载过程中自动解压缩文件,则文件将以.tar instead..tar结尾。
Ensure the binaries are in a directory listed in your PATH environment variable.确保二进制文件位于PATH环境变量中列出的目录中。
PATH environment variable.The MongoDB binaries are in the MongoDB二进制文件位于tarball的bin/ directory of the tarball. You can either:bin/目录中。您可以:
Copy the binaries into a directory listed in your
PATHvariable, such as/usr/local/bin. Replace/path/to/the/mongodb-directory/with your installation directory.sudo cp /path/to/the/mongodb-directory/bin/* /usr/local/bin/Create symbolic links to the binaries from a directory listed in your
PATHvariable, such as/usr/local/bin. Replace/path/to/the/mongodb-directory/with your installation directory.sudo ln -s /path/to/the/mongodb-directory/bin/* /usr/local/bin/
apple
Download the tarball.下载tarball。
Download the MongoDB Enterprise tgz tarball from the following link:
- In the Version dropdown, select the version of MongoDB to download.
- In the Platform dropdown, select macOS ARM 64.
- In the Package dropdown, select tgz.
- Click Download.
Extract the files from the downloaded archive.
tar -zxvf mongodb-macos-arm64-enterprise-8.3.tgz
If your web browser automatically unzips the file as part of the download, the file ends in .tar instead.
Ensure the binaries are in a directory listed in your PATH environment variable.
The MongoDB binaries are in the bin/ directory of the tarball. You can either:
Copy the binaries into a directory listed in your
PATHvariable, such as/usr/local/bin. Replace/path/to/the/mongodb-directory/with your installation directory.sudo cp /path/to/the/mongodb-directory/bin/* /usr/local/bin/Create symbolic links to the binaries from a directory listed in your
PATHvariable, such as/usr/local/bin. Replace/path/to/the/mongodb-directory/with your installation directory.sudo ln -s /path/to/the/mongodb-directory/bin/* /usr/local/bin/
Run MongoDB Enterprise Edition
- ulimit Considerations
- Most Unix-like operating systems limit the system resources that a process may use. These limits may negatively impact MongoDB operation, and should be adjusted. See UNIX
ulimitSettings for Self-Managed Deployments for the recommended settings for your platform.Note
If theulimitvalue for number of open files is under64000, MongoDB generates a startup warning.
Procedure过程
Follow these steps to run MongoDB Enterprise Edition. These instructions assume that you are using the default settings.
Create the data directory.
Before you start MongoDB for the first time, you must create the directory to which the mongod process will write data.
For example, to create the ~/data/db directory:
sudo mkdir -p ~/data/dbCreate the log directory.
You must also create the directory in which the mongod process will write its log file:
For example, to create the ~/data/log/mongodb directory:
sudo mkdir -p ~/data/log/mongodbSet permissions for the data and log directories.
Ensure that the user account running mongod has read and write permissions for these two directories. If you are running mongod as your own user account, and you just created the two directories above, they should already accessible to your user. Otherwise, you can use chown to set ownership, substituting the appropriate user:
sudo chown <user> ~/data/db
sudo chown <user> ~/data/log/mongodbRun MongoDB.
To run MongoDB, run the mongod process at the system prompt, providing the two parameters dbpath and logpath from above, and the nohup command to run mongod in the background. Alternatively, you may choose to store the values for dbpath, logpath, and many other parameters in a configuration file.
Run mongod with command-line parameters
Run the mongod process at the system prompt, providing the three necessary parameters directly on the command-line:
nohup mongod --dbpath ~/path/to/dbdir --logpath ~/path/to/mongodb.log >/dev/null &Run mongod with a configuration file
Run the mongod process at the system prompt, providing the path to a configuration file with the config parameter:
mongod --config /usr/local/etc/mongod.confmacOS may prevent mongod from running after installation. If you receive a security error when starting mongod indicating that the developer could not be identified or verified, do the following to grant mongod access to run:
- Open System Preferences
- Select the Security and Privacy pane.
- Under the General tab, click the button to the right of the message about
mongod, labelled either Open Anyway or Allow Anyway depending on your version of macOS.
Verify that MongoDB has started successfully.
Verify that MongoDB has started successfully:
ps aux | grep -v grep | grep mongod
If you do not see a mongod process running, check the logfile for any error messages.
Begin using MongoDB.
Start a mongosh session on the same host machine as the mongod. You can run mongosh without any command-line options to connect to a mongod that is running on your localhost with the default port of 27017:
mongosh
For more information on connecting using mongosh, such as to connect to a mongod instance running on a different host and/or port, see the mongosh documentation.
To help you start using MongoDB, MongoDB provides Getting Started Guides in various driver editions. See Getting Started with MongoDB for the available editions.
Additional Information附加信息
Localhost Binding by Default
By default, MongoDB launches with bindIp set to 127.0.0.1, which binds to the localhost network interface. This means that the mongod can only accept connections from clients that are running on the same machine. Remote clients will not be able to connect to the mongod, and the mongod will not be able to initialize a replica set unless this value is set to a valid network interface.
This value can be configured either:
Warning
Before you bind your instance to a publicly-accessible IP address, you must secure your cluster from unauthorized access. For a complete list of security recommendations, see Security Checklist for Self-Managed Deployments. At minimum, consider enabling authentication and hardening network infrastructure.
For more information on configuring bindIp, see IP Binding in Self-Managed Deployments.