Condividi tramite


Configurare lo scale-out del modello semantico

È possibile abilitare lo scale-out nel servizio Power BI o usare le API REST dei set di dati di Power BI. Prima di configurare il modello semantico, leggere la panoramica sullo scale-out del modello semantico di Power BI.

Abilitare lo scale-out nel servizio Power BI

Per abilitare lo scale-out per il modello semantico nel servizio Power BI, seguire questa procedura:

  1. Nel servizio Power BI, aprire l'area di lavoro con il modello semantico per cui si vuole abilitare lo scale-out.

  2. Selezionare altre opzioni del modello semantico (...).

  3. Dal menu selezionare Impostazioni.

  4. Nella pagina dell'impostazione abilitare il formato di archiviazione modello semantico di grandi dimensioni, se non è abilitato.

  5. Abilitare Scale-out query e selezionare Applica.

    Screenshot che mostra come abilitare lo scale-out nel servizio Power BI.

Abilitare lo scale-out usando le API REST set di dati

Questa sezione descrive l'uso delle API REST dei set di dati di Power BI per configurare lo scale-out del modello semantico.

Recuperare il datasetId

Per ottenere il datasetId, usare Get-PowerBIDataset. È necessario specificare un ID area di lavoro e un nome del modello semantico.

Login-PowerBI | Out-Null

$workspaceId = '<enter workspaceId>'

$datasetId = Get-PowerBIDataset -WorkspaceId $workspaceId `
    | Where{$_.Name -match "<enter semantic model name>"} `
    | Select-Object -ExpandProperty Id -First 1 `
    | ForEach-Object {$_.Guid}

Write-Host
Write-Host "Workspace Id: $workspaceId"
Write-Host "Dataset Id: $datasetId"

Ottenere la configurazione di scale-out corrente

Prima di configurare lo scale-out del modello semantico, determinare la configurazione corrente.

###
# Get current scale-out configuration
###
Login-PowerBI | Out-Null

$workspaceId = '<enter workspaceId>'

$datasetId = Get-PowerBIDataset -WorkspaceId $workspaceId `
    | Where{$_.Name -match "<enter semantic model name>"} `
    | Select-Object -ExpandProperty Id -First 1 `
    | ForEach-Object {$_.Guid}

$response = Invoke-PowerBIRestMethod -Url "groups/$workspaceId/datasets/$datasetId" -Method Get | ConvertFrom-Json

$response.queryScaleOutSettings | Format-List

if ($response.queryScaleOutSettings.maxReadOnlyReplicas -eq -1 `
    -or $response.queryScaleOutSettings.maxReadOnlyReplicas -gt 0)
{
    Write-Host "Semantic model scale-out is enabled."
}
else
{
    Write-Host "Semantic model scale-out is disabled."
}

Abilitare lo scale-out del modello semantico

Per abilitare lo scale-out del modello semantico, impostare maxReadOnlyReplicas su -1 o su qualsiasi valore diverso da 0. Un valore di -1 consente a Power BI di creare tutte le repliche di sola lettura supportate dalla capacità di Power BI. È inoltre possibile impostare in modo esplicito il numero di repliche su un valore inferiore a quello della capacità massima. È consigliabile impostare maxReadOnlyReplicas su -1.

###
# Enable scale-out
###
Login-PowerBI | Out-Null

$workspaceId = '<enter workspaceId>'

$datasetId = Get-PowerBIDataset -WorkspaceId $workspaceId `
    | Where{$_.Name -match "<enter semantic model name>"} `
    | Select-Object -ExpandProperty Id -First 1 `
    | ForEach-Object {$_.Guid}

Invoke-PowerBIRestMethod -Url "groups/$workspaceId/datasets/$datasetId" `
    -Method Patch -Body '{ "queryScaleOutSettings": { "maxReadOnlyReplicas": -1 }}'

Invoke-PowerBIRestMethod -Url "groups/$workspaceId/datasets/$datasetId" -Method Get `
    | ConvertFrom-Json | Select-Object -ExpandProperty queryScaleOutSettings `
    | ForEach { 
        if($_.maxReadOnlyReplicas -eq -1)
        { 
            Write-Host "Success! Semantic model scale-out has been enabled."
        } else
        {
            Write-Host "Something went wrong! Semantic model scale-out is still disabled." -ForegroundColor Red
        }
     }

Disabilitare lo scale-out del modello semantico

Per disabilitare lo scale-out del modello semantico, impostare maxReadOnlyReplicas su 0.

###
# Disable scale-out
###
Login-PowerBI | Out-Null

$workspaceId = '<enter workspaceId>'

$datasetId = Get-PowerBIDataset -WorkspaceId $workspaceId `
    | Where{$_.Name -match "<enter semantic model name>"} `
    | Select-Object -ExpandProperty Id -First 1 `
    | ForEach-Object {$_.Guid}

Invoke-PowerBIRestMethod -Url "groups/$workspaceId/datasets/$datasetId" `
    -Method Patch -Body '{ "queryScaleOutSettings": { "maxReadOnlyReplicas": 0 }}'

Invoke-PowerBIRestMethod -Url "groups/$workspaceId/datasets/$datasetId" -Method Get `
    | ConvertFrom-Json | Select-Object -ExpandProperty queryScaleOutSettings `
    | ForEach { 
        if($_.maxReadOnlyReplicas -eq 0)
        { 
            Write-Host "Success! Semantic model scale-out has been disabled."
        } else
        {
            Write-Host "Something went wrong! Semantic model scale-out is still enabled." -ForegroundColor Red
        }
     }