快速入门:创建 Azure 数据资源管理器群集和数据库Quickstart: Create an Azure Data Explorer cluster and database

Azure 数据资源管理器是一项快速且高度可缩放的数据探索服务,适用于日志和遥测数据。Azure Data Explorer is a fast and highly scalable data exploration service for log and telemetry data. 若要使用 Azure 数据资源管理器,请先创建群集,再在该群集中创建一个或多个数据库。To use Azure Data Explorer, you first create a cluster, and create one or more databases in that cluster. 然后将数据引入(加载)到数据库,以便对其运行查询。Then you ingest (load) data into a database so that you can run queries against it. 在本快速入门中,你将创建群集和数据库。In this quickstart, you create a cluster and a database.

如果没有 Azure 订阅,可在开始前创建一个试用帐户If you don't have an Azure subscription, create a trial account before you begin.

登录到 Azure 门户Sign in to the Azure portal

登录到 Azure 门户Sign in to the Azure portal.

创建群集Create a cluster

使用 Azure 资源组中的定义的一组计算和存储资源创建 Azure 数据资源管理器。Create an Azure Data Explorer cluster with a defined set of compute and storage resources in an Azure resource group.

  1. 选择门户左上角的“+ 创建资源”按钮。Select the + Create a resource button in the upper-left corner of the portal.

  2. 搜索“Azure 数据资源管理器”。Search for Azure Data Explorer.

    搜索资源

  3. 在屏幕底部“Azure 数据资源管理器”下,选择“创建” 。Under Azure Data Explorer, at the bottom of the screen, select Create.

  4. 使用以下信息填写基本群集详细信息。Fill out the basic cluster details with the following information.

    “创建群集”窗体

    设置Setting 建议的值Suggested value 字段说明Field description
    订阅Subscription 你的订阅Your subscription 选择要用于群集的 Azure 订阅。Select the Azure subscription that you want to use for your cluster.
    资源组Resource group 你的资源组Your resource group 使用现有资源组或创建新资源组。Use an existing resource group or create a new resource group.
    群集名称Cluster name 唯一的群集名称A unique cluster name 选择用于标识群集的唯一名称。Choose a unique name that identifies your cluster. 域名 [region].kusto.chinacloudapi.cn 将追加到所提供的群集名称。The domain name [region].kusto.chinacloudapi.cn is appended to the cluster name you provide. 名称只能包含小写字母和数字。The name can contain only lowercase letters and numbers. 它必须包含 4 到 22 个字符。It must contain from 4 to 22 characters.
    区域Region “中国东部 2”或“中国北部 2” China East 2 or China North 2 对于本快速入门,请选择“中国东部 2”或“中国北部 2”(如果使用可用性区域) 。Select China East 2 or China North 2 (if using availability zones) for this quickstart. 对于生产系统,请选择最能满足你需求的区域。For a production system, select the region that best meets your needs.
    可用性区域Availability zones 1、2 和/或 31, 2, and/or 3 将群集实例放置在同一区域的不同可用性区域中(可选)。Place the cluster instances in various availability zones in the same region (optional). Azure 可用性区域是同一 Azure 区域中独特的物理位置。Azure Availability Zones are unique physical locations within the same Azure region. 它们保护 Azure 数据资源管理器群集和数据不会在部分区域发生故障。They protect an Azure Data Explorer cluster and data from partial region failure. 默认情况下,会在同一数据中心创建群集节点。The cluster nodes are created, by default, in the same data center. 通过选择多个可用性区域,可以消除单一故障点并确保高可用性。By selecting several availability zones you can eliminate a single point of failure and ensure high availability. 仅在群集创建过程中可以部署到可用性区域,后续无法修改。Deployment to availability zones is possible only during cluster creation and can't be modified at a later date.
    计算规格Compute specifications D13_v2D13_v2 对于本快速入门,请选择价格最低的规范。Select the lowest price specification for this quickstart. 对于生产系统,请选择最能满足你需求的规范。For a production system, select the specification that best meets your needs.
  5. 选择“查看 + 创建”以查看群集的详细信息,选择“创建”以预配群集 。Select Review + create to review your cluster details, and Create to provision the cluster. 预配通常需要大约 10 分钟。Provisioning typically takes about 10 minutes.

  6. 部署完成后,选择“转到资源”。When the deployment is complete, select Go to resource.

    转到资源

