追蹤資料庫 功能可讓您將位於不同叢集中的資料庫附加至 Azure 數據總管叢集。
從屬資料庫 會以 只讀 模式附加,使您可以檢視數據,並對已擷取到 主資料庫的數據執行查詢。 追蹤者資料庫會同步領導者資料庫的變更。 由於同步處理,數據可用性會有幾秒鐘到幾分鐘的數據延遲。 時間延遲的長度取決於領導者資料庫元數據的整體大小。 領導者和追蹤者資料庫會使用相同的記憶體帳戶來擷取數據。 記憶體是由領導者資料庫所擁有。 後續資料庫會檢視數據,而不需要擷取數據。 由於附加資料庫是只讀資料庫,因此除了 快取原則、主體和 許可權之外,無法修改資料庫中的數據、數據表和原則。 無法刪除附加的資料庫。 它們必須由領導者或跟隨者移除,然後才能刪除。
使用追隨功能將資料庫附加至不同的叢集,作為在組織和團隊之間共享資料的基礎架構。 此功能有助於隔離計算資源,以保護生產環境免於非生產使用案例。 追蹤程式也可以用來將 Azure 數據總管叢集的成本與對數據執行查詢的合作對象產生關聯。
追蹤哪些資料庫?
- 叢集可以遵循一個資料庫、數個資料庫或領導者叢集的所有資料庫。
- 單一叢集可以追蹤來自多個領導者叢集的資料庫。
- 叢集可以同時包含追蹤者資料庫和領導者資料庫。
- EngineV3 叢集只能遵循 EngineV3 叢集,同樣地,EngineV2 叢集只能遵循 V2 叢集。
先決條件
附加資料庫
您可以使用各種方法來附加資料庫。 在本文中,我們會討論使用 C#、Python、PowerShell 或 Azure Resource Manager 範本附加資料庫。
若要附加資料庫,您必須擁有使用者、群組、服務主體或受控身份,而且在領導者叢集和追隨者叢集上至少具備貢獻者角色。 使用 Azure 入口網站、PowerShell、Azure CLI和 ARM 範本新增或移除角色指派。 深入瞭解 Azure 角色型訪問控制 (Azure RBAC) 和 不同角色。
資料表層級共用
在附加資料庫時,所有資料表、外部數據表和具體化檢視也會被隨附。 您可以藉由設定 『TableLevelSharingProperties',來共用特定的數據表/外部數據表/具體化檢視。
'TableLevelSharingProperties' 包含八個字串陣列:tablesToInclude、tablesToExclude、externalTablesToInclude、externalTablesToExclude、materializedViewsToInclude、materializedViewsToExclude、functionsToInclude和 functionsToExclude。 所有陣列中的項目數目上限為100。
備註
使用 『*』 所有資料庫表示法時,不支持數據表層級共用。
範例
包含所有數據表。 不需要 『*』,因為所有數據表預設都會跟著:
tablesToInclude = []
包含名稱開頭為 「Logs」 的所有資料表:
tablesToInclude = ["Logs*"]
排除所有外部資料表:
externalTablesToExclude = ["*"]
排除所有實體化視圖:
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 = await ApplicationTokenProvider.LoginSilentAsync(tenantId, clientId, clientSecret);
var resourceManagementClient = new KustoManagementClient(credentials) { SubscriptionId = followerSubscriptionId };
var followerResourceGroupName = "followerResourceGroup";
var followerClusterName = "follower";
var attachedDatabaseConfigurationName = "attachedDatabaseConfiguration"
var leaderSubscriptionId = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx";
var leaderResourceGroup = "leaderResourceGroup";
var leaderClusterName = "leader";
var attachedDatabaseConfigurationData = new AttachedDatabaseConfiguration
{
ClusterResourceId = $"/subscriptions/{leaderSubscriptionId}/resourceGroups/{leaderResourceGroup}/providers/Microsoft.Kusto/Clusters/{leaderClusterName}",
DatabaseName = "<databaseName>", // Can be specific database name or * for all databases
DefaultPrincipalsModificationKind = "Union",
Location = "North Central US"
};
// 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 TableLevelSharingProperties(
tablesToInclude:new List<string> { "table1" },
tablesToExclude:new List<string> { "table2" },
externalTablesToInclude:new List<string> { "exTable1" },
externalTablesToExclude:new List<string> { "exTable2" },
materializedViewsToInclude:new List<string> { "matTable1" },
materializedViewsToExclude:new List<string> { "matTable2" }
);
}
await resourceManagementClient.AttachedDatabaseConfigurations.CreateOrUpdateAsync(
followerResourceGroupName, followerClusterName, attachedDatabaseConfigurationName, attachedDatabaseConfigurationData
);
使用 Python 附加資料庫
必備模組
pip install azure-common
pip install azure-mgmt-kusto
Python 範例
from azure.mgmt.kusto import KustoManagementClient
from azure.mgmt.kusto.models import AttachedDatabaseConfiguration
from azure.common.credentials import ServicePrincipalCredentials
import datetime
#Directory (tenant) ID
tenant_id = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"
#Application ID
client_id = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"
#Client Secret
client_secret = "xxxxxxxxxxxxxx"
follower_subscription_id = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"
leader_subscription_id = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"
credentials = ServicePrincipalCredentials(
client_id=client_id,
secret=client_secret,
tenant=tenant_id
)
kusto_management_client = KustoManagementClient(credentials, follower_subscription_id)
follower_resource_group_name = "followerResourceGroup"
leader_resource_group_name = "leaderResourceGroup"
follower_cluster_name = "follower"
leader_cluster_name = "leader"
attached_database_Configuration_name = "uniqueNameForAttachedDatabaseConfiguration"
database_name = "db" # Can be specific database name or * for all databases
default_principals_modification_kind = "Union"
location = "North Central US"
cluster_resource_id = "/subscriptions/" + leader_subscription_id + "/resourceGroups/" + leader_resource_group_name + "/providers/Microsoft.Kusto/Clusters/" + leader_cluster_name
table_level_sharing_properties = None
if (database_name != "*"):
#Set up the table level sharing properties - the following is just an example.
tables_to_include = ["table1", "table2", "table3"]
external_tables_to_exclude = ["Logs*"]
table_level_sharing_properties = TableLevelSharingProperties(tables_to_include = tables_to_include, external_tables_to_exclude = external_tables_to_exclude)
attached_database_configuration_properties = AttachedDatabaseConfiguration(cluster_resource_id = cluster_resource_id, database_name = database_name, default_principals_modification_kind = default_principals_modification_kind, location = location, table_level_sharing_properties = table_level_sharing_properties)
#Returns an instance of LROPoller, see https://learn.microsoft.com/python/api/msrest/msrest.polling.lropoller?view=azure-python
poller = kusto_management_client.attached_database_configurations.create_or_update(follower_resource_group_name, follower_cluster_name, attached_database_Configuration_name, attached_database_configuration_properties)
使用 PowerShell 附加資料庫
先決條件模組
Install : Az.Kusto
PowerShell 範例
$FollowerClustername = 'follower'
$FollowerClusterSubscriptionID = 'xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx'
$FollowerResourceGroupName = 'followerResourceGroup'
$DatabaseName = "db" ## Can be specific database name or * for all databases
$LeaderClustername = 'leader'
$LeaderClusterSubscriptionID = 'xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx'
$LeaderClusterResourceGroup = 'leaderResourceGroup'
$DefaultPrincipalsModificationKind = 'Union'
##Construct the LeaderClusterResourceId and Location
$getleadercluster = Get-AzKustoCluster -Name $LeaderClustername -ResourceGroupName $LeaderClusterResourceGroup -SubscriptionId $LeaderClusterSubscriptionID -ErrorAction Stop
$LeaderClusterResourceid = $getleadercluster.Id
$Location = $getleadercluster.Location
##Handle the config name if all databases needs to be followed
if($DatabaseName -eq '*') {
$configname = $FollowerClustername + 'config'
}
else {
$configname = $DatabaseName
}
##Table level sharing is not supported when using '*' all databases notation. If you use the all database notation please remove all table level sharing lines from the powershell command.
New-AzKustoAttachedDatabaseConfiguration -ClusterName $FollowerClustername `
-Name $configname `
-ResourceGroupName $FollowerResourceGroupName `
-SubscriptionId $FollowerClusterSubscriptionID `
-DatabaseName $DatabaseName `
-ClusterResourceId $LeaderClusterResourceid `
-DefaultPrincipalsModificationKind $DefaultPrincipalsModificationKind `
-Location $Location `
-TableLevelSharingPropertyTablesToInclude "table1", "table2", "table3" `
-TableLevelSharingPropertyExternalTablesToExclude "Logs*" `
-ErrorAction Stop
使用 Azure Resource Manager 樣本附加資料庫
您可以使用 Azure Resource Manager 範本 將資料庫附加至現有的叢集。
使用下列步驟附加資料庫:
使用下表中的資訊建立範本,以協助您進行設定。
|
參數 |
說明 |
範例 |
|
followerClusterName |
從屬叢集的名稱;範本將在此處部署。 |
|
|
已附加資料庫配置名稱 |
附加資料庫組態物件的名稱。 名稱可以是叢集層級唯一的任何字串。 |
|
|
databaseName |
要追蹤的資料庫名稱。 若要遵循所有領導者的資料庫,請使用 『*』。 |
|
|
leaderClusterResourceId |
領導者叢集的資源標識碼。 |
|
|
defaultPrincipalsModificationKind |
默認主要修改類型。 |
可以是 Union、Replace 或 None。 如需預設主體修改種類的詳細資訊,請參閱 主體修改種類控件命令。 |
|
包含的表格 |
要包含的數據表清單。 若要包含以 『Logs』 開頭的所有數據表,請使用 [“Logs*”]。 |
["table1ToInclude", "table2ToInclude"] |
|
要排除的表格 |
要排除的數據表清單。 若要排除所有數據表,請使用 [“*”]。 |
["table1ToExclude", "table2ToExclude"] |
|
要包含的外部表格 |
要包含的數據表清單。 若要包含以 『Logs』 開頭的所有外部數據表,請使用 [“Logs*”]。 |
["ExternalTable1ToInclude", "ExternalTable2ToInclude"] |
|
外部表格排除 |
要排除的數據表清單。 若要排除所有外部數據表,請使用 [“*”]。 |
["ExternalTable1ToExclude", "ExternalTable2ToExclude"] |
|
materializedViewsToInclude(使用的物化视图) |
要包含的具體化檢視清單。 若要包含以 『Logs』 開頭的所有具體化檢視,請使用 [“Logs*”]。 |
["Mv1ToInclude", "Mv2ToInclude"] |
|
要排除的物化視圖 |
要排除的具象化檢視列表。 若要排除所有具體化檢視,請使用 [“*”]。 |
["Mv11ToExclude", "Mv22ToExclude"] |
|
functionsToInclude |
所需包含的功能列表。 |
["FunctionToInclude"] |
|
排除功能 |
要排除的函式清單。 |
["FunctionToExclude"] |
|
位置 |
所有資源的位置。 領導者和追蹤者必須位於相同的位置。 |
|
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"followerClusterName": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Name of the cluster to which the database will be attached."
}
},
"attachedDatabaseConfigurationsName": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Name of the attached database configurations to create."
}
},
"databaseName": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "The name of the database to follow. You can follow all databases by using '*'."
}
},
"leaderClusterResourceId": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "The resource ID of the leader cluster."
}
},
"defaultPrincipalsModificationKind": {
"type": "string",
"defaultValue": "Union",
"metadata": {
"description": "The default principal modification kind."
}
},
"tablesToInclude": {
"type": "array",
"defaultValue": [],
"metadata": {
"description": "The list of tables to include. Not supported when following all databases."
}
},
"tablesToExclude": {
"type": "array",
"defaultValue": [],
"metadata": {
"description": "The list of tables to exclude. Not supported when following all databases."
}
},
"externalTablesToInclude": {
"type": "array",
"defaultValue": [],
"metadata": {
"description": "The list of external tables to include. Not supported when following all databases."
}
},
"externalTablesToExclude": {
"type": "array",
"defaultValue": [],
"metadata": {
"description": "The list of external tables to exclude. Not supported when following all databases."
}
},
"materializedViewsToInclude": {
"type": "array",
"defaultValue": [],
"metadata": {
"description": "The list of materialized views to include. Not supported when following all databases."
}
},
"materializedViewsToExclude": {
"type": "array",
"defaultValue": [],
"metadata": {
"description": "The list of materialized views to exclude. Not supported when following all databases."
}
},
"functionsToInclude": {
"type": "array",
"defaultValue": [],
"metadata": {
"description": "The list of functions to include."
}
},
"functionsToExclude": {
"type": "array",
"defaultValue": [],
"metadata": {
"description": "The list of functions to exclude."
}
},
"location": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Location for all resources."
}
}
},
"variables": {},
"resources": [
{
"name": "[concat(parameters('followerClusterName'), '/', parameters('attachedDatabaseConfigurationsName'))]",
"type": "Microsoft.Kusto/clusters/attachedDatabaseConfigurations",
"apiVersion": "2021-01-01",
"location": "[parameters('location')]",
"properties": {
"databaseName": "[parameters('databaseName')]",
"clusterResourceId": "[parameters('leaderClusterResourceId')]",
"defaultPrincipalsModificationKind": "[parameters('defaultPrincipalsModificationKind')]",
"tableLevelSharingProperties":{
"tablesToInclude": "[parameters('tablesToInclude')]",
"tablesToExclude": "[parameters('tablesToExclude')]",
"externalTablesToInclude": "[parameters('externalTablesToInclude')]",
"externalTablesToExclude": "[parameters('externalTablesToExclude')]",
"materializedViewsToInclude": "[parameters('materializedViewsToInclude')]",
"materializedViewsToExclude": "[parameters('materializedViewsToExclude')]",
"functionsToInclude": "[parameters('functionsToInclude')]",
"functionsToExclude": "[parameters('functionsToExclude')]"
}
}
}
]
}
使用 Azure 入口網站 或 PowerShell 部署 Azure Resource Manager 範本。
確認資料庫已成功附加
若要確認資料庫已成功連結,請在 azure 入口網站 中尋找附加的資料庫。 您可以確認資料庫是否已成功附加在 從屬 或 主節點 叢集中。
檢查您的追蹤者群組
瀏覽至從屬叢集,然後選取 [資料庫]。
在資料庫清單中,搜尋新的唯讀資料庫。
您也可以在資料庫概觀頁面中檢視此清單:
檢查您的領導者叢集
瀏覽至主叢集,然後選取 [資料庫]
檢查相關資料庫是否標示為與其他人共用 >[是]
切換關聯性連結以檢視詳細數據。
您也可以在資料庫概觀頁面中檢視此專案:
卸載追隨者資料庫
備註
若要從從屬或主導端卸離資料庫,您必須擁有使用者、群組、服務主體或管理識別,且在要卸離資料庫的叢集上至少具有協作者角色。 在以下範例中,我們使用服務主體。
使用 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 = await ApplicationTokenProvider.LoginSilentAsync(tenantId, clientId, clientSecret);
var resourceManagementClient = new KustoManagementClient(credentials) { SubscriptionId = followerSubscriptionId };
var followerResourceGroupName = "testrg";
//The cluster and database attached database configuration are created as part of the prerequisites
var followerClusterName = "follower";
var attachedDatabaseConfigurationsName = "attachedDatabaseConfiguration";
await resourceManagementClient.AttachedDatabaseConfigurations.DeleteAsync(
followerResourceGroupName, followerClusterName, attachedDatabaseConfigurationsName
);
使用 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 = await ApplicationTokenProvider.LoginSilentAsync(tenantId, clientId, clientSecret);
var resourceManagementClient = new KustoManagementClient(credentials) { SubscriptionId = leaderSubscriptionId };
var leaderResourceGroupName = "testrg";
var leaderClusterName = "leader";
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 FollowerDatabaseDefinition
{
ClusterResourceId = $"/subscriptions/{followerSubscriptionId}/resourceGroups/{followerResourceGroupName}/providers/Microsoft.Kusto/Clusters/{followerClusterName}",
AttachedDatabaseConfigurationName = attachedDatabaseConfigurationsName
};
await resourceManagementClient.Clusters.DetachFollowerDatabasesAsync(
leaderResourceGroupName, leaderClusterName, followerDatabaseDefinition
);
使用 Python 從追蹤者叢集中移除已連接的追蹤者資料庫
備援叢集可以卸離任何已連結的資料庫,如下所示:
from azure.mgmt.kusto import KustoManagementClient
from azure.common.credentials import ServicePrincipalCredentials
import datetime
#Directory (tenant) ID
tenant_id = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"
#Application ID
client_id = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"
#Client Secret
client_secret = "xxxxxxxxxxxxxx"
follower_subscription_id = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"
credentials = ServicePrincipalCredentials(
client_id=client_id,
secret=client_secret,
tenant=tenant_id
)
kusto_management_client = KustoManagementClient(credentials, follower_subscription_id)
follower_resource_group_name = "followerResourceGroup"
follower_cluster_name = "follower"
attached_database_configurationName = "uniqueName"
#Returns an instance of LROPoller, see https://learn.microsoft.com/python/api/msrest/msrest.polling.lropoller?view=azure-python
poller = kusto_management_client.attached_database_configurations.delete(follower_resource_group_name, follower_cluster_name, attached_database_configurationName)
使用 Python 將已連接的跟隨者資料庫從主叢集中移除
主叢集可以卸載任何所連接的資料庫,如下所示:
from azure.mgmt.kusto import KustoManagementClient
from azure.mgmt.kusto.models import FollowerDatabaseDefinition
from azure.common.credentials import ServicePrincipalCredentials
import datetime
#Directory (tenant) ID
tenant_id = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"
#Application ID
client_id = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"
#Client Secret
client_secret = "xxxxxxxxxxxxxx"
follower_subscription_id = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"
leader_subscription_id = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"
credentials = ServicePrincipalCredentials(
client_id=client_id,
secret=client_secret,
tenant=tenant_id
)
kusto_management_client = KustoManagementClient(credentials, follower_subscription_id)
follower_resource_group_name = "followerResourceGroup"
leader_resource_group_name = "leaderResourceGroup"
follower_cluster_name = "follower"
leader_cluster_name = "leader"
attached_database_configuration_name = "uniqueName"
location = "North Central US"
cluster_resource_id = "/subscriptions/" + follower_subscription_id + "/resourceGroups/" + follower_resource_group_name + "/providers/Microsoft.Kusto/Clusters/" + follower_cluster_name
#Returns an instance of LROPoller, see https://learn.microsoft.com/python/api/msrest/msrest.polling.lropoller?view=azure-python
poller = kusto_management_client.clusters.detach_follower_databases(resource_group_name = leader_resource_group_name, cluster_name = leader_cluster_name, cluster_resource_id = cluster_resource_id, attached_database_configuration_name = attached_database_configuration_name)
使用 PowerShell 卸載資料庫
必要條件模組
Install : Az.Kusto
範例
$FollowerClustername = 'follower'
$FollowerClusterSubscriptionID = 'xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx'
$FollowerResourceGroupName = 'followerResourceGroup'
$DatabaseName = "sanjn" ## Can be specific database name or * for all databases
##Construct the Configuration name
$confignameraw = (Get-AzKustoAttachedDatabaseConfiguration -ClusterName $FollowerClustername -ResourceGroupName $FollowerResourceGroupName -SubscriptionId $FollowerClusterSubscriptionID) | Where-Object {$_.DatabaseName -eq $DatabaseName }
$configname =$confignameraw.Name.Split("/")[1]
Remove-AzKustoAttachedDatabaseConfiguration -ClusterName $FollowerClustername -Name $configname -ResourceGroupName $FollowerResourceGroupName -SubscriptionId $FollowerClusterSubscriptionID
管理用戶主體、權限和快取政策
管理主體
附加資料庫時,請指定 「預設主體修改種類」。 默認值是將覆寫授權主體與 授權主體的領導者資料庫集合結合
|
親切 |
說明 |
|
聯集 / 工會 |
附加的資料庫主體一律會包含原始資料庫主體,以及新增至追蹤資料庫的其他新主體。 |
|
取代 |
原始資料庫沒有主體的繼承。 必須為附加的資料庫建立新主體。 |
|
沒有 |
附加的資料庫主體只包含原始資料庫的主體,沒有其他主體。 |
如需使用控制命令來設定授權主體的詳細資訊,請參閱 控制命令來管理追蹤者叢集。
管理許可權
管理唯讀資料庫許可權與所有資料庫類型的許可權相同。 請參閱 azure 入口網站中的 管理許可權。
從屬資料庫管理員可以修改附加資料庫或其主機叢集上任何資料表的 快取原則。 預設值是將領導者叢集資料庫和數據表層級快取原則中的源資料庫與資料庫和數據表層級覆寫原則中定義的原則結合在一起。 例如,您可以在領導者資料庫的 30 天快取原則上執行每月報告,以及追蹤者資料庫的三天快取原則,只查詢最近的數據以進行疑難解答。 如需利用控制指令在從屬資料庫或資料表上設定快取原則的詳細資訊,請參閱 控制指令以管理從屬叢集。
備註
- 如果主從叢集的資料庫之間發生衝突,當所有資料庫遵循從屬叢集時,衝突將如下解決:
- 在追蹤叢集上建立 DB 的資料庫,優先於在領導者叢集上建立的相同名稱的資料庫。 這就是為什麼需要移除或重新命名追蹤叢集中的資料庫 DB,讓追蹤者叢集包含領導者的資料庫 DB。
- 名為 DB 的資料庫將從兩個或多個領導者叢集中的 一個 任意選擇,且不會被選擇超過一次。
- 顯示 叢集活動記錄和歷程的命令在追隨者叢集 上運行時,會顯示該追隨者叢集內的活動和歷程記錄,且其結果集不會包含領導者叢集或其他叢集的結果。
- 例如:在從屬叢集上執行的
.show queries 命令只會顯示在從屬叢集所追蹤的資料庫上執行的查詢,而不會顯示在領導者叢集中針對相同資料庫執行的查詢。
局限性
- 追蹤者和領導者叢集必須位於相同的區域中。
- 如果在被追蹤的資料庫上使用 串流擷取,則必須在追蹤者叢集上啟用串流擷取,以允許追蹤串流擷取數據。
- 領導者和追蹤者叢集不支援使用 客戶自控密鑰的數據加密。
- 在卸離資料庫之前,您無法刪除附加至不同叢集的資料庫。
- 您無法刪除已連結至其他叢集的叢集,必須先將其卸離。
- 追蹤所有資料庫時,不支援數據表層級共享屬性。
後續步驟