SQL 终结点SQL endpoints

重要

此功能目前以公共预览版提供。This feature is in Public Preview. 请联系 Azure Databricks 代表,以申请访问权限。Contact your Azure Databricks representative to request access.

Azure Databricks SQL 终结点是一种计算资源,支持对 Azure Databricks 环境中的数据对象运行 SQL 命令。An Azure Databricks SQL endpoint is a computation resource that lets you run SQL commands on data objects within the Azure Databricks environment.

SQL 终结点显示在查询历史记录中,记录了运行查询的用户。SQL endpoints appear in query history and record the user that ran the query.

SQL 终结点支持 SQL Analytics 的 SQL 参考中的 SQL 命令。SQL endpoints support the SQL commands in SQL reference for SQL Analytics.

此部分介绍如何通过 UI 来使用 SQL 终结点。This section describes how to work with SQL endpoints using the UI. 若要使用 API 处理 SQL 终结点,请参阅 SQL 终结点 APITo work with SQL endpoints using the API, see SQL Endpoint APIs.

通过 SQL 终结点进行的查询由查询监视器管理,采用本文所述的默认值。Queries through SQL endpoints are managed by the Query Watchdog with the defaults as described in that article.

要求Requirements

  • 若要创建 SQL 终结点,必须在 Azure Databricks 工作区中具有群集创建权限To create SQL endpoints you must have cluster create permission in Azure Databricks Workspace.
  • 若要管理 SQL 终结点,必须在 Azure Databricks SQL Analytics 中具有该终结点的可管理权限。To manage a SQL endpoint you must have Can Manage permission in Azure Databricks SQL Analytics for the endpoint.

查看 SQL 终结点View SQL endpoints

单击Click the “终结点”图标 “模型”图标。icon in the sidebar.

默认情况下,终结点按字母顺序进行排序。By default, endpoints are sorted in alphabetical order. 可以通过单击列标题重新对列表进行排序。You can reorder the list by clicking the column headings.

若要筛选终结点列表,请在搜索框中输入文本:To filter the list of endpoints, enter text in the search box:

筛选终结点Filter endpoints

创建 SQL 终结点Create a SQL endpoint

  1. 单击Click the “终结点”图标 “模型”图标。icon in the sidebar.

  2. 单击“+新建 SQL 终结点”。Click + New SQL Endpoint.

    创建终结点Create endpoint

  3. 为终结点输入名称。Enter a name for the endpoint. 接受或编辑终结点属性Accept or edit the endpoint properties.

  4. 单击 “创建”Click Create.

  5. 执行下列操作之一:Do one of the following:

    终结点已创建并启动。The endpoint is created and started.

启动、停止或删除 SQL 终结点 Start, stop, or delete a SQL endpoint

  1. 单击Click the “终结点”图标 “模型”图标。icon in the sidebar.
  2. 在“操作”列表中,单击垂直省略号 “垂直省略号”,然后选择“启动”、“停止”或“删除” 。In the Actions column, click the vertical ellipsis Vertical Ellipsis and select Start, Stop, or Delete.

另请参阅配置服务主体Also see Configure a service principal.

编辑 SQL 终结点 Edit a SQL endpoint

  1. 单击Click the “终结点”图标 “模型”图标。icon in the sidebar.
  2. 单击一个终结点。Click an endpoint.
  3. 单击 “编辑”Click Edit.
  4. 编辑终结点属性。Edit endpoint properties.
    • 群集大小:群集辅助角色数和协调器大小。Cluster Size: the number of cluster workers and size of the coordinator. 默认值为“X-大”。The default is X-Large. 若要减少查询延迟,请增加大小。To reduce the latency of queries, increase the size. 大小越大,协调器越大,群集辅助角色数也将翻倍。A larger size has a larger coordinator and doubles the number of cluster workers. 有关详细信息,请查看群集大小For details, see Cluster size.

    • 自动停止:决定在终结点空闲指定分钟数的情况下是否停止终结点。Auto Stop: whether the endpoint stops if it’s idle for the specified number of minutes. 默认为“开”,值为 120 分钟。The default is On with a value of 120 minutes.

      备注

      空闲的 SQL 终结点会继续累积 DBU 和云实例费用,直到被停止。Idle SQL endpoints continue to accumulate DBU and cloud instance charges until they are stopped.

    • 多群集负载均衡:分布发送到终结点的查询所依据的群集最小数量和最大数量。Multi-cluster Load Balancing: the minimum and maximum number of clusters over which queries sent to the endpoint are distributed. 默认为“关”;如果设为“开”,则默认是 1 个群集 。The default is Off and 1 cluster if On. 若要针对给定查询处理更多并发用户,请启用负载均衡并增加群集数。To handle more concurrent users for a given query, enable load balancing and increase the cluster count.

      重要

      多群集负载均衡以预览版提供。Multi-cluster Load Balancing is in Preview. 请联系 Azure Databricks 代表,以申请访问权限。Contact your Azure Databricks representative to request access.

    • Photon:决定是否在可加快查询执行的本机向量化引擎上执行查询。Photon: whether queries are executed on a native vectorized engine that speeds up query execution. 默认为“关”。The default is Off. 若要启用,请选择“开”,阅读免责声明,然后单击“启用 Photon” 。To enable, select On, read the disclaimer, and click Enable Photon.

    • 权限 :可以管理和使用终结点的用户和组。Permissions: users and groups that can manage and use the endpoint.

    • 标记 :可识别使用终结点的人员的键值对注释。Tags: key-value pair annotations that can identify who uses the endpoint.

  5. 单击“保存”或“保存并重启” 。Click Save or Save and restart.

