本指南介绍了如何从MongoDB Connector for BI和Atlas BI Connector迁移到较新的SQL接口。
重要
MongoDB Connector for BI和Atlas BI Connector已于 9 月 2026结束生命周期 (EOL)。
SQL接口
与BI Connector类似, SQL接口使您能够使用各种基于SQL 的工具(例如Tableau和 Power BI)分析来自MongoDB部署的数据。
与BI Connector相比, SQL接口具有以下优点:
您可以直接连接到Atlas专用集群,无需联合数据库实例。这是大多数Atlas连接的推荐路径。
通过Atlas联合数据库实例,您可以从Atlas集群以外的来源读取数据。当单个查询必须跨越多个数据源时,请使用此路径。
模式单独保存,并且可以在不中断SQL查询功能的情况下进行更新。
您可以将自定义MongoDB连接器用于Tableau和 Power BI。
SQL接口限制
SQL接口提供只读访问权限。
MongoSQL 是唯一受支持的方言。 MongoSQL 与SQL-92 兼容。不支持其他SQL方言。
如果通过联合数据库实例进行连接,则所有Atlas Data Federation限制也应用。它们不适应用与专用集群的直接连接。
准备过渡到SQL接口
从BI Connector过渡到SQL接口之前,请确认您的部署满足迁移目标的先决条件。 MongoDB还建议您生成过渡就绪报告,以帮助规划过渡。
先决条件
先决条件取决于迁移到的位置。要比较Atlas目标,请参阅MongoDB SQL接口概述。
Atlas Dedicated 集群:要连接的MongoDB 数据库用户。要启用SQL接口,您还需要一个具有
Project Cluster Manager或Project Replica Set Manager角色的Atlas 用户。Atlas联合数据库实例:包含可查询数据和要连接的MongoDB 数据库用户的联合数据库实例。
自管理Enterprise Advanced (EA)部署:具有所需数据库特权的MongoDB 数据库用户。不需要Atlas项目角色。
生成过渡就绪报告
MongoDB提供了 MongoSQL 过渡准备工具来帮助您规划从BI Connector到SQL接口的迁移。该工具会根据您过去的BI Connector使用情况生成一份报告,提供实时模式分析和建议,并突出显示需要更改语法才能使用 MongoSQL 正常运行的查询。
要生成报告,您必须至少向该工具提供以下详细信息之一:
BI Connector日志,用于查询分析。
您的集群URI,用于模式分析。
您可以分析查询和/或模式。
(可选)下载并解压缩BI Connector日志。
提供BI Connector日志后,准备情况报告工具就能报告以下信息:
历史查询数据,例如数量和频率。
在 MongoSQL 中会失败的查询语法。
具有关系数据库未知数据类型的集合字段。
对于本地部署BI Connector,日志位于您配置 mongosqld日志路径的位置。
要下载您的 Atlas BI Connector 日志,请执行以下操作:
在 Atlas 用户界面中,转到具有要分析的 BI 连接的 Atlas 集群。
从集群的选项( ),选择Download Logs 。
下载
mongosql.gz。创建一个新目录,然后将
mongosql.gz解压缩到其中。
生成报告。
在终端中,运行就绪报告工具可执行文件,提供下载的日志或集群URI。
必须包含数据库用户名。
必须包含
--input和/或--uri。如果包含 URI,就绪报告工具会提示您输入数据库用户密码。您可以为生成的报告指定
--output目的地。如未指定,它将在当前目录中生成。您可以指定
--resolver来为网络请求选择 DNS 解析程序。可能的值为:cloudflare、google和quad9。您可以使用
--include或--exclude来缩小命名空间列表的范围。 支持 Global 语法。 默认,包括所有命名空间。
--help选项返回就绪报告工具选项的完整列表:
<executable-filename> --help Options: -i, --input <INPUT> Sets the input file or directory to analyze BIC logs (optional). One of `--input` or `--uri` must be provided, or both -o, --output <OUTPUT> Sets the output directory (optional). If not specified, the current directory is used --uri <URI> The Atlas cluster URI to analyze schema (optional). One of `--input` or `--uri` must be provided, or both -u, --username <USERNAME> Username for authentication (optional). This is required if the username and password is not provided in the URI --quiet Enables quiet mode for less output --resolver <RESOLVER> The specified resolver (optional) [possible values: cloudflare, google, quad9] --include <INCLUDE> A list of namespaces to include (optional). If not provided, all namespaces are included. Glob syntax is supported --exclude <EXCLUDE> A list of namespaces to exclude (optional). If not provided, no namespaces are excluded -h, --help Print help (see more with '--help') -V, --version Print version
就绪报告工具会组织输出并生成可点击的索引文件,以便您可以轻松浏览报告。
过渡到SQL接口
SQL接口的根本的架构与BI Connector不同,您可能需要调整模式或查询。
要过渡到SQL接口,请确定在 MongoSQL 上失败的现有BI Connector查询,并更新模式或语法来修复这些查询。
警告
我们建议您在对生产环境进行更改之前,在沙盒环境中测试完整的过渡进程。从BI Connector过渡到SQL接口而不调整模式或查询,可能会导致重大更改。
SQL接口故障排除
以下MongoDB资源可以帮助您对SQL接口配置进行故障排除: