팔로워 데이터베이스 사용

팔로워 데이터베이스 기능을 사용하면 다른 클러스터에 있는 데이터베이스를 Azure Data Explorer 클러스터에 연결할 수 있습니다. 팔로워 데이터베이스읽기 전용 모드로 연결되므로 데이터를 볼 수 있고 리더 데이터베이스에 수집된 데이터에 대한 쿼리를 실행할 수 있습니다. 팔로워 데이터베이스는 리더 데이터베이스의 변경 내용을 동기화합니다. 동기화 때문에, 데이터 가용성에 몇 초에서 몇 분의 데이터 지연이 있습니다. 시간 지연의 길이는 리더 데이터베이스 메타데이터의 전체 크기에 따라 달라집니다. 리더 및 팔로워 데이터베이스는 동일한 스토리지 계정을 사용하여 데이터를 가져옵니다. 스토리지는 리더 데이터베이스가 소유합니다. 팔로워 데이터베이스는 데이터를 수집할 필요 없이 데이터를 볼 수 있습니다. 연결된 데이터베이스는 읽기 전용 데이터베이스이므로 데이터베이스의 데이터, 테이블 및 정책을 수정할 수 없으며 다만, 캐싱 정책, 보안 주체권한은 제외됩니다. 연결된 데이터베이스는 삭제할 수 없습니다. 리더 또는 팔로워가 분리해야만 삭제할 수 있습니다.

팔로워 기능을 사용하여 다른 클러스터에 데이터베이스를 연결하는 것은 조직과 팀 간에 데이터를 공유하기 위한 인프라로 사용됩니다. 이 기능은 프로덕션 환경을 보호하기 위해 컴퓨팅 리소스를 비프로덕션 사용 사례와 분리하는 데 유용합니다. 팔로워는 Azure Data Explorer 클러스터의 비용을 데이터에 대한 쿼리를 실행하는 파티와 연결하는 데 사용할 수도 있습니다.

이전 SDK 버전을 기반으로 하는 코드 샘플은 보관된 문서를 참조하세요.

어떤 데이터베이스가 팔로우되나요?

  • 클러스터는 리더 클러스터의 데이터베이스 하나, 여러 데이터베이스 또는 모든 데이터베이스를 팔로우할 수 있습니다.
  • 클러스터 하나가 여러 리더 클러스터의 데이터베이스를 팔로우할 수 있습니다.
  • 클러스터는 팔로워 데이터베이스와 리더 데이터베이스를 모두 포함할 수 있습니다.

사전 요구 사항

데이터베이스 연결

데이터베이스를 연결하는 데 사용할 수 있는 방법은 다양합니다. 이 문서에서는 C#, Python, PowerShell 또는 Azure Resource Manager 템플릿을 사용하여 데이터베이스를 연결하는 방법에 대해 설명합니다. 데이터베이스를 연결하려면 리더 클러스터 및 팔로워 클러스터에 대한 기여자 역할 이상의 사용자, 그룹, 서비스 주체 또는 관리 ID가 있어야 합니다. Azure Portal, PowerShell, Azure CLI, ARM 템플릿을 사용하여 역할 할당을 추가하거나 제거합니다. Azure RBAC(Azure 역할 기반 액세스 제어)다양한 역할에 대해 자세히 알아보세요.

테이블 수준 공유

데이터베이스를 연결하면 모든 테이블, 외부 테이블 및 구체화된 뷰도 팔로우됩니다. 특정 테이블/외부 테이블/구체화된 뷰는 'TableLevelSharingProperties'를 설정하여 공유할 수 있습니다.

'TableLevelSharingProperties'에는 , , , materializedViewsToIncludeexternalTablesToIncludetablesToExcludeexternalTablesToExcludematerializedViewsToExcludefunctionsToInclude및 8개의 문자열 tablesToInclude배열이 포함됩니다.functionsToExclude 모든 배열의 최대 항목 수는 합쳐서 100개입니다.

참고

  • 모든 데이터베이스 표기법('*')을 사용하는 경우 테이블 수준 공유가 지원되지 않습니다.
  • 구체화된 뷰가 포함되면 원본 테이블도 포함됩니다.

  1. 모든 테이블을 포함합니다. 모든 테이블이 기본적으로 팔로우되기 때문에 '*'는 필요하지 않습니다.

    tablesToInclude = []
    
  2. 이름이 "Logs"로 시작하는 모든 테이블을 포함합니다.

    tablesToInclude = ["Logs*"]
    
  3. 외부 테이블을 모두 제외합니다.

    externalTablesToExclude = ["*"]
    
  4. 구체화된 뷰를 모두 제외합니다.

    materializedViewsToExclude=["*"]
    