编辑终结点权限Edit endpoint permissions

编辑终结点权限To edit endpoint permissions:

  1. 单击Click the 权限按钮 按钮。button.

    这会显示 SQL 终结点权限。The SQL endpoint permissions display. 终结点创建者和 Azure Databricks 管理员具有“可管理”权限。The endpoint creator and Azure Databricks admins have Can Manage permission.

    添加权限Add permission

  2. 选择用户或组,再选择一个权限。Select a user or group and a permission.

  3. 单击“添加” 。Click Add.

  4. 单击“ 保存”。Click Save.

添加终结点标记Add an endpoint tag

可使用标记轻松监视组织中各种组所使用的云资源的成本。Tags allow you to easily monitor the cost of cloud resources used by various groups in your organization. 可在创建终结点时将标记指定为键值对,Azure Databricks 会将这些标记应用于云资源。You can specify tags as key-value pairs when you create an endpoint, and Azure Databricks applies these tags to cloud resources.

若要添加终结点标记:To add an endpoint tag:

  1. 单击Click the “终结点”图标 “模型”图标。icon in the sidebar.

  2. 单击一个终结点。Click an endpoint.

  3. 单击 “编辑”Click Edit.

  4. 在“标记”行中,输入标记键和值。In the Tags row, enter a tag key and value.

    添加标记Add tag

  5. 单击“保存并重启”。Click Save and restart.

监视 SQL 终结点Monitor a SQL endpoint

可检查终结点处理的查询数和分配给终结点的群集数。You can examine the number of queries handled by the endpoint and the number of clusters allocated to the endpoint.

  1. 单击Click the “终结点”图标 “模型”图标。icon in the sidebar.

  2. 单击一个终结点。Click an endpoint.

  3. 单击 “监视”Click Monitoring.

    这会显示一个图表,其中有过去 6 小时内终结点处理的查询数量以及分配给终结点的群集数量。A chart showing the number of queries handled by the endpoint and the number of clusters allocated to the endpoint over the last 6 hours displays.

    单击图表右上方的时间刻度按钮可更改显示的时间段。Click a timescale button at the top right of the chart to change the displayed period. 例如,以下屏幕截图显示了 7 天的这类统计信息:For example, the following screenshot shows these statistics over 7 days:

    监视终结点Monitor endpoint

    备注

    仅当启用并配置了多群集负载均衡时,群集计数才能大于 1。The Cluster Count can be greater than one only if multi-cluster load balancing is enabled and configured.

群集大小Cluster size

本部分中的表将 SQL 终结点群集大小映射到 Azure Databricks 群集驱动程序大小和辅助角色计数。The table in this section maps SQL endpoint cluster sizes to Azure Databricks cluster driver size and worker counts.

群集大小Cluster size 驱动程序大小Driver size 辅助角色计数Worker count
2X-小2X-Small Standard_E8_v3Standard_E8_v3 11
X-小X-Small Standard_E8_v3Standard_E8_v3 22
Small Standard_E16_v3Standard_E16_v3 44
Medium Standard_E32_v3Standard_E32_v3 88
Large Standard_E32_v3Standard_E32_v3 1616
X-大X-Large Standard_E64_v3Standard_E64_v3 3232
2X-大2X-Large Standard_E64_v3Standard_E64_v3 6464
3X-大3X-Large Standard_E64_v3Standard_E64_v3 128128
4X-大4X-Large Standard_E64_v3Standard_E64_v3 256256

所有辅助角色的实例大小都是 Standard_E8_v3。The instance size of all workers is Standard_E8_v3.