创建数据库Create a database

现在可以执行过程中的第二步:创建数据库。You're now ready for the second step in the process: database creation.

  1. 在“概述”选项卡上,选择“创建数据库”。On the Overview tab, select Create database.

    第 2 步:创建数据库

  2. 使用以下信息填写窗体。Fill out the form with the following information.

    “创建数据库”窗体

    设置Setting 建议的值Suggested value 字段说明Field description
    数据库名称Database name TestDatabaseTestDatabase 该数据库名称在群集中必须是唯一的。The database name must be unique within the cluster.
    保留期Retention period 36503650 保证数据可供查询的时间跨度(以天为单位)。The time span (in days) for which it's guaranteed that the data is kept available to query. 时间跨度从引入数据时算起。The time span is measured from the time that data is ingested.
    缓存期Cache period 3131 使频繁查询的数据在 SSD 存储或 RAM(而不是更长期的存储)中保持可用的时间跨度(以天为单位)。The time span (in days) for which to keep frequently queried data available in SSD storage or RAM, rather than in longer-term storage.
  3. 选择“创建”以创建数据库。Select Create to create the database. 创建过程通常需要不到一分钟的时间。Creation typically takes less than a minute. 该过程完成后,将返回到群集的“概述”选项卡。When the process is complete, you're back on the cluster Overview tab.

在数据库中运行基本命令Run basic commands in the database

由于已有群集和数据库,因此可以运行查询和命令。Now that you have a cluster and database, you can run queries and commands. 数据库中尚无任何数据,但仍可以查看工具的工作原理。You don't have any data in the database yet, but you can still see how the tools work.

  1. 在群集下,选择“查询”。Under your cluster, select Query. 将命令 .show databases 粘贴到查询窗口中,然后选择“运行”。Paste the command .show databases into the query window, then select Run.

    显示数据库命令

    结果集显示“TestDatabase”,这是群集中的唯一数据库。The result set shows TestDatabase, the only database in the cluster.

  2. 将命令 .show tables 粘贴到查询窗口中,然后选择“运行”。Paste the command .show tables into the query window and select Run.

    此命令将返回空的结果集,因为你尚未拥有任何表。This command returns an empty result set because you don't have any tables yet. 将在本系列的下一篇文章中添加表。You add a table in the next article in this series.

停止并重新启动群集Stop and restart the cluster

可以停止并重新启动群集,具体取决于业务需求。You can stop and restart a cluster depending on business needs.

  1. 若要停止群集,请在“概述”选项卡顶部选择“停止”。To stop the cluster, at the top of the Overview tab, select Stop.

    停止群集后,数据不可用于查询,并且无法引入新数据。When the cluster is stopped, data is not available for queries, and you can't ingest new data.

  2. 若要重新启动群集,请在“概述”选项卡顶部选择“启动”。To restart the cluster, at the top of the Overview tab, select Start.

    重新启动群集后,需要约 10 分钟才能使用(如同最初预配时那样)。When the cluster is restarted, it takes about 10 minutes for it to become available (like when it was originally provisioned). 需要额外时间才能将数据加载到热缓存中。It takes additional time for data to load into the hot cache.

清理资源Clean up resources

如果计划学习其他快速入门和教程,请保留创建的资源。If you plan to follow other quickstarts and tutorials, keep the resources you created. 否则,请清理资源组以避免产生费用。Otherwise, clean up your resource group, to avoid incurring costs.

  1. 在 Azure 门户的最左侧选择“资源组”,然后选择包含 Azure 数据资源管理器群集的资源组。In the Azure portal, select Resource groups on the far left, and then select the resource group that contains your Data Explorer cluster.

  2. 选择“删除资源组”以删除整个资源组。Select Delete resource group to delete the entire resource group. 如果使用现有的资源组,可以选择仅删除数据资源管理器群集。If using an existing resource group, you can choose to only delete the Data Explorer cluster.

后续步骤Next steps