데이터베이스 이름 재정의

필요에 따라 팔로워 클러스터의 데이터베이스 이름을 리더 클러스터와 다르게 만들 수 있습니다. 예를 들어 여러 리더 클러스터의 동일한 데이터베이스 이름을 팔로워 클러스터에 연결할 수 있습니다. 다른 데이터베이스 이름을 지정하려면 'DatabaseNameOverride' 또는 'DatabaseNamePrefix' 속성을 구성합니다.

C#을 사용하여 데이터베이스 연결

필수 NuGet 패키지

C# 예제

var tenantId = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"; //Directory (tenant) ID
var clientId = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"; //Application ID
var clientSecret = "PlaceholderClientSecret"; //Client Secret
var followerSubscriptionId = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx";
var credentials = new ClientSecretCredential(tenantId, clientId, clientSecret);
var resourceManagementClient = new ArmClient(credentials, followerSubscriptionId);
var followerResourceGroupName = "followerResourceGroup";
var followerClusterName = "follower";
var subscription = await resourceManagementClient.GetDefaultSubscriptionAsync();
var resourceGroup = (await subscription.GetResourceGroupAsync(followerResourceGroupName)).Value;
var cluster = (await resourceGroup.GetKustoClusterAsync(followerClusterName)).Value;
var attachedDatabaseConfigurations = cluster.GetKustoAttachedDatabaseConfigurations();
var attachedDatabaseConfigurationName = "attachedDatabaseConfiguration"
var leaderSubscriptionId = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx";
var leaderResourceGroup = "leaderResourceGroup";
var leaderClusterName = "leader";
var attachedDatabaseConfigurationData = new KustoAttachedDatabaseConfigurationData
{
    ClusterResourceId = new ResourceIdentifier($"/subscriptions/{leaderSubscriptionId}/resourceGroups/{leaderResourceGroup}/providers/Microsoft.Kusto/Clusters/{leaderClusterName}"),
    DatabaseName = "<databaseName>", // Can be a specific database name in a leader cluster or * for all databases
    DefaultPrincipalsModificationKind = KustoDatabaseDefaultPrincipalsModificationKind.Union,
    Location = AzureLocation.NorthCentralUS
};
// Table level sharing properties are not supported when using '*' all databases notation.
if (attachedDatabaseConfigurationData.DatabaseName != "*")
{
    // Set up the table level sharing properties - the following is just an example.
    attachedDatabaseConfigurationData.TableLevelSharingProperties = new KustoDatabaseTableLevelSharingProperties();
    attachedDatabaseConfigurationData.TableLevelSharingProperties.TablesToInclude.Add("table1");
    attachedDatabaseConfigurationData.TableLevelSharingProperties.TablesToExclude.Add("table2");
    attachedDatabaseConfigurationData.TableLevelSharingProperties.ExternalTablesToExclude.Add("exTable1");
    attachedDatabaseConfigurationData.TableLevelSharingProperties.ExternalTablesToInclude.Add("exTable2");
    attachedDatabaseConfigurationData.TableLevelSharingProperties.MaterializedViewsToInclude.Add("matTable1");
    attachedDatabaseConfigurationData.TableLevelSharingProperties.MaterializedViewsToExclude.Add("matTable2");
    attachedDatabaseConfigurationData.TableLevelSharingProperties.FunctionsToInclude.Add("func1");
    attachedDatabaseConfigurationData.TableLevelSharingProperties.FunctionsToExclude.Add("func2");
}
await attachedDatabaseConfigurations.CreateOrUpdateAsync(WaitUntil.Completed, attachedDatabaseConfigurationName, attachedDatabaseConfigurationData);

데이터베이스가 연결되었는지 확인

데이터베이스가 성공적으로 연결되었는지 확인하려면 Azure Portal에서 연결된 데이터베이스를 찾습니다. 팔로워 또는 리더 클러스터에서 데이터베이스가 성공적으로 연결되었는지 확인할 수 있습니다.

팔로워 클러스터 확인

  1. 팔로워 클러스터로 이동하여 데이터베이스를 선택합니다.

  2. 데이터베이스 목록에서 새 읽기 전용 데이터베이스를 검색합니다.

    포털의 읽기 전용 팔로워 데이터베이스 스크린샷

    데이터베이스 개요 페이지에서 이 목록을 볼 수도 있습니다.

    팔로워 클러스터 목록이 있는 데이터베이스 개요 페이지의 스크린샷

