我正在尝试使用Kusto C# SDK运行purge命令进行测试
我正在执行.show purges,据我所知,如果我可以执行这个命令,那么我也可以执行其他清除命令
我使用了带有摄取前缀的连接字符串(就像在这个答案https://github.com/Azure/azure-kusto-python/issues/165中一样),但是我无法使用purge命令
public AdxConnection()
{
// https://ingest-mycluster.myregion.kusto.windows.net
var connStringBuilder = new KustoConnectionStringBuilder(_connectionString)
.WithAadApplicationKeyAuthentication(_clientId, _clientSecret, _tenantId);
_adminProvider = KustoClientFactory.CreateCslAdminProvider(connStringBuilder);
}
public async Task Purge()
{
var purgeCommand = CslCommandGenerator.GenerateShowPurgeCommand(_database);
await _adminProvider.ExecuteControlCommandAsync(_database, purgeCommand);
}以下是Kusto的回应
Syntax error: Query could not be parsed: {
"error": {
"code": "BadRequest_SyntaxError",
"message": "Request is invalid and cannot be executed.",
"@type": "Kusto.Data.Exceptions.SyntaxException",
"@message": "Syntax error: Query could not be parsed: . Query: '.show database environment1 purge operations'",
"@context": {
"timestamp": "2020-02-21T11:04:52.4907001Z",
"serviceAlias": "INGEST-DATAMTE",
"machineName": "KDataMana000000",
"processName": "Kusto.WinSvc.DM.Svc",
"processId": 9420,
"threadId": 4368,
"appDomainName": "Kusto.WinSvc.DM.Svc.exe",
"clientRequestId": "KD2RunCommand;7ee3cb62-5c82-4a6d-9885-bc56a2339a15",
"activityId": "4058bf27-af5c-4bab-8d6f-c7c41473c89a",
"subActivityId": "3689c292-91a6-4595-8e60-663a4a59a370",
"activityType": "P.WCF.Service.ExecuteControlCommandInternal..IAdminClientServiceCommunicationContract",
"parentActivityId": "1a9d19bf-15fe-4c43-a154-9e47e3fa7a26",
"activityStack": "(Activity stack: CRID=KD2RunCommand;7ee3cb62-5c82-4a6d-9885-bc56a2339a15 ARID=4058bf27-af5c-4bab-8d6f-c7c41473c89a > DN.Admin.Client.ExecuteControlCommand/1a9d19bf-15fe-4c43-a154-9e47e3fa7a26 > P.WCF.Service.ExecuteControlCommandInternal..IAdminClientServiceCommunicationContract/3689c292-91a6-4595-8e60-663a4a59a370)"
},
"@permanent": true
}
}. Query: '.show database environment1 purge operations'*编辑:用GenerateDmPurgesShowCommand替换GenerateShowPurgeCommand可以解决问题。但是,在运行GenerateDmPurgeTableRecordsFirstPhase时,我遇到了另一个错误
InternalServiceError (520-UnknownError): {
"error": {
"code": "Internal service error",
"message": "Request aborted due to an internal service error.",
"@type": "Kusto.Common.Svc.Exceptions.AdminCommandInvalidOperationException",
"@message": "An admin command cannot be executed due to an invalid state: State='Operation PurgeTableRecords requires feature flag EnabledForPurge set on Engine'",
"@context": {
"timestamp": "2020-02-24T01:58:01.5764072Z",
"serviceAlias": "INGEST-DATAMTE",
"machineName": "KDataMana000000",
"processName": "Kusto.WinSvc.DM.Svc",
"processId": 5760,
"threadId": 6100,
"appDomainName": "Kusto.WinSvc.DM.Svc.exe",
"clientRequestId": "KD2RunCommand;64439168-29e4-420e-b04a-07dccf11c5a4",
"activityId": "855d59ba-3de2-44b4-9cac-62fbe5f7a5a3",
"subActivityId": "5872fb41-7483-49bd-922c-1ae6104771fc",
"activityType": "DM.MonitoredCommand",
"parentActivityId": "c31fbc9a-8ae5-4cbf-9070-db5e39b8d5fa",
"activityStack": "(Activity stack: CRID=KD2RunCommand;64439168-29e4-420e-b04a-07dccf11c5a4 ARID=855d59ba-3de2-44b4-9cac-62fbe5f7a5a3 > DN.Admin.Client.ExecuteControlCommand/bf23f2c3-d82b-4cf0-9f2b-0bfd32d55bc5 > P.WCF.Service.ExecuteControlCommandInternal..IAdminClientServiceCommunicationContract/c31fbc9a-8ae5-4cbf-9070-db5e39b8d5fa > DM.MonitoredCommand/5872fb41-7483-49bd-922c-1ae6104771fc)"
},
"@permanent": false
}
}我是否需要联系Kusto团队将EnabledForPurge设置为true,或者我可以自己使用命令进行设置?这不是我在文档中找到的东西。
发布于 2020-02-21 22:27:13
操作.show database environment1 purge operations是一个应该在"engine“集群上执行的命令,在您的示例中,这意味着DATAMTE (而不是ingest-DATAMTE)。
在本例中,您可能会发现"DM“(INGEST-DATAME)上的以下命令更有用:https://docs.microsoft.com/en-us/azure/kusto/concepts/data-purge#track-purge-operation-status
此命令通过指定请求时间段内的操作Id来显示清除操作状态
更新问题的更新答案:您需要联系Kusto将您的集群加入白名单进行刷新。
https://stackoverflow.com/questions/60337417
复制相似问题