从 Studio 3T 连接到 Amazon DocumentDB 集群 - Amazon DocumentDB
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

从 Studio 3T 连接到 Amazon DocumentDB 集群

Studio 3T 是一款受欢迎的面向使用 MongoDB 的开发人员和数据工程师的 GUI 和 IDE。它提供几种强大能力:数据的树视图、表视图和 JSON 视图、在 CSV、JSON、SQL 和 BSON/mongoDump 轻松导入/导出、灵活的查询选项、可视性拖放 UI、可自动完成的内置 mongo shell、聚合管道编辑器以及 SQL 查询支持。

先决条件

  • 如果您尚未拥有以 Amazon EC2 作为堡垒机/跳转主机的 Amazon DocumentDB 集群,请遵循如何连接 Amazon EC2的说明。

  • 如果你没有 Studio 3T,请下载并安装它

用 Studio 3T 连接

  1. 选择工具栏左上角的连接

    Studio 3T interface with toolbar options and welcome screen for MongoDB database management.
  2. 选择工具栏左上角的新连接

    Connection Manager interface with New Connection option highlighted in the toolbar.
  3. 服务器选项卡,在服务器字段中输入集群端点信息。

    New Connection dialog with Server tab selected, showing 集群 endpoint in the Server field.
    注意

    无法找到您的集群端点? 只要遵循此处步骤即可。

  4. 选择身份验证选项卡,并且在身份验证模式的下拉菜单中选择旧版

    Authentication tab with Legacy mode selected, username "newbie", and admin database.
  5. 用户名密码字段中输入您的用户名和凭证。

  6. 选择SSL选项卡,然后勾选使用 SSL 协议连接复选框。

    SSL configuration options for a new database connection, including Root CA file selection.
  7. 选择使用自己的根 CA 文件。然后添加 Amazon DocumentDB 证书(如果 SSL 在您的 DocumentDB 集群上已禁用,则可以跳过此步骤)。勾选该复选框以允许无效主机名

    SSL configuration options for a new database connection, including Root CA file selection.
    注意

    没有证书? 您可以使用以下命令下载:

    wget https://rds-truststore.s3.cn-north-1.amazonaws.com.cn/global/global-bundle.pem

  8. 如果您正从 Amazon VPC 之外的客户机连接,则需要创建 SSH 隧道。您将在SSH选项卡中创建。

    1. 勾选使用 SSH 隧道复选框并在SSH 地址字段中输入 SSH 地址。这是您的实例公有 DNS (IPV4)。您可以从您的 Amazon EC2 管理控制台获取此 URL。

    2. 输入您的用户名。这是您的 Amazon EC2 实例用户名

    3. 对于 SSH 身份验证模式,请选择私钥。在私钥字段中,选择文件查找器图标以定位并选择 Amazon EC2 实例的私钥。这是您在Amazon EC2 控制台中创建实例时保存过的.pem 文件(密钥对)。

    4. 如果您在 Linux/macOS 客户机上,则可能须使用以下命令更改您的私钥权限:

      chmod 400 /fullPathToYourPemFile/<yourKey>.pem

    SSH connection settings for an EC2 instance, including address, port, and private key details.
    注意

    这个 Amazon EC2 实例应与您的 DocumentDB 集群处于相同的 Amazon VPC 和安全组中。您可以从自己的 Amazon EC2 管理控制台获取 SSH 地址、用户名和私钥。

  9. 现在,通过选择测试连接按钮测试您的配置。

    New Connection dialog with Server tab selected, showing connection details for MongoDB.
  10. 诊断窗口应加载绿色条以指示测试成功。现在选择 OK 关闭诊断窗口。

    Connection status window showing successful operations and final "Connected" status.
  11. 选择保存来保存您的连接以供将来使用。

    New Connection dialog with Server tab selected, showing connection details and Save button.
  12. 现在选择您的集群并选择连接

    Connection Manager interface showing options to manage database connections and a Connect button.

恭喜您!您已成功通过 Studio 3T 连接到您的 Amazon DocumentDB 集群。