리더 클러스터 확인

  1. 리더 클러스터로 이동하고 데이터베이스를 선택합니다.

  2. 관련 데이터베이스가 다른 사용자와 공유됨로 표시되어 있는지 확인합니다.

  3. 관계 링크를 전환하여 세부 정보를 봅니다.

    리더 클러스터를 검사 위해 다른 사용자와 공유된 데이터베이스의 스크린샷

    데이터베이스 개요 페이지에서 이를 볼 수도 있습니다.

    다른 사용자와 공유되는 데이터베이스 목록이 있는 개요의 스크린샷.

팔로워 데이터베이스 분리

참고

팔로워 또는 리더 측에서 데이터베이스를 분리하려면 데이터베이스를 분리하려는 클러스터에 기여자 역할 이상이 있는 사용자, 그룹, 서비스 주체 또는 관리 ID가 있어야 합니다. 아래 예제에서는 서비스 주체를 사용합니다.

C#을 사용하여 팔로워 클러스터에서 연결된 팔로워 데이터베이스 분리**

팔로워 클러스터는 연결된 팔로워 데이터베이스를 다음과 같이 분리할 수 있습니다.

var tenantId = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"; //Directory (tenant) ID
var clientId = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"; //Application ID
var clientSecret = "PlaceholderClientSecret"; //Client Secret
var followerSubscriptionId = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx";
var credentials = new ClientSecretCredential(tenantId, clientId, clientSecret);
var resourceManagementClient = new ArmClient(credentials, followerSubscriptionId);
var followerResourceGroupName = "testrg";
//The cluster and database attached database configuration are created as part of the prerequisites
var followerClusterName = "follower";
var attachedDatabaseConfigurationsName = "attachedDatabaseConfiguration";
var subscription = await resourceManagementClient.GetDefaultSubscriptionAsync();
var resourceGroup = (await subscription.GetResourceGroupAsync(followerResourceGroupName)).Value;
var cluster = (await resourceGroup.GetKustoClusterAsync(followerClusterName)).Value;
var attachedDatabaseConfiguration = (await cluster.GetKustoAttachedDatabaseConfigurationAsync(attachedDatabaseConfigurationsName)).Value;
await attachedDatabaseConfiguration.DeleteAsync(WaitUntil.Completed);

C#을 사용하여 리더 클러스터에서 연결된 팔로워 데이터베이스 분리

리더 클러스터는 연결된 데이터베이스를 다음과 같이 분리할 수 있습니다.

var tenantId = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"; //Directory (tenant) ID
var clientId = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"; //Application ID
var clientSecret = "PlaceholderClientSecret"; //Client Secret
var leaderSubscriptionId = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx";
var credentials = new ClientSecretCredential(tenantId, clientId, clientSecret);
var resourceManagementClient = new ArmClient(credentials, leaderSubscriptionId);
var leaderResourceGroupName = "testrg";
var leaderClusterName = "leader";
var subscription = await resourceManagementClient.GetDefaultSubscriptionAsync();
var resourceGroup = (await subscription.GetResourceGroupAsync(leaderResourceGroupName)).Value;
var cluster = (await resourceGroup.GetKustoClusterAsync(leaderClusterName)).Value;
var followerSubscriptionId = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx";
var followerResourceGroupName = "followerResourceGroup";
//The cluster and attached database configuration that are created as part of the Prerequisites
var followerClusterName = "follower";
var attachedDatabaseConfigurationsName = "attachedDatabaseConfiguration";
var followerDatabaseDefinition = new KustoFollowerDatabaseDefinition(
    clusterResourceId: new ResourceIdentifier($"/subscriptions/{followerSubscriptionId}/resourceGroups/{followerResourceGroupName}/providers/Microsoft.Kusto/Clusters/{followerClusterName}"),
    attachedDatabaseConfigurationName: attachedDatabaseConfigurationsName
);
await cluster.DetachFollowerDatabasesAsync(WaitUntil.Completed, followerDatabaseDefinition);

보안 주체, 권한 및 캐싱 정책 관리

보안 주체 관리

데이터베이스를 연결할 때 "기본 보안 주체 수정 종류" 를 지정합니다. 기본값은 권한 있는 보안 주체 재정의와 권한 있는 보안 주체의 리더 데이터베이스 컬렉션을 결합하는 것입니다.

종류 설명
Union 연결된 데이터베이스 보안 주체에 원본 데이터베이스 보안 주체와 팔로워 데이터베이스에 추가된 다른 새 보안 주체가 항상 포함됩니다.
바꾸기 원본 데이터베이스의 보안 주체를 상속하지 않습니다. 연결된 데이터베이스에 대해 새 보안 주체를 만들어야 합니다.
없음 연결된 데이터베이스 보안 주체에는 원래 데이터베이스의 보안 주체만 포함되고 다른 보안 주체는 포함되지 않습니다.

