快速入門:建立 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 訂用帳戶,請在開始前建立免費 Azure 帳戶If you don't have an Azure subscription, create a free Azure 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 test-resource-grouptest-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. 例如 mydataexplorerclusterFor example, mydataexplorercluster. 網域名稱 [region].kusto.windows.net 已附加至您提供的叢集名稱。The domain name [region].kusto.windows.net is appended to the cluster name you provide. 名稱只能包含小寫字母和數字。The name can contain only lowercase letters and numbers. 必須包含 3 到 22 個字元。It must contain from 3 to 22 characters.
    位置Location 美國西部West US 在本快速入門中,請選取 [美國西部]。Select West US for this quickstart. 至於生產系統,請選取最符合您需求的區域。For a production system, select the region that best meets your needs.
    計算規格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 入口網站中選取靠左側的 [資源群組],然後選取包含資料總管叢集的資源群組。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