Install and Configure mongocryptd for Queryable Encryption为可查询加密安装和配置mongocrypted
On this page本页内容
Overview概述
Use the Automatic Encryption Shared Library使用自动加密共享库
If you are starting a new project, use the 如果您正在启动一个新项目,请使用crypt_shared
encryption helper, referred to as the Shared Library. The Shared Library replaces mongocryptd
and does not require spawning a new process.crypt_shared
加密助手,称为共享库。共享库取代了mongocrypted
,不需要生成新的进程。
mongocryptd
is installed with MongoDB Enterprise Server.mongocryptd
与MongoDB Enterprise Server一起安装。
When you create a Queryable Encryption enabled MongoDB client, the 当您创建一个支持可查询加密的MongoDB客户端时,mongocryptd
process starts automatically by default.mongocrypted
进程默认情况下会自动启动。
The mongocryptd
process:mongocryptd
过程:
Uses the specified automatic encryption rules to mark fields in read and write operations for encryption.使用指定的自动加密规则标记读写操作中的字段进行加密。Prevents unsupported operations from executing on encrypted fields.阻止对加密字段执行不受支持的操作。Parses the encryption schema specified for the database connection.分析为数据库连接指定的加密架构。Automatic encryption rules use a strict subset of JSON schema syntax.自动加密规则使用JSON模式语法的严格子集。If the rules contain invalid automatic encryption syntax or any如果规则包含无效的自动加密语法或任何文档验证语法,document validation
syntax,mongocryptd
returns an error.mongocryptd
将返回错误。
mongocryptd
only performs the previous functions, and doesn't perform any of the following:仅执行前面的功能,不执行以下任何功能:
mongocryptd
doesn't perform encryption or decryption不执行加密或解密mongocryptd
doesn't access any encryption key material无法访问任何加密键材料mongocryptd
doesn't listen over the network不通过网络收听
To perform client-side field level encryption and automatic decryption, Drivers use the Apache-licensed libmongocrypt为了执行客户端字段级加密和自动解密,驱动程序使用Apache许可的libmongocrypt library
库
Installation安装
For supported Linux Operating Systems, install the Server package by following the install on Linux tutorial , follow the documented installation instructions and install the 对于支持的Linux操作系统,请按照在Linux上安装教程安装Server软件包,按照文档中的安装说明安装,然后安装mongodb-enterprise
server package. mongodb-enterprise
服务器软件包。Alternatively, specify 或者,指定mongodb-enterprise-cryptd
instead to install only the mongocryptd
binary. mongodb-enterprise-cryptd
来只安装mongocrypted
二进制文件。The package manager installs the binaries to a location in the system PATH (e.g. 包管理器将二进制文件安装到系统PATH中的某个位置(例如/usr/bin/
)/usr/bin/
)
For OSX, install the Server package by following the install on MacOS tutorial. 对于OSX,请按照在MacOS上安装教程安装Server软件包。The package manager installs binaries to a location in the system PATH.包管理器将二进制文件安装到系统PATH中的某个位置。
For Windows, install the Server package by following the install on Windows tutorial. You must add the 对于Windows,请按照在Windows上安装教程安装Server软件包。安装后,必须将mongocryptd
package to your system PATH after installation. Defer to documented best practices for your Windows installation for instructions on adding the mongocryptd
binary to the system PATH.mongocrypted
包添加到系统PATH中。有关将mongocrypted
二进制文件添加到系统PATH的说明,请参阅Windows安装的最佳实践文档。
For installations via an official tarball or ZIP archive, follow the documented best practices for your operating system to add the 对于通过官方tarball或ZIP档案进行的安装,请遵循操作系统的最佳实践文档,将mongocryptd
binary to your system PATH.mongocrypted
二进制文件添加到系统PATH中。
Configuration配置
If the driver has access to the 如果驱动程序有权访问mongocryptd
process, it spawns the process by default.mongocrypted
进程,则默认情况下会生成该进程。
mongocryptd Port In Use
If a 如果mongocryptd
process is already running on the port specified by the driver, the driver may log a warning and continue without spawning a new process. Any settings specified by the driver only apply once the existing process exits and a new encrypted client attempts to connect.mongocrypted
进程已经在驱动程序指定的端口上运行,则驱动程序可能会记录警告并继续运行,而不会生成新进程。驱动程序指定的任何设置只有在现有进程退出并且新的加密客户端尝试连接时才适用。
Configure how the driver starts 通过以下参数配置驱动程序如何启动mongocryptd
through the following parameters:mongocrypted
:
port | mongocryptd listens for messages.mongocrypted 侦听消息的端口。Default: 27020 |
---|---|
idleShutdownTimeoutSecs | mongocryptd process waits before exiting.mongocrypted 进程在退出前等待的空闲秒数。Default: 60 |
mongocryptdURI | mongocryptd process.mongocrypted 进程的URI。Default: "mongodb://localhost:27020" |
mongocryptdBypassSpawn | true , prevents the driver from automatically spawning mongocryptd .true ,则阻止驱动程序自动生成mongocrypted 。Default: false |
mongocryptdSpawnPath | mongocryptd .mongocryptd 的完整道路。Default |
Start on Boot启动时启动
If possible, start 如果可能的话,启动mongocryptd
on boot, rather than launching it on demand.mongocrypted
,而不是按需启动。
Examples实例
To view examples of how to configure your 要查看如何配置mongocryptd
process, click the tab corresponding to the driver you are using in your application:mongocrypted
进程的示例,请单击与您在应用程序中使用的驱动程序相对应的选项卡:
The following code-snippet sets the listening port configuration of 以下代码段设置mongocryptd
:mongocrypted
的侦听端口配置:
autoEncryption: {
...
extraOptions: {
mongocryptdSpawnArgs: ["--port", "30000"],
mongocryptdURI: 'mongodb://localhost:30000',
}
In the NodeJS driver, the 在NodeJS驱动程序中,mongocryptdURI
must match the listening port.mongocryptedURI
必须与侦听端口匹配。
The following code-snippet sets the default timeout configuration of 以下代码片段设置mongocryptd
:mongocrypted
的默认超时配置:
autoEncryption: {
...
extraOptions: {
mongocryptdSpawnArgs: ["--idleShutdownTimeoutSecs", "75"]
}