관리 명령을 사용하여 권한 있는 보안 주체를 구성하는 방법에 대한 자세한 내용은 팔로워 클러스터 관리를 위한 관리 명령을 참조하세요.

사용 권한 관리

읽기 전용 데이터베이스 권한을 관리하는 것은 모든 데이터베이스 유형의 경우와 동일합니다. 권한을 할당하려면 Azure Portal 데이터베이스 권한 관리를 참조하거나 관리 명령을 사용하여 데이터베이스 보안 역할 관리를 참조하세요.

캐싱 정책 구성

팔로워 데이터베이스 관리자는 호스팅 클러스터에 있는 연결된 데이터베이스 또는 테이블의 캐싱 정책을 수정할 수 있습니다. 기본값은 리더 클러스터 데이터베이스의 원본 데이터베이스와 테이블 수준 캐싱 정책을 데이터베이스 및 테이블 수준 재정의 정책에 정의된 정책과 결합하는 것입니다. 예를 들어, 리더 데이터베이스에는 월간 보고를 실행하기 위한 30일 캐싱 정책을 설정하고 팔로워 데이터베이스에는 문제 해결을 위해 최근 데이터만 쿼리하도록 3일 캐싱 정책을 설정할 수 있습니다. 관리 명령을 사용하여 팔로워 데이터베이스 또는 테이블에서 캐싱 정책을 구성하는 방법에 대한 자세한 내용은 팔로워 클러스터 관리를 위한 관리 명령을 참조하세요.

참고

  • 리더/팔로워 클러스터의 데이터베이스 간에 충돌이 있는 경우 모든 데이터베이스를 팔로워 클러스터가 팔로우하면 다음과 같이 해결됩니다.
    • 팔로워 클러스터에서 생성된 DB라는 이름의 데이터베이스는 리더 클러스터에서 생성된 동일한 이름의 데이터베이스보다 우선합니다. 따라서 팔로워 클러스터에 있는 데이터베이스인 DB를 제거하거나 이름을 바꿔야 팔로워 클러스터가 리더의 데이터베이스인 DB를 포함할 수 있습니다.
    • 둘 이상의 리더 클러스터에서 팔로우되는 DB라는 데이터베이스는 리더 클러스터 중 하나에서 임의로 선택되며 두 번 이상 팔로우되지 않습니다.
  • 팔로워 클러스터에서 실행되는 클러스터 활동 로그 및 기록을 표시하는 명령은 팔로워 클러스터의 활동 및 기록을 표시하며 리더 클러스터의 결과는 결과 집합에 포함되지 않습니다
    • 예: 팔로워 클러스터에서 실행되는 .show queries 명령은 팔로워 클러스터가 팔로우하는 데이터베이스에 대해 실행된 쿼리만 표시하고 리더 클러스터의 동일한 데이터베이스에 대해 실행된 쿼리는 표시하지 않습니다.

제한 사항

  • 팔로워와 리더 클러스터는 동일한 지역에 있어야 합니다.
  • 팔로우하는 데이터베이스에서 스트리밍 수집을 사용하는 경우 스트리밍 수집 데이터의 팔로우를 허용하도록 스트리밍 수집에 대해 팔로워 클러스터를 사용하도록 설정해야 합니다.
  • CMK( 고객 관리형 키 )를 사용하여 데이터 암호화를 사용하는 클러스터에 따라 다음과 같은 제한 사항이 지원됩니다.
    • 팔로워 클러스터와 리더 클러스터 모두 다른 클러스터를 따르지 않습니다.
    • 팔로워 클러스터가 CMK를 사용하도록 설정된 리더 클러스터를 따르고 있고 키에 대한 리더의 액세스가 취소되면 리더 클러스터와 팔로워 클러스터가 모두 일시 중단됩니다. 이 경우 CMK 문제를 resolve 다음 팔로워 클러스터를 다시 시작하거나 팔로워 클러스터에서 팔로워 데이터베이스를 분리하고 리더 클러스터와 독립적으로 다시 시작할 수 있습니다.
  • 다른 클러스터에 연결된 데이터베이스는 연결을 분리하기 전에는 삭제할 수 없습니다.
  • 다른 클러스터에 연결된 데이터베이스가 있는 클러스터는 연결을 분리하기 전에는 삭제할 수 없습니다.
  • 테이블 수준 공유 속성은 모든 데이터베이스를 팔로우할 때 지원되지 않습니다.
  • 팔로워 데이터베이스에서 관리 ID를 인증 방법으로 사용하는 외부 테이블을 쿼리하려면 관리 ID를 팔로워 클러스터에 추가해야 합니다. 이 기능은 리더 및 팔로워 클러스터가 다른 테넌트에서 프로비전될 때 작동하지 않습니다.

다음 단계