Atlas Data Federation 支持可公开访问的 URL作为联合数据库实例存储。 您必须在联合数据库实例中定义到HTTP数据存储的映射,才能运行数据查询。
重要
存储配置中的信息在 MongoDB 内部可见,并存储为操作数据,以监控和提高 Atlas Data Federation 的性能。 因此,我们建议您不要在配置中使用PII 。
HTTP 数据存储的配置示例
考虑包含从数据中心收集的数据的 https://www.datacenter-hardware.com/data.json
、 https://www.datacenter-software.com/data.json
和https://www.datacenter-metrics.com/data.json
的URL 。 配置如下:
指定包含作为联合数据库实例存储的文件中的数据的可公开访问的 URL。
为每个URL创建一个分区。
{ "stores" : [ { "name" : "httpStore", "provider" : "http", "allowInsecure" : false, "urls" : [ "https://www.datacenter-hardware.com/data.json", "https://www.datacenter-software.com/data.json" ], "defaultFormat" : ".json" } ], "databases" : [ { "name" : "dataCenter", "collections" : [ { "name" : "inventory", "dataSources" : [ { "storeName" : "httpStore", "allowInsecure" : false, "urls" : [ "https://www.datacenter-metrics.com/data" ], "defaultFormat" : ".json" } ] } ] } ] }
配置格式
联合数据库实例配置的格式如下:
1 { 2 "stores" : [ 3 { 4 "name" : "<string>", 5 "provider": "<string>", 6 "defaultFormat" : "<string>", 7 "allowInsecure": <boolean>, 8 "urls": ["<string>"] 9 } 10 ], 11 "databases" : [ 12 { 13 "name" : "<string>", 14 "collections" : [ 15 { 16 "name" : "<string>", 17 "dataSources" : [ 18 { 19 "storeName" : "<string>", 20 "allowInsecure" : <boolean>, 21 "urls" : ["<string>"], 22 "defaultFormat" : "<string>", 23 "provenanceFieldName": "<string>" 24 } 25 ] 26 } 27 ], 28 "views" : [ 29 { 30 "name" : "<string>", 31 "source" : "<string>", 32 "pipeline" : "<string>" 33 } 34 ] 35 } 36 ] 37 }
stores
stores
对象定义与联合数据库实例关联的每个数据存储。 联合数据库实例存储捕获存储在可公开访问的URL中的文件。 Data Federation 只能访问stores
对象中定义的数据存储。databases
databases
对象定义stores
中定义的每个联合数据库实例存储与数据库中的 MongoDB 集合之间的映射。
stores
1 "stores" : [ 2 { 3 "name" : "<string>", 4 "provider" : "<string>", 5 "allowInsecure": <boolean>, 6 "urls" : ["<string>"], 7 "defaultFormat" : "<string>" 8 } 9 ]
字段 | 类型 | 必要性 | 说明 | |
---|---|---|---|---|
阵列 | 必需 | 对象数组,其中每个对象代表一个与联合数据库实例关联的数据存储。联合数据库实例存储捕获存储在可公开访问的URL中的文件。Atlas Data Federation只能访问权限 | ||
字符串 | 必需 | 联合数据库实例存储的名称。 | ||
字符串 | 必需 |
| ||
布尔 | 必需 | 可选。 验证指定URL中的模式。 值可以是以下之一:
如果为 true,则 Atlas Data Federation:
警告:如果将其设立为 如果省略,则默认为
| ||
阵列 | 可选 | 以逗号分隔的存储数据的可公开访问的HTTP URL列表。不能指定需要身份验证的URL 。 | ||
字符串 | 可选 | Data Federation在搜索 以下值对
重要:如果您的文件格式为 如果省略,Data Federation 将尝试处理文件的几个字节来检测文件类型。 指定的格式仅适用于 对象中指定的URL 提示 |
databases
1 "databases" : [ 2 { 3 "name" : "<string>", 4 "collections" : [ 5 { 6 "name" : "<string>", 7 "dataSources" : [ 8 { 9 "storeName" : "<string>", 10 "allowInsecure" : <boolean>, 11 "urls" : ["<string>"], 12 "defaultFormat" : "<string>", 13 "provenanceFieldName": "<string>" 14 } 15 ] 16 } 17 ] 18 } 19 ]
字段 | 类型 | 必要性 | 说明 | ||||||
---|---|---|---|---|---|---|---|---|---|
阵列 | 必需 | ||||||||
字符串 | 必需 | Atlas Data Federation 将数据存储中包含的数据映射到数据库的数据库名称。 | |||||||
阵列 | 必需 | 对象数组,其中每个对象代表一个集合和映射到 | |||||||
字符串 | 必需 | Atlas Data Federation将每个 重要通配符 * 集合不适用于HTTP (超文本传输协议)存储。 | |||||||
阵列 | 字符串 | 对象数组,其中每个对象代表要与集合的 | |||||||
字符串 | 必需 | ||||||||
布尔 | 必需 | 可选。 验证指定URL中的模式。 值可以是以下之一:
如果为 true,则 Atlas Data Federation:
警告:如果将其设立为 如果省略,则默认为
| |||||||
阵列 | 可选 | 以逗号分隔的存储数据的可公开访问的URL列表。联合数据库实例为每个URL创建一个分区。您可以指定不在 中的 如果省略, Data Federation将使用指定的 | |||||||
字符串 | 可选 | Data Federation在搜索 以下值对
重要:如果您的文件格式为 如果省略,Data Federation 将尝试处理文件的几个字节来检测文件类型。 指定的格式仅适用于 对象中指定的URL 提示 | |||||||
字符串 | 必需 | 包含结果中文档来源的字段的名称。如果在存储配置中指定了此设置,Atlas Data Federation 则会为结果中的每个文档返回以下字段:
您无法使用 Atlas 用户界面中的可视化编辑器来配置此设置。 | |||||||
阵列 | 必需 | ||||||||
字符串 | 必需 | 视图名称。 | |||||||
字符串 | 必需 | 视图源集合的名称。如果要创建带有$sql阶段的视图,则必须省略此字段,因为SQL声明将指定源集合。 | |||||||
阵列 | 必需 |
HTTP 数据存储的配置示例
考虑URL https://www.datacenter-hardware.com/data.json
、https://www.datacenter-software.com/data.json
和 https://www.datacenter-metrics.com/data.json
包含从数据中心收集的数据。配置如下:
指定包含作为联合数据库实例存储的文件中的数据的可公开访问的 URL。
为每个URL创建一个分区。
{ "stores" : [ { "name" : "httpStore", "provider" : "http", "allowInsecure" : false, "urls" : [ "https://www.datacenter-hardware.com/data.json", "https://www.datacenter-software.com/data.json" ], "defaultFormat" : ".json" } ], "databases" : [ { "name" : "dataCenter", "collections" : [ { "name" : "inventory", "dataSources" : [ { "storeName" : "httpStore", "allowInsecure" : false, "urls" : [ "https://www.datacenter-metrics.com/data" ], "defaultFormat" : ".json" } ] } ] } ] }